From 5afb918dd60ab6a70222562518f20c7da5710470 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 25 Apr 2024 16:50:25 -0700 Subject: [PATCH] removed need for yaml in format_cpp_str --- .efrocachemap | 60 ++++++++++++++-------------- CHANGELOG.md | 2 +- src/assets/ba_data/python/baenv.py | 2 +- src/ballistica/shared/ballistica.cc | 2 +- tools/efrotools/code.py | 40 +++++++------------ tools/efrotools/genwrapper.py | 2 +- tools/efrotools/pybuild.py | 61 +++++++++++++++++------------ 7 files changed, 84 insertions(+), 85 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 5a6e30a1..87886c53 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -2595,8 +2595,8 @@ "build/assets/pylib-android/_pylong.py": "e057ab3c9eea264704dff2af204884f8", "build/assets/pylib-android/_sitebuiltins.py": "8b5e3f6e73917962fa014ad2c4a55e61", "build/assets/pylib-android/_strptime.py": "8c65b46a50f13ca2389b19b32b7f2996", - "build/assets/pylib-android/_sysconfigdata__linux_.py": "90ccf964f2bb27f565a4e9d1f2298701", - "build/assets/pylib-android/_sysconfigdata_d_linux_.py": "5b0f120dabd3236bbf39e7630d6f97c4", + "build/assets/pylib-android/_sysconfigdata__linux_.py": "e112c946a141bcf18e0656a14a52ca71", + "build/assets/pylib-android/_sysconfigdata_d_linux_.py": "063295bed5c2c6f30d323abb2cf82fd9", "build/assets/pylib-android/_threading_local.py": "4a9688e3987d7d692db46feb9214945e", "build/assets/pylib-android/_weakrefset.py": "e4fa8532ace46dfbc35149c41ea497f7", "build/assets/pylib-android/abc.py": "a0daa1ed187eee8690c1e8438b97da90", @@ -4056,26 +4056,26 @@ "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "11c7eb77184381209b76dd985e35f440", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "3550e369b5ddd93e5c3f62c7ea64bfe0", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "a01f3937958d94b294bb222c715b02dd", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "2ae7379f191a95f6f617258a0888ae24", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "8ceaac4f9ae4f4adff32ddd528e6da6c", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "58a89eceb6aa2c78df3b9b6847ee2fc9", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "40ca388f1adabc1b2731502c2ee8dcef", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "0266a836a1ff0631866b89426d857380", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "38c04a3cc82a542a77abd1a2ba84fb09", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "032dac1e6928eccf15e34987809410ce", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "06f9dba113206423b65af606650e86df", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "56b269b4a8eb027b1a72a8e746cd4295", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "aed20c525d81bc5314ca9f74a9c1980d", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "fbaa1005e68f47aba22fc42805bf5386", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "54245cd739f3979ad96ddc3734439c58", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "95e79c56f06b1a399be18eab8ac3b509", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "df0d3c8191f51a93fd9d00aecb9afc5d", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "66c8e922af4ce1134c818e78f6622cf1", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "58db9e455e66fb99ac704dae92293cef", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "a0b044381126cbc09e604b28cbc1b719", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "76b444d4517b0208ede0788b92f50e7e", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "2a87b1e2981456da65163060698539e4", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "70994d86810990ca401a6e1afc12ab32", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "5838cb0e85ab02b3f0a528e9b9711dd1", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "434328cb50c34641330a534f48ede0bc", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "6ba80319cbfefe4e83ec6034a8fe211a", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "c11c8dc8cbb6e38c68c2eaaa18989e1c", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "777c271999b5dd107df613bb8743db86", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "54cba2d355425e56f9f323e975b5c86f", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "30d77d93e86b2d9058745b1bff5a190c", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "1d13d1f625eea48c7ec55a5e02ac674a", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "cc8847bb862daa492be919e78e34e9fd", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "b7fe03a39aae127d5fa6fff12e167ab9", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "bd30f2d8d7d520a580959b3d71115b98", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "6ea3f9ede6d276a635424c42d81724a8", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "47db2df8c5da2c60e748019cb545837a", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "37b5411af0661ec9721231a71f3ff12f", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "4181aea90c4e5a8ea7a037e3b638d80d", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "aab212155f82e1d1849a85e6c8b41168", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "f1f3f7b20f1750cc369ae59b24bfea67", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "e40234644df79316d71808a731ba14f0", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "8563857336ffcf40abfeac81fc3955eb", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "e40234644df79316d71808a731ba14f0", @@ -4092,14 +4092,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "9768548c6dfdff65fb25661540025ffe", "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "1a0cc7e78dc66dec6ee85a8a0d68aefd", "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "9768548c6dfdff65fb25661540025ffe", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "9695c3f405ae104bad725dacd3c4af0d", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "a7bab7a9e3ba04ddda4248cfe93f228d", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "0fe4f2f032833560d6f3c4f3d864751f", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "890e339df2411ab16f427d5a4c604a66", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "4babfca1f30077fd9ee85e86aa807f05", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "dcabf9b8deee7f7fbe2cb23f29641c43", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "2e705d8658c5d243be6211ea76392c74", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "219f144634bce88af3093803204d0366", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "3513bf3993376900610dee9da33c0f07", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "e8c86d2c3f0c2a8df57e180f21c776a4", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "384293e407d9f073aef46809900592e4", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "cd1fa29a1899837f0727fa95377c2a15", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "01cea2d44833efcb779b7768dd43dbf6", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "c95442a63f465448b0c7b3c726df8b77", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "7ccb4e3efb92d1b1cfde496996f79a28", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "0444563f9bac05b84f4f116a29df88ea", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "b611c090513a21e2fe90e56582724e9d", "src/ballistica/base/mgen/pyembed/binding_base.inc": "72bfed2cce8ff19741989dec28302f3f", diff --git a/CHANGELOG.md b/CHANGELOG.md index 48010603..e45b5825 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.34 (build 21817, api 8, 2024-04-24) +### 1.7.34 (build 21820, api 8, 2024-04-25) - Bumped Python version from 3.11 to 3.12 for all builds and project tools. One of the things this means is that we can use `typing.override` instead of the `typing_extensions` version so the annoying requirement of installing diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 6594c562..7af0ab61 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -52,7 +52,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21817 +TARGET_BALLISTICA_BUILD = 21820 TARGET_BALLISTICA_VERSION = '1.7.34' diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index cb239c40..f2318f38 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21817; +const int kEngineBuildNumber = 21820; const char* kEngineVersion = "1.7.34"; const int kEngineApiVersion = 8; diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index e2d6a4a4..57e83275 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -34,15 +34,6 @@ def format_cpp_str( Note that some cpp formatting keys off the filename, so a fake one can be optionally provided. """ - - # Note: previously was explicitly passing the config path from - # toolconfigsrc so we didn't require running from the project root - # dir, but this doesn't work on older clang-format versions. So now - # just parsing and passing the values itself which should do the - # same thing. Once most people have newer clang-format we can go - # back to just passing the path. - use_built_config = True - cfconfig = os.path.join(projroot, '.clang-format') if not os.path.isfile(cfconfig): @@ -52,23 +43,22 @@ def format_cpp_str( ) with tempfile.TemporaryDirectory() as tempdir: - filename = os.path.join(tempdir, filename) - with open(filename, 'w', encoding='utf-8') as outfile: + tfilename = os.path.join(tempdir, filename) + with open(tfilename, 'w', encoding='utf-8') as outfile: outfile.write(text) - if use_built_config: - import yaml - import json - # clang-format uses yaml but seems passing our raw yaml - # config contents doesn't work; converting to json seems to - # work though. - with open(cfconfig, encoding='utf-8') as infile: - cfconfigdata = json.dumps(yaml.safe_load(infile.read())) - style_arg = f'--style={cfconfigdata}' - else: - style_arg = f'--style=file:{cfconfig}' - subprocess.run(['clang-format', style_arg, '-i', filename], check=True) - with open(filename, encoding='utf-8') as infile: + # Note: clang-format allows '--style=file:' in version 14 + # or newer, but older versions are still common, so the easiest + # way to work everywhere is to just copy our config file into + # the temp dir. + with open(cfconfig, 'rb') as infileb: + with open(os.path.join(tempdir, '.clang-format'), 'wb') as outfileb: + outfileb.write(infileb.read()) + + subprocess.run( + ['clang-format', '--style=file', '-i', tfilename], check=True + ) + with open(tfilename, encoding='utf-8') as infile: return infile.read() @@ -105,8 +95,6 @@ def format_project_cpp_files(projroot: Path, full: bool) -> None: def format_file(filename: str) -> dict[str, Any]: start_time = time.monotonic() - # Note: seems os.system does not unlock the gil; - # make sure to use subprocess. result = subprocess.call(['clang-format', '-i', filename]) if result != 0: raise RuntimeError(f'Formatting failed for {filename}') diff --git a/tools/efrotools/genwrapper.py b/tools/efrotools/genwrapper.py index 52f4ed97..9d1d8bea 100644 --- a/tools/efrotools/genwrapper.py +++ b/tools/efrotools/genwrapper.py @@ -47,7 +47,7 @@ if __name__ == '__main__': f'# {legalnotice}\n' f'# This file is autogenerated; do not edit.\n' f'#\n' - f'"""Simple wrapper so {toolname} uses our internal virtual' + f'"""Simple wrapper so {toolname} uses the project virtual' f' environment."""\n' f'from {toolmodule} import run_{toolname}_main\n' f'\n' diff --git a/tools/efrotools/pybuild.py b/tools/efrotools/pybuild.py index 76b7f2cc..3455c14f 100644 --- a/tools/efrotools/pybuild.py +++ b/tools/efrotools/pybuild.py @@ -1290,22 +1290,6 @@ def gather(do_android: bool, do_apple: bool) -> None: ], libs=_apple_libs('tvos_simulator'), ), - BuildDef( - name='android_arm', - group=groups['android'], - config_headers={ - CompileArch.ANDROID_ARM: bases['android_arm'] - + f'/usr/include/{alibname}/pyconfig.h' - }, - sys_config_scripts=[ - bases['android_arm'] - + f'/usr/lib/python{PY_VER_ANDROID}/' - # f'_sysconfigdata_{debug_d}_linux_arm-linux-androideabi.py' - f'_sysconfigdata_{debug_d}_linux_.py' - ], - libs=_android_libs('android_arm'), - libinst='android_armeabi-v7a', - ), BuildDef( name='android_arm64', group=groups['android'], @@ -1323,20 +1307,20 @@ def gather(do_android: bool, do_apple: bool) -> None: libinst='android_arm64-v8a', ), BuildDef( - name='android_x86', + name='android_arm', group=groups['android'], config_headers={ - CompileArch.ANDROID_X86: bases['android_x86'] + CompileArch.ANDROID_ARM: bases['android_arm'] + f'/usr/include/{alibname}/pyconfig.h' }, sys_config_scripts=[ - bases['android_x86'] + f'/usr/lib/python{PY_VER_ANDROID}/' - f'_sysconfigdata_{debug_d}' - # f'_linux_i686-linux-android.py' - f'_linux_.py' + bases['android_arm'] + + f'/usr/lib/python{PY_VER_ANDROID}/' + # f'_sysconfigdata_{debug_d}_linux_arm-linux-androideabi.py' + f'_sysconfigdata_{debug_d}_linux_.py' ], - libs=_android_libs('android_x86'), - libinst='android_x86', + libs=_android_libs('android_arm'), + libinst='android_armeabi-v7a', ), BuildDef( name='android_x86_64', @@ -1355,6 +1339,22 @@ def gather(do_android: bool, do_apple: bool) -> None: libs=_android_libs('android_x86_64'), libinst='android_x86_64', ), + BuildDef( + name='android_x86', + group=groups['android'], + config_headers={ + CompileArch.ANDROID_X86: bases['android_x86'] + + f'/usr/include/{alibname}/pyconfig.h' + }, + sys_config_scripts=[ + bases['android_x86'] + f'/usr/lib/python{PY_VER_ANDROID}/' + f'_sysconfigdata_{debug_d}' + # f'_linux_i686-linux-android.py' + f'_linux_.py' + ], + libs=_android_libs('android_x86'), + libinst='android_x86', + ), ] # if do_apple: @@ -1560,9 +1560,20 @@ def gather(do_android: bool, do_apple: bool) -> None: scriptdst = os.path.join( pylib_dst, os.path.basename(script) ) + # Note to self: Python 3.12 seemed to change + # something where the sys_config_scripts for + # each of the architectures has the same name + # whereas it did not before. We could patch this + # by hand to split them out again, but for now + # just going to hope it gets fixed in 3.13 (when + # Android Python becomes an officially supported + # target; yay!). Hopefully nobody is using stuff + # from sysconfig anyway. But if they are, I + # rearranged the order so x86 is the actual one + # which will hopefully make errors obvious. if os.path.exists(scriptdst): print( - 'WARNING TEMPORARILY ALLOWING' + 'WARNING: TEMPORARILY ALLOWING' ' REPEAT SYS CONFIG SCRIPTS' ) # raise RuntimeError(