From 42813e69b758c634e13c9ee5f46fac4ee3be7fd3 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 20 Jun 2023 12:21:10 -0700 Subject: [PATCH] wip on spinoff issue --- .efrocachemap | 32 +++++++++++++++---------------- tools/batools/spinoff/_context.py | 6 ++++-- tools/efrotools/__init__.py | 9 ++++++--- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 1128f8e9..9b8d6fa4 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4080,18 +4080,18 @@ "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1a/b6/9196bf7553c8380ddd37c8aba83f", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/24/56/34bbdafa6ed8d8505fa50b40e10a", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0c/9b/6dbedf9c32a5591fbc0724a7b050", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/73/88/fbbf37e501035577f8d7cb831693", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d9/a7/817abecb699307e03873c5052eb9", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/16/3e/5a02a80c844ea71c3ce1f229ff25", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/70/55/4193d7db70ccd79538e1e3746ca4", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ee/35/13f0e5511418e481dfa0268ca584", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c3/d0/4fc44285b21e6b3dc4d9b3c30a28", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/e8/02/9e3569c9b3fdbb1c7b645fd44c66", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/cd/30/211ea63ece7430c32a5d6957ee8b", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/a5/5f/1c69d9dab37d811da0cdde48d09f", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d9/3c/55bed47fb11287ae44d69cb4d94f", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/35/89/9d829c85c84a58c2c4f3ebeca3a3", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b8/3b/b2f787a50ed7a2271b0c65f0ab3e", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/d4/e0/328fba6fd87ac4edc90cedf8cbb3", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/cc/de/67965af8c1236c0d65ad5d9af9a9", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/15/55/a6760b4a180e46f947d4c71e316e", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/40/34/e85cd258290f34b79e9b97226f49", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/b8/c4/d5224c7d80c7f009ad4f9253e5cc", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/23/e3/d5d91a13820b34a71ef13c76120b", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ae/08/a08028e881fcdef7608a17d4312b", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/14/9e/3aaf965144a0da82bf6ae363a4fb", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8a/39/82acd22444cdde966df4838b3235", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/82/23/3da9e812f6d9d83e9c4678645792", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8a/39/82acd22444cdde966df4838b3235", @@ -4108,14 +4108,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2b/1d/067ca5d1bc54339f2b8682ef1aed", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/65/49/cdbaca8ea343d79992618514438c", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2b/1d/067ca5d1bc54339f2b8682ef1aed", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/4d/83/a8afed3f00bd33be23a2f7b3eb78", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/be/20/95c9eea8f49bd2648877ea7b677c", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/bf/ac/70be2b0f035907cd1e4c352e6d95", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/1f/2a/2f93f0206d29d5a856f61049e572", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/99/44/410a363149624bc3c48de32f5ea9", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/72/08/6aae7324f5b33f14acff6c8f9569", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/2c/3e/5c464e7594d73f73c5314e833764", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c1/ac/320ecc613ca3c37c0ea4517d2df7", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/ca/e0/5b837daec3c9946f58f20387b01b", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/5c/a7/b2e8a46999116012692ca14206c9", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/6d/33/2d02e52fdeb5058bda02aa88de87", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/56/3d/5167e1312bd0add04c4af6ae86d3", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/7e/f5/6da7745faf8efba3b0f239683455", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/30/42/8e05ee3524c3cf8c4c902d61a91b", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/fb/6a/31eb66e772d021632273c9b24a68", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/64/ad/173602de134654f695ab60c13d8c", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/f8/85/fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/48/4b/e6974f0a4d14be8213dc00d971c3", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/3e/7a/203e2a5d2b5bb42cfe3fd2fe16c2", diff --git a/tools/batools/spinoff/_context.py b/tools/batools/spinoff/_context.py index 4772ca9c..26c51fbb 100644 --- a/tools/batools/spinoff/_context.py +++ b/tools/batools/spinoff/_context.py @@ -788,11 +788,12 @@ class SpinoffContext: and src_path == 'ballisticakit-cmake/CMakeLists.txt' ): # Strip precompiled plus library out of the cmake file. - replace_exact( + text = replace_exact( text, '${CMAKE_CURRENT_BINARY_DIR}/prefablib/libballistica_plus.a' ' ode ', 'ode ', + label=src_path, ) if ( self._public @@ -801,7 +802,7 @@ class SpinoffContext: and src_path.endswith('.vcxproj') ): # Strip precompiled plus library out of visual studio projects. - replace_exact( + text = replace_exact( text, ' \n' ' \n' ' \n', '', + label=src_path, ) return self.default_filter_text(text) diff --git a/tools/efrotools/__init__.py b/tools/efrotools/__init__.py index b07cb692..869992dc 100644 --- a/tools/efrotools/__init__.py +++ b/tools/efrotools/__init__.py @@ -194,17 +194,20 @@ def writefile(path: str | Path, txt: str) -> None: outfile.write(txt) -def replace_exact(opstr: str, old: str, new: str, count: int = 1) -> str: +def replace_exact( + opstr: str, old: str, new: str, count: int = 1, label: str | None = None +) -> str: """Replace text ensuring that exactly x occurrences are replaced. Useful when filtering data in some predefined way to ensure the original has not changed. """ found = opstr.count(old) + label_str = f'in {label}' if label is not None else '' if found != count: raise RuntimeError( - f'Expected {count} string occurrence(s);' - f' found {found}. String = {old}' + f'Expected {count} string occurrence(s){label_str};' + f' found {found}. String: {repr(old)}' ) return opstr.replace(old, new)