Merge pull request #8011 from emirplus/fix-package-release-utf8-bom

fix(tools): decode CMake cache with utf-8-sig in package_release
This commit is contained in:
Dean authored and GitHub committed 2026-10-20 17:35:23 +13:00
commit f289e7de76
2 files changed
+13 -2

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@ ROOT = Path(__file__).resolve().parent.parent
def windows_runtime(build):
for line in (build / "CMakeCache.txt").read_text(encoding="utf-8").splitlines():
for line in (build / "CMakeCache.txt").read_text(encoding="utf-8-sig").splitlines():
if line.startswith("CMAKE_CXX_COMPILER:"):
compiler = line.partition("=")[2]
if compiler and not compiler.endswith("-NOTFOUND"):
@@ -24,7 +24,7 @@ def tracy_runtime(platform, build):
cache = build / "CMakeCache.txt"
if not cache.is_file():
return []
lines = cache.read_text(encoding="utf-8").splitlines()
lines = cache.read_text(encoding="utf-8-sig").splitlines()
enabled = next((line.partition("=")[2].upper() for line in lines if line.startswith("APS5_ENABLE_TRACY:")), "OFF")
if enabled in ("", "0", "OFF", "NO", "FALSE", "N", "IGNORE", "NOTFOUND") or enabled.endswith("-NOTFOUND"):
return []
+11
View File
@@ -82,6 +82,17 @@ class ReleasePackageTests(unittest.TestCase):
self.assertEqual(list(self.output.iterdir()), [previous])
self.assertEqual(previous.read_bytes(), b"existing output")
def test_windows_runtime_decodes_cmake_cache_with_utf8_bom(self):
compiler = self.root / "custom toolchain" / "bin" / "g++.exe"
(self.build / "CMakeCache.txt").write_bytes(b"\xef\xbb\xbfCMAKE_CXX_COMPILER:STRING=" + compiler.as_posix().encode("utf-8") + b"\n")
self.assertEqual(package_release.windows_runtime(self.build), compiler.parent)
def test_tracy_runtime_decodes_cmake_cache_with_utf8_bom(self):
client = self.build / "core/libs/libs/libTracyClient.dll"
client.write_bytes(b"client")
(self.build / "CMakeCache.txt").write_bytes(b"\xef\xbb\xbfAPS5_ENABLE_TRACY:BOOL=ON\n")
self.assertEqual(package_release.tracy_runtime("windows", self.build), [client])
def test_tracy_packages_include_only_the_target_platform_client(self):
directory = self.build / "core/libs/libs"
for platform, name in (("linux", "libTracyClient.so.0.14.1"), ("windows", "libTracyClient.dll")):