changed bs_meta to ba_meta

This commit is contained in:
Eric Froemling 2020-03-20 16:18:32 -07:00
parent 4ef4bc60cb
commit 823fc6b8a2
21 changed files with 57 additions and 60 deletions

View File

@ -34,6 +34,7 @@
<w>activitytypes</w>
<w>activityutils</w>
<w>actorclass</w>
<w>adbcfaca</w>
<w>adbpath</w>
<w>addgame</w>
<w>addr</w>
@ -791,6 +792,7 @@
<w>icns</w>
<w>iconpicker</w>
<w>iconscale</w>
<w>ident</w>
<w>idevices</w>
<w>ifeq</w>
<w>ifneq</w>

View File

@ -24,6 +24,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
from pathlib import Path
import threading
import urllib.request
import logging
import weakref
@ -56,6 +57,7 @@ class AssetManager:
def __init__(self, rootdir: Path) -> None:
print('AssetManager()')
assert isinstance(rootdir, Path)
self.thread_ident = threading.get_ident()
self._rootdir = rootdir
self._started = False
if not self._rootdir.is_dir():
@ -139,6 +141,7 @@ class AssetGather:
"""Wrangles a gather of assets."""
def __init__(self, manager: AssetManager) -> None:
assert threading.get_ident() == manager.thread_ident
self._manager = weakref.ref(manager)
self._valid = True
print('AssetGather()')
@ -168,7 +171,6 @@ def fetch_url(url: str, filename: Path, asset_gather: AssetGather) -> None:
# pylint: disable=too-many-locals
import socket
import threading
# We don't want to keep the provided AssetGather alive, but we want
# to abort if it dies.
@ -186,7 +188,7 @@ def fetch_url(url: str, filename: Path, asset_gather: AssetGather) -> None:
print('dir', type(req.fp), dir(req.fp))
print('WOULD DO IT', flush=True)
# req.close()
req.fp.close()
# req.fp.close()
threading.Thread(target=doit).run()
@ -228,3 +230,4 @@ def fetch_url(url: str, filename: Path, asset_gather: AssetGather) -> None:
status = f'{file_size_dl:20,} Bytes [{percent:.2%}] received'
sys.stdout.write('\r' + status)
sys.stdout.flush()
print('done with', req.fp)

View File

@ -175,7 +175,7 @@ class DirectoryScan:
flines = infile.readlines()
meta_lines = {
lnum: l[1:].split()
for lnum, l in enumerate(flines) if 'bs_meta' in l
for lnum, l in enumerate(flines) if 'ba_meta' in l
}
toplevel = len(subpath.parts) <= 1
required_api = self.get_api_requirement(subpath, meta_lines, toplevel)
@ -213,25 +213,25 @@ class DirectoryScan:
def _process_module_meta_tags(self, subpath: pathlib.Path,
flines: List[str],
meta_lines: Dict[int, List[str]]) -> None:
"""Pull data from a module based on its bs_meta tags."""
"""Pull data from a module based on its ba_meta tags."""
for lindex, mline in meta_lines.items():
# meta_lines is just anything containing 'bs_meta'; make sure
# the bs_meta is in the right place.
if mline[0] != 'bs_meta':
# meta_lines is just anything containing 'ba_meta'; make sure
# the ba_meta is in the right place.
if mline[0] != 'ba_meta':
self.results['warnings'] += (
'Warning: ' + str(subpath) +
': malformed bs_meta statement on line ' +
': malformed ba_meta statement on line ' +
str(lindex + 1) + '.\n')
elif (len(mline) == 4 and mline[1] == 'require'
and mline[2] == 'api'):
# Ignore 'require api X' lines in this pass.
pass
elif len(mline) != 3 or mline[1] != 'export':
# Currently we only support 'bs_meta export FOO';
# Currently we only support 'ba_meta export FOO';
# complain for anything else we see.
self.results['warnings'] += (
'Warning: ' + str(subpath) +
': unrecognized bs_meta statement on line ' +
': unrecognized ba_meta statement on line ' +
str(lindex + 1) + '.\n')
else:
# Looks like we've got a valid export line!
@ -273,7 +273,7 @@ class DirectoryScan:
if classname is None:
self.results['warnings'] += (
'Warning: ' + str(subpath) + ': class definition not found'
' below "bs_meta export" statement on line ' +
' below "ba_meta export" statement on line ' +
str(lindexorig + 1) + '.\n')
return classname
@ -285,7 +285,7 @@ class DirectoryScan:
Malformed api requirement strings will be logged as warnings.
"""
lines = [
l for l in meta_lines.values() if len(l) == 4 and l[0] == 'bs_meta'
l for l in meta_lines.values() if len(l) == 4 and l[0] == 'ba_meta'
and l[1] == 'require' and l[2] == 'api' and l[3].isdigit()
]
@ -297,14 +297,14 @@ class DirectoryScan:
if len(lines) > 1:
self.results['warnings'] += (
'Warning: ' + str(subpath) +
': multiple "# bs_meta api require <NUM>" lines found;'
': multiple "# ba_meta api require <NUM>" lines found;'
' ignoring module.\n')
elif not lines and toplevel and meta_lines:
# If we're a top-level module containing meta lines but
# no valid api require, complain.
self.results['warnings'] += (
'Warning: ' + str(subpath) +
': no valid "# bs_meta api require <NUM>" line found;'
': no valid "# ba_meta api require <NUM>" line found;'
' ignoring module.\n')
return None

View File

@ -20,4 +20,4 @@
# -----------------------------------------------------------------------------
"""BallisticaCore standard library: games, UI, etc."""
# bs_meta require api 6
# ba_meta require api 6

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Defines assault minigame."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -35,7 +35,7 @@ if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Sequence, Union
# bs_meta export game
# ba_meta export game
class AssaultGame(ba.TeamGameActivity):
"""Game where you score by touching the other team's flag."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Defines a capture-the-flag game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -68,7 +68,7 @@ class CTFFlag(stdflag.Flag):
return self._team
# bs_meta export game
# ba_meta export game
class CaptureTheFlagGame(ba.TeamGameActivity):
"""Game of stealing other team's flag and returning it to your base."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Provides the chosen-one mini-game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -36,7 +36,7 @@ if TYPE_CHECKING:
Union)
# bs_meta export game
# ba_meta export game
class ChosenOneGame(ba.TeamGameActivity):
"""
Game involving trying to remain the one 'chosen one'

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Provides the Conquest game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -56,7 +56,7 @@ class ConquestFlag(Flag):
return self._team
# bs_meta export game
# ba_meta export game
class ConquestGame(ba.TeamGameActivity):
"""A game where teams try to claim all flags on the map."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""DeathMatch game and support classes."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -34,7 +34,7 @@ if TYPE_CHECKING:
from typing import Any, Type, List, Dict, Tuple, Union, Sequence
# bs_meta export game
# ba_meta export game
class DeathMatchGame(ba.TeamGameActivity):
"""A game type based on acquiring kills."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Provides an easter egg hunt game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -38,7 +38,7 @@ if TYPE_CHECKING:
from typing import Any, Type, Dict, List, Tuple, Optional
# bs_meta export game
# ba_meta export game
class EasterEggHuntGame(ba.TeamGameActivity):
"""A game where score is based on collecting eggs"""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Elimination mini-game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -163,7 +163,7 @@ class Icon(ba.Actor):
ba.timer(0.6, self.update_for_lives)
# bs_meta export game
# ba_meta export game
class EliminationGame(ba.TeamGameActivity):
"""Game type where last player(s) left alive win."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Implements football games (both co-op and teams varieties)."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -65,7 +65,7 @@ class FootballFlag(stdflag.Flag):
self.node.connectattr('position', self.light, 'position')
# bs_meta export game
# ba_meta export game
class FootballTeamGame(ba.TeamGameActivity):
"""Football game for teams mode."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Hockey game and support classes."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -105,7 +105,7 @@ class Puck(ba.Actor):
super().handlemessage(msg)
# bs_meta export game
# ba_meta export game
class HockeyGame(ba.TeamGameActivity):
"""Ice hockey game."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Defines a keep-away game type."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -36,7 +36,7 @@ if TYPE_CHECKING:
Union)
# bs_meta export game
# ba_meta export game
class KeepAwayGame(ba.TeamGameActivity):
"""Game where you try to keep the flag away from your enemies."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Defines the King of the Hill game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -38,7 +38,7 @@ if TYPE_CHECKING:
Union)
# bs_meta export game
# ba_meta export game
class KingOfTheHillGame(ba.TeamGameActivity):
"""Game where a team wins by holding a 'hill' for a set amount of time."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Defines a bomb-dodging mini-game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -37,7 +37,7 @@ if TYPE_CHECKING:
from bastd.actor.onscreentimer import OnScreenTimer
# bs_meta export game
# ba_meta export game
class MeteorShowerGame(ba.TeamGameActivity):
"""Minigame involving dodging falling bombs."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Provides Ninja Fight mini-game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -37,7 +37,7 @@ if TYPE_CHECKING:
from typing import Any, Type, Dict, List, Optional
# bs_meta export game
# ba_meta export game
class NinjaFightGame(ba.TeamGameActivity):
"""
A co-op game where you try to defeat a group

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Defines Race mini-game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -58,7 +58,7 @@ class RaceRegion(ba.Actor):
})
# bs_meta export game
# ba_meta export game
class RaceGame(ba.TeamGameActivity):
"""Game of racing around a track."""

View File

@ -20,7 +20,7 @@
# -----------------------------------------------------------------------------
"""Implements Target Practice game."""
# bs_meta require api 6
# ba_meta require api 6
# (see bombsquadgame.com/apichanges)
from __future__ import annotations
@ -37,7 +37,7 @@ if TYPE_CHECKING:
from bastd.actor.bomb import Bomb, Blast
# bs_meta export game
# ba_meta export game
class TargetPracticeGame(ba.TeamGameActivity):
"""Game where players try to hit targets with bombs."""

View File

@ -1,6 +1,6 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<!--DOCSHASH=266725d2f42aff8a96924a30416d8926-->
<h4><em>last updated on 2020-03-12 for Ballistica version 1.5.0 build 20001</em></h4>
<!--DOCSHASH=c798f5512eafca1a6a4e19f5fe5ae860-->
<h4><em>last updated on 2020-03-20 for Ballistica version 1.5.0 build 20001</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

@ -223,19 +223,11 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None:
os.environ['PATH'] += (':' + appathout)
print(f'ADDED "{appathout}" TO SYS PATH...')
# Commit from Dec 6th, 2018. Looks like right after this one the repo
# switched to ndk r19 beta 2 and now seems to require r19, so we can
# try switching back to master one r19 comes down the pipe.
# noinspection PyUnreachableCode
if False: # pylint: disable=using-constant-test
efrotools.run('git checkout eb587c52db349fecfc4666c6bf7e077352513035')
# Commit from ~March 14 2019. Looks like right after this the project
# switched to compiling python as a shared library which would be a pretty
# big change.
# noinspection PyUnreachableCode
if False: # pylint: disable=using-constant-test
efrotools.run('git checkout b3024bf350fd5134542ee974a9a28921a687a8a0')
# Commit from Jan 8, 2020. Right after this, the build system was switched
# a a completely new minimal one which will take some work to update here.
# Punting on that for now...
if True: # pylint: disable=using-constant-test
efrotools.run('git checkout 9adbcfaca37f40b7a86381f83f0f6af4187233ae')
ftxt = efrotools.readfile('pybuild/env.py')
# Set the packages we build.