pylint and spinoff cleanup

This commit is contained in:
Eric 2023-06-09 17:37:07 -07:00
parent c421ef808f
commit 4b9de1fa1f
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
16 changed files with 207 additions and 94 deletions

58
.efrocachemap generated
View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/20/e1/7384e355d2395f9e3fd23ee17514",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ca/3a/a8de145ffa8f429d983ee326d951",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e5/99/e3347eaf0fcde614325cc13d1c7c",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/32/90/c67e3b77324de789dce2786fb379",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/44/b7/f699c940d3a6fd8f2b51d9b9674c",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f7/bd/eaf1e62f9fdba779bf850b9f28cd",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e4/9b/a638d9e75b054f0696d6a941dcb3",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8c/d0/c241f77c0217b3ef1b9694edd375",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4b/8e/d9283666c42e8930b0cd534be4dc",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/93/c1/240c43c921ed22d974ca9dadb253",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/42/1b/e71f135f126f72804de5e5b127d5",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/90/f6/98b7cdb09b8ebc51f01469901486",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/18/d5/4f9d22c1f26b18e3656f9785073e",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/6e/44/e63d5c7dc2506c6483a559396af5",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/2a/2f/b360b5f06f4d59c67cac83139188",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c0/c9/7c5e84ee836a2d4a22663f8edae5",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/ce/39/5f920f47fd1d3ac74de4d3632e4d",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/b9/73/d01e9f2f8dafcaa2b1eee3cd4c62",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/62/e5/7cc3c367168c84d06ac35295618e",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/6c/7f/29963c7a8dc5847d76949169356e",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/92/d6/8b9b0174f330403a1492d86e8ce7",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/68/04/adfed8795d54d5e80225633280b3",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0b/a0/2e0afcf862d672656665a386f2a9",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e4/2b/2478e2df5600a96420b7ff13e646",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/14/8c/571c150fb462a3007fd71e570609",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/4d/40/0480d0b96ccfe4bbf9ac2f1f0bb6",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ee/e2/f1c326ba4d3402dee41099bf5786",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ca/af/93535e4b26ccea865395a588a0ac",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d6/1c/6dfa4e68c1d3d41d02167f05b92f",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/59/2b/8ed0eb28b6b5ed2bd2fa9df5698e",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/89/64/841804d96e60b8b5fda66476e4a1",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7a/e7/0f85bdc26546381f5b734bc850da",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/17/8d/13b52476ff128a15e74e0ed53c85",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/35/bf/1e6cb8ea522f4b072b2d5752d78c",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4b/7c/61c4864816d50174415aea268db3",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1f/cf/f14fed33a40fb5c80efe0e7a05da",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/82/0d/924b761a02733f2f79fc499f85fd",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/3a/0e/8fc014afa852f110b85f7f6d625d",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ed/de/8e9f14d57249abc78b081334a96d",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/a6/94/9a7a2c658e012d9b65feba036392",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/08/f1/36613a6c3ca87c93b4fbbe0de451",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/08/67/849330893eeb104e5a4dd44db54d",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d4/63/436f0f9b3c22d669bbd6262dee66",
@ -4108,14 +4108,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/0d/da/cf2b3140c0c83b3e368623f1d705",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/94/6c/3489c9df42324ad7f089d6271c4b",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a6/0b/3ae5a82111a12bb75cd62252c2cc",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/e6/17/d01132ba1b6e94801e4a23a94989",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/0f/d3/7613d44ef1a540f6263b2e89bfb5",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/f1/a1/8eb50a585d96ea1b557783105b7b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/21/3a/ac8bf36b227128b558f85188c0b5",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/a1/20/b99fd7c8aa08645a1f76848badfd",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/7c/29/8587b6ff47891b57a8b467f6e5fb",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/82/81/a0b997a9f9dfe5a263ea4652ec62",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/29/1f/cccee6be4be518d2b45a026fc9fd",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/ac/b4/4a8bbdc8ee5ee377e45323729430",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/1c/a3/45fb4106b605d8d17e9955bc0c21",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/1e/ef/01a2d143716cac7b4e370800d581",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/46/4f/dc199f0a03bdcb3674be02c1883e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/16/fe/e9b6f6e661f42faac36566f2a300",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/0d/13/ad898dc201f221a7feafdaa4c024",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/1b/25/a009c1b30f7096fb94f88f0f568d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/48/58/154d25de132d8653692e50913b99",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/fe/d2/3be7462aaff43bd651b5b5ac9d04",
@ -4126,5 +4126,5 @@
"src/ballistica/core/mgen/python_modules_monolithic.h": "https://files.ballistica.net/cache/ba1/e4/87/ca448e63b14d8c292e2c32c35d5d",
"src/ballistica/scene_v1/mgen/pyembed/binding_scene_v1.inc": "https://files.ballistica.net/cache/ba1/4d/d5/a6e9feabfdf60ac6d78ee7983427",
"src/ballistica/template_fs/mgen/pyembed/binding_template_fs.inc": "https://files.ballistica.net/cache/ba1/fe/97/a8e045105bf910b8921daf3fad83",
"src/ballistica/ui_v1/mgen/pyembed/binding_ui_v1.inc": "https://files.ballistica.net/cache/ba1/df/8d/fb958de2a7592fc5b4d2d3f7a81f"
"src/ballistica/ui_v1/mgen/pyembed/binding_ui_v1.inc": "https://files.ballistica.net/cache/ba1/34/6e/c3155ff20eee58803326d53f96f5"
}

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21087, api 8, 2023-06-09)
### 1.7.20 (build 21089, api 8, 2023-06-09)
- This seems like a good time for a `refactoring` release in anticipation of
changes coming in 1.8. Basically this means that a lot of things will be

View File

@ -51,7 +51,7 @@ PREREQS_POST_UPDATE_ONLY = $(PREREQ_IRONY_BUILD_DB)
# This installs tool config files, runs environment checks, etc.
prereqs: $(PREREQS_SAFE) $(PREREQS_POST_UPDATE_ONLY)
# Set of prereqs that is safe to run if the project state is dirty.
# Set of prereqs safe to run if the project state is dirty.
prereqs-pre-update: $(PREREQS_SAFE)
prereqs-clean:
@ -67,7 +67,7 @@ assets-cmake: prereqs meta
@tools/pcommand lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) cmake
# Build only script assets required for cmake builds (linux, mac).
# Build only script assets for cmake builds (linux, mac).
assets-cmake-scripts: prereqs meta
@tools/pcommand lazybuild assets_src $(LAZYBUILDDIR)/$@ \
cd src/assets \&\& $(MAKE) -j$(CPUS) scripts-cmake
@ -596,39 +596,45 @@ build/prefab/lib/windows/Release_%/BallisticaKitHeadlessPlus.pdb: .efrocachemap
# #
################################################################################
# Build and check a spinoff project including only the core feature-set.
SPINOFF_TEST_TARGET ?= core
# Run a given spinoff test.
spinoff-test:
tools/pcommand spinoff_test $(SPINOFF_TEST_TARGET) $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check core feature set alone.
spinoff-test-core:
tools/pcommand spinoff_test core $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project including only the base feature-set.
# Build and check base feature set alone.
spinoff-test-base:
tools/pcommand spinoff_test base $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project including only the plus feature-set.
# Build and check plus feature set alone.
spinoff-test-plus:
tools/pcommand spinoff_test plus $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project including only the classic feature-set.
# Build and check classic feature set alone.
spinoff-test-classic:
tools/pcommand spinoff_test classic $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project with only the template_fs feature-set.
# Build and check template_fs feature set alone.
spinoff-test-template_fs:
tools/pcommand spinoff_test template_fs $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project with only the ui_v1 feature-set.
# Build and check ui_v1 feature set alone.
spinoff-test-ui_v1:
tools/pcommand spinoff_test ui_v1 $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project with only the ui_v1_lib feature-set.
# Build and check ui_v1_lib feature set alone.
spinoff-test-ui_v1_lib:
tools/pcommand spinoff_test ui_v1_lib $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project with only the scene_v1 feature-set.
# Build and check scene_v1 feature set alone.
spinoff-test-scene_v1:
tools/pcommand spinoff_test scene_v1 $(SPINOFF_TEST_EXTRA_ARGS)
# Build and check a spinoff project with only the scene_v1_lib feature-set.
# Build and check scene_v1_lib feature set alone.
spinoff-test-scene_v1_lib:
tools/pcommand spinoff_test scene_v1_lib $(SPINOFF_TEST_EXTRA_ARGS)

View File

@ -1,6 +1,6 @@
# Released under the MIT License. See LICENSE for details.
#
# pylint: disable=missing-docstring, invalid-name
# pylint: disable=missing-module-docstring, invalid-name
from __future__ import annotations
# This file is exec'ed by the spinoff system, allowing us to define

View File

@ -12,6 +12,7 @@ from efro.util import set_canonical_module_names
import _babase
from _babase import (
env,
SimpleSound,
ContextRef,
ContextCall,
@ -169,6 +170,7 @@ __all__ = [
'AppSubsystem',
'screenmessage',
'native_stack_trace',
'env',
]
# We want stuff to show up as babase.Foo instead of babase._sub.Foo.

View File

@ -337,6 +337,7 @@ class App:
@cached_property
def classic(self) -> ClassicSubsystem | None:
"""Our classic subsystem (if available)."""
# pylint: disable=cyclic-import
try:
from baclassic import ClassicSubsystem
@ -351,6 +352,7 @@ class App:
@cached_property
def plus(self) -> PlusSubsystem | None:
"""Our plus subsystem (if available)."""
# pylint: disable=cyclic-import
try:
from baplus import PlusSubsystem
@ -365,6 +367,7 @@ class App:
@cached_property
def ui_v1(self) -> UIV1Subsystem:
"""Our ui_v1 subsystem (always available)."""
# pylint: disable=cyclic-import
from bauiv1 import UIV1Subsystem

View File

@ -28,12 +28,12 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21087
TARGET_BALLISTICA_BUILD = 21089
TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None
g_paths_set_failed = False # pylint: disable=invalid-name
g_user_system_scripts_dir: str | None = None # pylint: disable=invalid-name
g_user_system_scripts_dir: str | None = None
@dataclass

View File

@ -6,20 +6,17 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _babase
from babase._mgen.enums import UIScale
from babase._appsubsystem import AppSubsystem
import babase
import _bauiv1
import bauiv1
if TYPE_CHECKING:
from typing import Any, Callable, Sequence
from bauiv1._uitypes import UICleanupCheck, UIController, Window
import babase
from bauiv1._uitypes import UICleanupCheck, UIController
import bauiv1
class UIV1Subsystem(AppSubsystem):
class UIV1Subsystem(babase.AppSubsystem):
"""Consolidated UI functionality for the app.
Category: **App Classes**
@ -29,7 +26,7 @@ class UIV1Subsystem(AppSubsystem):
def __init__(self) -> None:
super().__init__()
env = _babase.env()
env = babase.env()
self.controller: UIController | None = None
@ -44,11 +41,11 @@ class UIV1Subsystem(AppSubsystem):
interfacetype = env['ui_scale']
if interfacetype == 'large':
self._uiscale = UIScale.LARGE
self._uiscale = babase.UIScale.LARGE
elif interfacetype == 'medium':
self._uiscale = UIScale.MEDIUM
self._uiscale = babase.UIScale.MEDIUM
elif interfacetype == 'small':
self._uiscale = UIScale.SMALL
self._uiscale = babase.UIScale.SMALL
else:
raise RuntimeError(f'Invalid UIScale value: {interfacetype}')
@ -91,10 +88,10 @@ class UIV1Subsystem(AppSubsystem):
# easily.
if bool(False): # force-test ui scale
self._uiscale = UIScale.SMALL
with _babase.ContextRef.empty():
_babase.pushcall(
lambda: _babase.screenmessage(
self._uiscale = babase.UIScale.SMALL
with babase.ContextRef.empty():
babase.pushcall(
lambda: babase.screenmessage(
f'FORCING UISCALE {self._uiscale.name} FOR TESTING',
color=(1, 0, 1),
log=True,
@ -105,7 +102,7 @@ class UIV1Subsystem(AppSubsystem):
# Kick off our periodic UI upkeep.
# FIXME: Can probably kill this if we do immediate UI death checks.
self.upkeeptimer = _babase.AppTimer(2.6543, ui_upkeep, repeat=True)
self.upkeeptimer = babase.AppTimer(2.6543, ui_upkeep, repeat=True)
def set_main_menu_window(self, window: bauiv1.Widget) -> None:
"""Set the current 'main' window, replacing any existing."""
@ -148,14 +145,14 @@ class UIV1Subsystem(AppSubsystem):
)
existing.delete()
bauiv1.apptimer(1.0, _delay_kill)
babase.apptimer(1.0, _delay_kill)
self._main_menu_window = window
def clear_main_menu_window(self, transition: str | None = None) -> None:
"""Clear any existing 'main' window with the provided transition."""
if self._main_menu_window:
if transition is not None:
bauiv1.containerwidget(
_bauiv1.containerwidget(
edit=self._main_menu_window, transition=transition
)
else:
@ -166,7 +163,7 @@ class UIV1Subsystem(AppSubsystem):
# If there's no main menu up, just call immediately.
if not self.has_main_menu_window():
with _babase.ContextRef.empty():
with babase.ContextRef.empty():
call()
else:
self.main_menu_resume_callbacks.append(call)

View File

@ -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 = 21087;
const int kEngineBuildNumber = 21089;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -2,7 +2,7 @@
# This code is used to grab a bunch of Python objects for use in C++.
# Python objects should be added here along with their associated c++ enum.
# Run make update to update the project after editing this.
# pylint: disable=missing-module-docstring, line-too-long
# pylint: disable=useless-suppression, missing-module-docstring, line-too-long
from __future__ import annotations
import bauiv1.onscreenkeyboard

View File

@ -20,6 +20,7 @@ def generate_app_module(
"""Generate babase._app.py based on its existing version."""
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches
import textwrap
from efrotools import replace_section
@ -95,6 +96,7 @@ def generate_app_module(
f'@cached_property\n'
f'def {fset.name}(self) -> {classname} | None:\n'
f' """Our {fset.name} subsystem (if available)."""\n'
f' # pylint: disable=cyclic-import\n'
f'\n'
f' try:\n'
f' from {modname} import {classname}\n'
@ -114,6 +116,7 @@ def generate_app_module(
f'def {fset.name}(self) -> {classname}:\n'
f' """Our {fset.name} subsystem'
' (always available)."""\n'
f' # pylint: disable=cyclic-import\n'
f'\n'
f' from {modname} import {classname}\n'
f'\n'

View File

@ -415,7 +415,10 @@ def gen_fulltest_buildfile_android() -> None:
else:
raise RuntimeError(f'Unknown extra: {extra}')
with open('_fulltest_buildfile_android', 'w', encoding='utf-8') as outfile:
os.makedirs('build', exist_ok=True)
with open(
'build/fulltest_buildfile_android', 'w', encoding='utf-8'
) as outfile:
outfile.write('\n'.join(lines))
@ -467,7 +470,10 @@ def gen_fulltest_buildfile_windows() -> None:
else:
raise RuntimeError(f'Unknown extra: {extra}')
with open('_fulltest_buildfile_windows', 'w', encoding='utf-8') as outfile:
os.makedirs('build', exist_ok=True)
with open(
'build/fulltest_buildfile_windows', 'w', encoding='utf-8'
) as outfile:
outfile.write('\n'.join(lines))
@ -544,7 +550,10 @@ def gen_fulltest_buildfile_apple() -> None:
else:
raise RuntimeError(f'Unknown extra: {extra}')
with open('_fulltest_buildfile_apple', 'w', encoding='utf-8') as outfile:
os.makedirs('build', exist_ok=True)
with open(
'build/fulltest_buildfile_apple', 'w', encoding='utf-8'
) as outfile:
outfile.write('\n'.join(lines))
@ -572,7 +581,33 @@ def gen_fulltest_buildfile_linux() -> None:
else:
raise RuntimeError(f'Unknown extra: {extra}')
with open('_fulltest_buildfile_linux', 'w', encoding='utf-8') as outfile:
os.makedirs('build', exist_ok=True)
with open(
'build/fulltest_buildfile_linux', 'w', encoding='utf-8'
) as outfile:
outfile.write('\n'.join(lines))
def gen_fulltest_buildfile_spinoff() -> None:
"""Generate fulltest command list for jenkins.
(so we see nice pretty split-up build trees)
"""
from batools.featureset import FeatureSet
# Run a spinoff test with each of our feature-sets individually.
# Note that there will likely be redundant tests with the same final
# resolved sets of feature sets. We can filter those out later if it
# seems worthwhile.
targets = sorted(f.name for f in FeatureSet.get_all_for_project('.'))
lines = []
for target in targets:
lines.append(f'SPINOFF_TEST_TARGET={target} make spinoff-test-cloud')
os.makedirs('build', exist_ok=True)
with open(
'build/fulltest_buildfile_spinoff', 'w', encoding='utf-8'
) as outfile:
outfile.write('\n'.join(lines))

View File

@ -280,6 +280,16 @@ def gen_fulltest_buildfile_linux() -> None:
batools.build.gen_fulltest_buildfile_linux()
def gen_fulltest_buildfile_spinoff() -> None:
"""Generate fulltest command list for jenkins.
(so we see nice pretty split-up build trees)
"""
import batools.build
batools.build.gen_fulltest_buildfile_spinoff()
def python_version_android_base() -> None:
"""Print built Python base version."""
from efrotools.pybuild import PY_VER_ANDROID
@ -956,26 +966,6 @@ def gen_python_enums_module() -> None:
)
def gen_python_init_module() -> None:
"""Generate a basic __init__.py."""
import os
from efro.terminal import Clr
from batools.project import project_centric_path
if len(sys.argv) != 3:
raise RuntimeError('Expected an outfile arg.')
outfilename = sys.argv[2]
os.makedirs(os.path.dirname(outfilename), exist_ok=True)
prettypath = project_centric_path(projroot=str(PROJROOT), path=outfilename)
print(f'Meta-building {Clr.BLD}{prettypath}{Clr.RST}')
with open(outfilename, 'w', encoding='utf-8') as outfile:
outfile.write(
'# Released under the MIT License.'
' See LICENSE for details.\n'
'#\n'
)
def gen_dummy_modules() -> None:
"""Generate all dummy modules."""
from efro.error import CleanError

View File

@ -329,3 +329,23 @@ def spinoff_check_submodule_parent() -> None:
'This project is not using a submodule for its parent.\n'
'To set one up, run `tools/spinoff add-submodule-parent`'
)
def gen_python_init_module() -> None:
"""Generate a basic __init__.py."""
import os
from efro.terminal import Clr
from batools.project import project_centric_path
if len(sys.argv) != 3:
raise RuntimeError('Expected an outfile arg.')
outfilename = sys.argv[2]
os.makedirs(os.path.dirname(outfilename), exist_ok=True)
prettypath = project_centric_path(projroot=str(PROJROOT), path=outfilename)
print(f'Meta-building {Clr.BLD}{prettypath}{Clr.RST}')
with open(outfilename, 'w', encoding='utf-8') as outfile:
outfile.write(
'# Released under the MIT License.'
' See LICENSE for details.\n'
'#\n'
)

View File

@ -4,6 +4,7 @@
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
@ -12,22 +13,34 @@ if TYPE_CHECKING:
def spinoff_test(args: list[str]) -> None:
"""High level test run command; accepts args and raises CleanErrors."""
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
import os
import subprocess
from batools.featureset import FeatureSet
from efrotools import extract_flag
from efrotools import extract_flag, getconfig
from efro.terminal import Clr
from efro.error import CleanError
submodule_parent = extract_flag(args, '--submodule-parent')
shared_test_parent = extract_flag(args, '--shared-test-parent')
if submodule_parent and shared_test_parent:
raise CleanError(
"spinoff-test: can't pass both submodule parent"
' and shared test parent.'
)
public = getconfig(Path('.'))['public']
if shared_test_parent and public:
raise CleanError('--shared-test-parent not available in public repo.')
# A spinoff symlink means we're a spun-off project.
if os.path.islink('tools/spinoff'):
raise CleanError(
'This must be run in a src project; this appears to be a dst.'
)
if len(args) != 1:
raise CleanError('Expected 1 arg.')
@ -62,11 +75,54 @@ def spinoff_test(args: list[str]) -> None:
)
else:
# Normally we spin the project off from where we currently
# are, but for cloud builds we may want to use a dedicated
# shared source instead. (since we need a git managed source
# we need to pull something fresh from git instead of just
# using the files that were synced up by cloudshell).
spinoff_src = '.'
spinoff_path = path
if shared_test_parent:
spinoff_src = 'build/spinoff_shared_test_parent'
# Need an abs target path since we change cwd in this case.
spinoff_path = os.path.abspath(path)
if bool(False):
print('TEMP BLOWING AWAY')
subprocess.run(['rm', '-rf', spinoff_src], check=True)
if os.path.exists(spinoff_src):
print(
'Pulling latest spinoff_shared_test_parent...',
flush=True,
)
subprocess.run(
['git', 'pull', '--ff-only'],
check=True,
cwd=spinoff_src,
)
else:
os.makedirs(spinoff_src, exist_ok=True)
cmd = [
'git',
'clone',
'git@github.com:efroemling/ballistica-internal.git',
spinoff_src,
]
print(
f'{Clr.BLU}Creating spinoff shared test parent'
f" at '{spinoff_src}' with command {cmd}...{Clr.RST}"
)
subprocess.run(
cmd,
check=True,
)
# raise CleanError('SO FAR SO GOOD5')
cmd = [
'./tools/spinoff',
'create',
'SpinoffTest',
path,
spinoff_path,
'--featuresets',
testtype,
] + (['--submodule-parent'] if submodule_parent else [])
@ -77,12 +133,12 @@ def spinoff_test(args: list[str]) -> None:
# Avoid the 'what to do next' help.
subprocess.run(
cmd + ['--noninteractive'],
cwd=spinoff_src,
check=True,
)
print(f'{Clr.MAG}tools/spinoff update{Clr.RST}', flush=True)
subprocess.run(['tools/spinoff', 'update'], cwd=path, check=True)
# subprocess.run(['make', 'cmake-server-binary'], cwd=path, check=True)
# Now let's simply run the mypy target. This will compile a
# binary, use that binary to generate dummy Python modules, and

View File

@ -67,6 +67,7 @@ from batools.pcommand import (
gen_fulltest_buildfile_windows,
gen_fulltest_buildfile_apple,
gen_fulltest_buildfile_linux,
gen_fulltest_buildfile_spinoff,
prune_includes,
python_version_android,
python_version_apple,
@ -109,11 +110,11 @@ from batools.pcommand import (
android_sdk_utils,
logcat,
gen_python_enums_module,
gen_python_init_module,
gen_dummy_modules,
version,
)
from batools.pcommand2 import (
gen_python_init_module,
gen_monolithic_register_modules,
stage_server_file,
py_examine,