Updating Python init to use new preconfig/config system in 3.8

This commit is contained in:
Eric Froemling 2021-09-16 13:39:13 -05:00
parent fdce8ed968
commit 934e66eb6c
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
12 changed files with 211 additions and 160 deletions

View File

@ -420,7 +420,7 @@
"assets/build/ba_data/audio/zoeOw.ogg": "https://files.ballistica.net/cache/ba1/14/f1/4f2995d78fc20dd79dfb39c5d554",
"assets/build/ba_data/audio/zoePickup01.ogg": "https://files.ballistica.net/cache/ba1/57/ac/6ed0caecd25dc23688debed24c45",
"assets/build/ba_data/audio/zoeScream01.ogg": "https://files.ballistica.net/cache/ba1/32/08/38dac4a79ab2acee76a75d32a310",
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/37/c5/fefc3b664420efec78431704855e",
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/99/a3/f019f03a07f8e2d93871447d09c2",
"assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/0f/0e/7184059414320d32104463e41038",
"assets/build/ba_data/data/languages/belarussian.json": "https://files.ballistica.net/cache/ba1/e2/58/c2c5964370df118c51528dc4bfa2",
"assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/d8/b8/a38187a1dfba81a42ddfbf2932be",
@ -433,10 +433,10 @@
"assets/build/ba_data/data/languages/esperanto.json": "https://files.ballistica.net/cache/ba1/6e/fd/685a4e1da031474d47a1d9eb2731",
"assets/build/ba_data/data/languages/french.json": "https://files.ballistica.net/cache/ba1/16/53/1535cc28a789efb7372de01bd7fb",
"assets/build/ba_data/data/languages/german.json": "https://files.ballistica.net/cache/ba1/2f/47/3f7ef1eb62055dd5e6f7b7ec648c",
"assets/build/ba_data/data/languages/gibberish.json": "https://files.ballistica.net/cache/ba1/13/7c/90fc15be9c187e22c3bebff4bb6f",
"assets/build/ba_data/data/languages/gibberish.json": "https://files.ballistica.net/cache/ba1/27/42/24f6e3191209db8422b923ceee2d",
"assets/build/ba_data/data/languages/greek.json": "https://files.ballistica.net/cache/ba1/ff/08/0d32d1babc60fdebd39def8b51da",
"assets/build/ba_data/data/languages/hindi.json": "https://files.ballistica.net/cache/ba1/63/f0/cc8dd75a100f7d58000a361ca160",
"assets/build/ba_data/data/languages/hungarian.json": "https://files.ballistica.net/cache/ba1/de/1b/d9a8e089566aa2951dc34c8c7173",
"assets/build/ba_data/data/languages/hungarian.json": "https://files.ballistica.net/cache/ba1/cf/2b/23acc62ab35c4763a9cfe23495dc",
"assets/build/ba_data/data/languages/indonesian.json": "https://files.ballistica.net/cache/ba1/87/e5/a10ddd73cfb7996bbd576032db6a",
"assets/build/ba_data/data/languages/italian.json": "https://files.ballistica.net/cache/ba1/34/0f/dd2e311024ceb913b8489b823fdc",
"assets/build/ba_data/data/languages/korean.json": "https://files.ballistica.net/cache/ba1/26/8d/bf9cc8db2cc71b69e789898e1093",
@ -445,7 +445,7 @@
"assets/build/ba_data/data/languages/portuguese.json": "https://files.ballistica.net/cache/ba1/6c/04/a528a4df9364ad4f0261cbc83f0a",
"assets/build/ba_data/data/languages/romanian.json": "https://files.ballistica.net/cache/ba1/82/12/57bf144e12be229a9b70da9c45cb",
"assets/build/ba_data/data/languages/russian.json": "https://files.ballistica.net/cache/ba1/bb/67/bdf5e720897c0eb966acdbab4274",
"assets/build/ba_data/data/languages/serbian.json": "https://files.ballistica.net/cache/ba1/91/1e/2846b8fab5260d1949562e7979be",
"assets/build/ba_data/data/languages/serbian.json": "https://files.ballistica.net/cache/ba1/0d/19/4ed63932f5476d97068171906135",
"assets/build/ba_data/data/languages/slovak.json": "https://files.ballistica.net/cache/ba1/97/ec/384ca27db2fdc711514273726935",
"assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/42/8a/31ee9bf7d90ad1c7a613ab91e4f3",
"assets/build/ba_data/data/languages/swedish.json": "https://files.ballistica.net/cache/ba1/50/9f/be006ba19be6a69a57837eb6dca0",
@ -3936,50 +3936,50 @@
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/72/82/86956fae909ac2fe2a1abd84a361",
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ef/d7/495767e5ff1cb54f8f0460333e78",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/80/2d/f3018b6ba46d9278456e5e72c6da",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/74/1d/fc9e33e565475daaac80da5252f0",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6b/c1/dfc5ceac182cf05b8768e7ff13db",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c0/d1/30001af821a0429937d8ffaa8e3c",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/bf/23/321b8fe6eece0708ea3a68f6018b",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b9/f7/d37785aeaa937eb9bfa56751bbb5",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c2/b0/20a9a462d1701f47ce6a8fc61709",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c4/a0/ed587e31756c462a5fd4638c5eea",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/7b/ac1a200be0f37078af0991faca3b",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/90/0e/d5de3cbc4268e730ee4950096a32",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1e/15/efb752a8d30ccfc39086e9fe14c0",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/33/f3/44f878e84d481a1080fa0c607717",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7f/b0/0e17879c0d6993a7141a1b51d7d6",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a3/8a/80596a9cbf5d8b656419dddd3d92",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/65/74/25e2b6f16b8c69c2bdb5c8b3270e",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5d/b4/f0cf21a3bf04befc86f77eabf4e3",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/48/fc/17631bee5d1928b50db91073db46",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/76/f2/e4c5fe6f4e84f7da72d86d4bf1b3",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/49/51/168461fca007d19f0ba3cae8cf45",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/30/13/847d10b164271ea17480555a6f60",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/0f/f8/bbb7a81eb89a8d8080300c739d44",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/de/ae/6e8a2eef2338e0ee5ab5a9c6a5a0",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/20/2a/09bc1afad5218914c2c392c01d0e",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d8/d4/1d4855188cca3e68d58396b1ffcd",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/b0/88755dcef661a87ca4cb78a7d071",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/51/87/7e2bf06277db8bb5c8514d8ed4c6",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/24/c6/1a927f22dcc2cc14b2751ce2fd2a",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2e/a9/d9282a2d031f5ab788798f7f28f5",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/04/a8c21c315cbbaed3666a2cf52fad",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3f/2e/6648547bf5291dc8c2d776f45c28",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/95/cc/54d0df06b07982427c45cee91e0c",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a3/a4/02ce13269b4c85643187e46f520c",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8c/97/ccec012d4634e0e8e63a04b7ad1c",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/73/46/f45a8c661bf08fcf9c5f47f8fd9a",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/23/19/20d3ce3220d91b9f6e8f7f2ece90",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7f/47/740a8693d4f92b74ffcd1786c1d7",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/45/2c/b0fc8bcdee390b9fa5c6ab964ec4",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d4/59/df59dbf3e9a6b643a3b71101bad5",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e0/b3/2ca91ed3aaf0e94d2619f8affa07",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/48/d4/3834b0060398af319ac450c3a608",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/5b/89/aa3d3dcec140c43aa26db9300f4b",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/94/4b/fe9ead9348303dc8a76986e5d9f8",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/f9/65/367102b313ff6e5eb1008a5da08e",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/4f/aa/b2d7d605fb03b4bf7e7544206615",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/37/fa/446af85bc9f2f0e220571b4ec5f9",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/03/98/926496f7267a2dafd53d1e9f2f2b",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/11/1e/4af5d4405d646108dacdfd8d687f",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/75/a9/164b2353457af90f482d896416a6",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/56/28/39af6142476ae8038d29e4429acf",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/cd/bd/5e04a66185f8ff83c0497ae1a303",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c3/2b/998d74da453f011b5493cbfcd8fe",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/50/51/2cce21971cbc6097e55be2c86fc6",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a6/0a/13a6e25b8568994f762bbce3fcd0",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ff/63/1617dfd7111b677405093003b155",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/af/dc/cd5951e9bdb49dbdbb1ef2e5ac1e",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/76/d2/7a0ce7df6b84cbc0cce6d2d99d82",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/34/74/8a9e2c2c66c6b59a7da226a8157d",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/41/0c/0d0e2377a6311cfea648afc32a70",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/f1/4c/2edd29fca8144dcaa6b9d91eb480",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/1c/29/6a1592c4224fc7f5287113e86a87",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/27/2b/462de7463d2a6a5cb401352c6946",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0e/ec/7864925a34d1ac2424c57cd86953",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/80/90/bcdcade80c14a94051b50eb4d5e0",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b0/63/c8c7122ded855fcb1bb9260eae98",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2e/eb/504d1a86aafa6630c4f1ce7edb63",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/dc/50/c8f5633877ca74490ec86dff2cd2",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/88/2b/23a0f1e592614342ef89bd4fc24a",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/db/6d/657a49d655a1eec135a94d560cd3",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ca/37/f957a2054f8370deb7bfe144db50",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6e/b9/3fb76b4a2b665b9c6fe3248f9585",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/21/97/32778aa1e872e65b9c9a20227386",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f8/e7/4a83daa2239ac5bf48bd4bdc98d1",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c0/43/aaea8b918b6d438de7236a3e1dfd",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/04/65/e8b88eca7a996d736b98242b4c90",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6f/a8/7384b203ae56c2504057748c7e86",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/11/56/f3aeecacfa0acfbbb4032f98e75c",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7b/1a/6dc287f1258a427068467e8d5238",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/26/97/9cc82b4426e737c4508a8c774a1c",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/ee/a1/cc9608fd17dfaf1e84673c0d60e3",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/3f/68/0b3cb367952f61918b2acbb66b37",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/93/74/c2031b257f962b8e099858cb8d19",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/12/ea/895877b2335975715730f71740a2",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/70/b6/e68e4f7303af5b1c115005ffa8c1",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/cc/22/f75baf7caf4cc0ecee48e1c5e23c",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/60/6f/b3d81d9ff6c06a971958f06e081c",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/fc/b5/62133319c6df8567aecfd29b1204",
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/8d/96/c1516dee7d458c9065597e0aede6"
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/c0/2f/a8b50faad086fba4fe936e863c20"
}

View File

@ -138,6 +138,7 @@
<w>asyncio</w>
<w>asynciomodule</w>
<w>asyncore</w>
<w>atest</w>
<w>atexit</w>
<w>attrdict</w>
<w>attrdocs</w>

View File

@ -1 +1 @@
206707705873020170747420069909535530879
55585447302835416619269845910437922744

View File

@ -5,6 +5,7 @@ from __future__ import annotations
from enum import Enum
import random
import asyncio
from typing import TYPE_CHECKING
import _ba
@ -275,6 +276,7 @@ class App:
self.pro_sale_start_val: Optional[int] = None
self.delegate: Optional[ba.AppDelegate] = None
self._asyncio_timer: Optional[ba.Timer] = None
def on_app_launch(self) -> None:
"""Runs after the app finishes bootstrapping.
@ -292,6 +294,8 @@ class App:
from bastd.actor import spazappearance
from ba._generated.enums import TimeType
self._setup_asyncio()
cfg = self.config
self.delegate = appdelegate.AppDelegate()
@ -586,3 +590,37 @@ class App:
print('HTTPS TEST SUCCESS', len(val))
except Exception as exc:
print('HTTPS TEST FAIL:', exc)
def _setup_asyncio(self) -> None:
# from ba._generated.enums import TimeType
if bool(True):
return
try:
asyncio.get_running_loop()
print('Found running asyncio loop; unexpected.')
except RuntimeError:
pass
loop = asyncio.new_event_loop()
print('MADE', loop)
asyncio.set_event_loop(loop)
print('NOW LOOP IS', loop)
print('policy is', asyncio.get_event_loop_policy())
print('RUNNING IS NOW', asyncio.get_running_loop())
# def run_cycle() -> None:
# loop.call_soon(loop.stop)
# loop.run_forever()
# self._asyncio_timer = _ba.Timer(1.0 / 5.0,
# run_cycle,
# timetype=TimeType.REAL,
# repeat=True)
async def _atest() -> None:
print('TASK STARTING')
await asyncio.sleep(2.0)
print('TASK ENDING')
asyncio.run(_atest())
#asyncio.create_task(_atest())

View File

@ -59,6 +59,7 @@
<w>argsjoined</w>
<w>asci</w>
<w>assigninput</w>
<w>atest</w>
<w>athome</w>
<w>attrobj</w>
<w>audiocache</w>

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2021-09-09 for Ballistica version 1.6.5 build 20391</em></h4>
<h4><em>last updated on 2021-09-16 for Ballistica version 1.6.5 build 20392</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>

View File

@ -21,7 +21,7 @@
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20391;
const int kAppBuildNumber = 20392;
const char* kAppVersion = "1.6.5";
// Our standalone globals.

View File

@ -156,7 +156,7 @@ auto IsBootstrapped() -> bool;
/// Internal bits.
auto CreateAppInternal() -> AppInternal*;
auto AppInternalPyInitialize() -> void;
auto AppInternalPyInitialize(void* pyconfig) -> void;
auto AppInternalPythonPostInit() -> void;
auto AppInternalHasBlessingHash() -> bool;
auto AppInternalPutLog(bool fatal) -> bool;

View File

@ -47,6 +47,18 @@
#include "ballistica/ui/ui.h"
#include "ballistica/ui/widget/text_widget.h"
// Sanity test: our XCode, Android, and Windows builds should be
// using a debug build of the python library.
// Todo: could also verify this at runtime by checking for
// existence of sys.gettotalrefcount(). (is that still valid in 3.8?)
#if BA_DEBUG_BUILD
#if BA_XCODE_BUILD || BA_OSTYPE_ANDROID || BA_OSTYPE_WINDOWS
#ifndef Py_DEBUG
#error Expected Py_DEBUG to be defined for this build.
#endif // Py_DEBUG
#endif // BA_XCODE_BUILD || BA_OSTYPE_ANDROID
#endif // BA_DEBUG_BUILD
namespace ballistica {
// Ignore signed bitwise stuff; python macros do it quite a bit.
@ -838,74 +850,6 @@ auto Python::GetPyVector3f(PyObject* o) -> Vector3f {
Python::Python() = default;
void Python::SetupInterpreterDebugState() {
// Go for python opt mode 1 if we're doing optimization
// (ignores __debug__ and asserts but keeps docstrings intact).
#if !BA_DEBUG_BUILD
Py_OptimizeFlag = 1;
#else
// const char* debug_msg;
// #ifdef Py_DEBUG
// debug_msg = "Python Debug Mode Enabled (also Py_DEBUG build).";
// #else
// debug_msg = "Python Debug Mode Enabled.";
// #endif
// ScreenMessage(debug_msg, {1.0, 1.0, 0.0});
// Log(debug_msg, true, false);
// Sanity test: our XCode, Android, and Windows builds should be
// using a debug build of the python library.
// Todo: could also verify this at runtime by checking for
// existence of sys.gettotalrefcount(). (is that still valid in 3.8?)
#if BA_XCODE_BUILD || BA_OSTYPE_ANDROID || BA_OSTYPE_WINDOWS
#ifndef Py_DEBUG
#error Expected Py_DEBUG to be defined for this build.
#endif // Py_DEBUG
#endif // BA_XCODE_BUILD || BA_OSTYPE_ANDROID
#endif // !BA_DEBUG_BUILD
}
void Python::SetupPythonHome() {
// For platforms where we package python ourself, we need to tell
// it where to find its stuff.
if (g_platform->ContainsPythonDist()) {
if (g_buildconfig.ostype_windows()) {
// Windows Python looks for Lib and DLLs dirs by default, along with some
// others, but we want to be more explicit in limiting to these. It also
// seems that windows Python's paths can be incorrect if we're in strange
// dirs such as \\wsl$\Ubuntu-18.04\ that we get with WSL build setups.
std::string cwd = g_platform->GetCWD();
// NOTE: Python for windows actually comes with 'Lib', not 'lib', but
// it seems the interpreter defaults point to ./lib (as of 3.8.5).
// Normally this doesn't matter since windows is case-insensitive but
// under WSL it does.
// So we currently bundle the dir as 'lib' and use that in our path so
// that everything is happy (both with us and with python.exe).
std::string libpath = cwd + BA_DIRSLASH + "lib";
std::string dllpath = cwd + BA_DIRSLASH + "DLLs";
std::string fullpath = libpath + ";" + dllpath;
// Py_DecodeLocale() allocs memory for a wide string which works out
// well since Python requires the pointers we pass to stick around.
Py_SetPath(Py_DecodeLocale(fullpath.c_str(), nullptr));
} else {
// Note: tried passing a relative path here
// (to keep tracebacks and other paths cleaner) but it seems
// to get converted to absolute under the hood.
std::string cwd = g_platform->GetCWD();
std::string libpath = cwd + BA_DIRSLASH + "pylib";
// Py_DecodeLocale() allocs memory for a wide string which works out
// well since Python requires the pointers we pass to stick around.
Py_SetPath(Py_DecodeLocale(libpath.c_str(), nullptr));
}
}
}
void Python::Reset(bool do_init) {
assert(InGameThread());
assert(g_python);
@ -920,20 +864,80 @@ void Python::Reset(bool do_init) {
}
if (!was_inited && do_init) {
// Wrangle whether we'll compile our stuff in debug vs opt mode, etc.
SetupInterpreterDebugState();
// Flip on some extra runtime debugging options in debug builds.
// https://docs.python.org/3.9/library/devmode.html#devmode
int dev_mode{g_buildconfig.debug_build()};
// Pre-config as isolated if we include our own Python and as standard
// otherwise.
PyPreConfig preconfig;
if (g_platform->ContainsPythonDist()) {
PyPreConfig_InitIsolatedConfig(&preconfig);
} else {
PyPreConfig_InitPythonConfig(&preconfig);
}
preconfig.dev_mode = dev_mode;
// We want consistent utf-8 everywhere (Python used to default to
// windows-specific file encodings, etc.)
// Note: we have to do this before SetupPythonHome() because it affects
// the Py_DecodeLocale() calls there.
Py_UTF8Mode = 1;
preconfig.utf8_mode = 1;
// Set up system paths on our embedded platforms.
SetupPythonHome();
PyStatus status = Py_PreInitialize(&preconfig);
BA_PRECONDITION(!PyStatus_Exception(status));
// Configure as isolated if we include our own Python and as standard
// otherwise.
PyConfig config;
if (g_platform->ContainsPythonDist()) {
PyConfig_InitIsolatedConfig(&config);
} else {
PyConfig_InitPythonConfig(&config);
}
config.dev_mode = dev_mode;
if (!g_buildconfig.debug_build()) {
config.optimization_level = 1;
}
// In cases where we bundle Python, set up all paths explicitly.
// see https://docs.python.org/3.8/
// c-api/init_config.html#path-configuration
if (g_platform->ContainsPythonDist()) {
PyConfig_SetBytesString(&config, &config.base_exec_prefix, "");
PyConfig_SetBytesString(&config, &config.base_executable, "");
PyConfig_SetBytesString(&config, &config.base_prefix, "");
PyConfig_SetBytesString(&config, &config.exec_prefix, "");
PyConfig_SetBytesString(&config, &config.executable, "");
PyConfig_SetBytesString(&config, &config.prefix, "");
// Interesting note: it seems we can pass relative paths here but
// they wind up in sys.path as absolute paths (unlike entries we add
// to sys.path after things are up and running).
if (g_buildconfig.ostype_windows()) {
// Windows Python looks for Lib and DLLs dirs by default, along with
// some others, but we want to be more explicit in limiting to these. It
// also seems that windows Python's paths can be incorrect if we're in
// strange dirs such as \\wsl$\Ubuntu-18.04\ that we get with WSL build
// setups.
// NOTE: Python for windows actually comes with 'Lib', not 'lib', but
// it seems the interpreter defaults point to ./lib (as of 3.8.5).
// Normally this doesn't matter since windows is case-insensitive but
// under WSL it does.
// So we currently bundle the dir as 'lib' and use that in our path so
// that everything is happy (both with us and with python.exe).
PyWideStringList_Append(&config.module_search_paths,
Py_DecodeLocale("lib", nullptr));
PyWideStringList_Append(&config.module_search_paths,
Py_DecodeLocale("DLLs", nullptr));
} else {
PyWideStringList_Append(&config.module_search_paths,
Py_DecodeLocale("pylib", nullptr));
}
config.module_search_paths_set = 1;
}
// Inits our _ba module and runs Py_Initialize().
AppInternalPyInitialize();
AppInternalPyInitialize(&config);
PyObject* m;
BA_PRECONDITION(m = PyImport_AddModule("__main__"));

View File

@ -69,8 +69,8 @@ sys.stdout = _BAConsoleRedirect(sys.stdout, _ba.print_stdout) # type: ignore
sys.stderr = _BAConsoleRedirect(sys.stderr, _ba.print_stderr) # type: ignore
# Let's lookup mods first (so users can do whatever they want).
# and then our bundled scripts last (don't want to encourage dists
# overriding proper python functionality)
# and then our bundled scripts last (don't want bundled site-package
# stuff overwriting system versions)
sys.path.insert(0, _ba.env()['python_directory_user'])
sys.path.append(_ba.env()['python_directory_app'])
sys.path.append(_ba.env()['python_directory_app_site'])
@ -93,6 +93,13 @@ if sys.flags.utf8_mode != 1:
print('ERROR: Python\'s UTF-8 mode is not set.'
' This will likely result in errors.')
debug_build = _ba.env()['debug_build']
# We expect dev_mode on in debug builds and off otherwise.
if debug_build != sys.flags.dev_mode:
print(f'WARNING: Mismatch in debug_build {debug_build}'
f' and sys.flags.dev_mode {sys.flags.dev_mode}')
# FIXME: I think we should init Python in the main thread, which should
# also avoid these issues. (and also might help us play better with
# Python debuggers?)
@ -116,7 +123,7 @@ if sys.flags.utf8_mode != 1:
# to take more drastic measures like switching from std::threads
# to pthreads.
if _ba.env()['debug_build']:
if debug_build:
def _thread_func() -> None:
# pylint: disable=unused-import

View File

@ -188,19 +188,15 @@ def test_protocol_creation() -> None:
# This should fail because _TMessage1 can return _TResponse1 which
# is not given an id here.
with pytest.raises(ValueError):
_protocol = MessageProtocol(
message_types={0: _TMessage1},
response_types={0: _TResponse2},
)
_protocol = MessageProtocol(message_types={0: _TMessage1},
response_types={0: _TResponse2})
# Now it should work.
_protocol = MessageProtocol(
message_types={0: _TMessage1},
response_types={0: _TResponse1},
)
_protocol = MessageProtocol(message_types={0: _TMessage1},
response_types={0: _TResponse1})
def test_sender_module_creation() -> None:
def test_sender_module_embedded() -> None:
"""Test generation of protocol-specific sender modules for typing/etc."""
smod = TEST_PROTOCOL.create_sender_module('Test', private=True)
@ -210,7 +206,7 @@ def test_sender_module_creation() -> None:
clipped = '\n'.join(lines[classline:])
# This snippet should match what we've got embedded above;
# If not then we need to update our test code.
# If not then we need to update our embedded version.
with open(__file__, encoding='utf-8') as infile:
ourcode = infile.read()
@ -222,7 +218,7 @@ def test_sender_module_creation() -> None:
' See test stdout for new code.')
def test_receiver_module_creation() -> None:
def test_receiver_module_embedded() -> None:
"""Test generation of protocol-specific sender modules for typing/etc."""
smod = TEST_PROTOCOL.create_receiver_module('Test', private=True)
@ -232,7 +228,7 @@ def test_receiver_module_creation() -> None:
clipped = '\n'.join(lines[classline:])
# This snippet should match what we've got embedded above;
# If not then we need to update our test code.
# If not then we need to update our embedded version.
with open(__file__, encoding='utf-8') as infile:
ourcode = infile.read()
@ -245,7 +241,7 @@ def test_receiver_module_creation() -> None:
def test_receiver_creation() -> None:
"""Test receiver creation."""
"""Test setting up receivers with handlers/etc."""
# This should fail due to the registered handler only specifying
# one response message type while the message type itself
@ -263,18 +259,21 @@ def test_receiver_creation() -> None:
del msg # Unused
return _TResponse2(fval=1.2)
# Should fail because not all message types in the protocol are handled.
# Validation should fail because not all message types in the
# protocol are handled.
with pytest.raises(TypeError):
class _TestClassR2:
"""Test class incorporating receive functionality."""
receiver = _TestMessageReceiver(TEST_PROTOCOL)
# Checks that we've added handlers for all message types, etc.
receiver.validate()
def test_message_sending() -> None:
"""Test simple message sending."""
def test_synchronous_messaging() -> None:
"""Test the full pipeline."""
# Define a class that can send messages and one that can receive them.
class TestClassS:
@ -319,28 +318,29 @@ def test_message_sending() -> None:
receiver.validate()
obj_r = TestClassR()
obj_s = TestClassS(target=obj_r)
obj = TestClassS(target=obj_r)
response = obj_s.msg.send(_TMessage1(ival=0))
response = obj.msg.send(_TMessage1(ival=0))
assert isinstance(response, _TResponse1)
response2 = obj_s.msg.send(_TMessage2(sval='rah'))
response2 = obj.msg.send(_TMessage2(sval='rah'))
assert isinstance(response2, (_TResponse1, _TResponse2))
response3 = obj_s.msg.send(_TMessage3(sval='rah'))
response3 = obj.msg.send(_TMessage3(sval='rah'))
assert response3 is None
# Make sure static typing lines up too.
if os.environ.get('EFRO_TEST_MESSAGE_FAST') != '1':
assert static_type_equals(response, _TResponse1)
assert static_type_equals(response3, None)
# Remote CleanErrors should come across locally as the same.
try:
_response3 = obj_s.msg.send(_TMessage1(ival=1))
_response4 = obj.msg.send(_TMessage1(ival=1))
except Exception as exc:
assert isinstance(exc, CleanError)
assert str(exc) == 'Testing Clean Error'
# Other remote errors should come across as RemoteError.
# Other remote errors should result in RemoteError.
with pytest.raises(RemoteError):
_response4 = obj_s.msg.send(_TMessage1(ival=2))
_response4 = obj.msg.send(_TMessage1(ival=2))

View File

@ -136,15 +136,15 @@ class MessageProtocol:
# Go ahead and auto-register a few common response types
# if the user has not done so explicitly. Use unique IDs which
# will never change or overlap with user ids.
def _reg(reg_tp: Type[Response], reg_id: int) -> None:
def _reg_if_not(reg_tp: Type[Response], reg_id: int) -> None:
if reg_tp in self.response_ids_by_type:
return
assert self.response_types_by_id.get(reg_id) is None
self.response_types_by_id[reg_id] = reg_tp
self.response_ids_by_type[reg_tp] = reg_id
_reg(ErrorResponse, -1)
_reg(EmptyResponse, -2)
_reg_if_not(ErrorResponse, -1)
_reg_if_not(EmptyResponse, -2)
# Some extra-thorough validation in debug mode.
if __debug__:
@ -293,7 +293,7 @@ class MessageProtocol:
f'{importlines1}\n'
f'\n'
f'if TYPE_CHECKING:\n'
f' from typing import Union, Any, Optional\n'
f' from typing import Union, Any, Optional, Callable\n'
f'{importlines2}'
f'\n'
f'\n')
@ -447,7 +447,7 @@ class MessageProtocol:
f' def __init__(\n'
f' self,\n'
f' obj: Any,\n'
f' receiver: _TestMessageReceiver,\n'
f' receiver: {ppre}{classname}MessageReceiver,\n'
f' ) -> None:\n'
f' assert obj is not None\n'
f' self._obj = obj\n'
@ -557,8 +557,8 @@ class MessageReceiver:
self._handlers: Dict[Type[Message], Callable] = {}
# noinspection PyProtectedMember
def register_handler(self, call: Callable[[Any, Message],
Response]) -> None:
def register_handler(
self, call: Callable[[Any, Message], Optional[Response]]) -> None:
"""Register a handler call.
The message type handled by the call is determined by its