mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-06 13:30:00 +00:00
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:
2 files changed
+13
-2
No files matched your search
@@ -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 []
|
||||
|
||||
@@ -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")):
|
||||
|
||||
Reference in new issue
Block a user