Got master server communication working, cleaned up debug output spam, other minor bug fixes

This commit is contained in:
Eric Froemling 2020-04-04 16:10:45 -07:00
parent 8c8e057f70
commit 173a0ffa15
6 changed files with 25 additions and 19 deletions

View File

@ -117,9 +117,9 @@ class DependencyComponent:
# For now lets issue a warning if these are instantiated without # For now lets issue a warning if these are instantiated without
# a dep-entry; we'll make this an error once we're no longer # a dep-entry; we'll make this an error once we're no longer
# seeing warnings. # seeing warnings.
entry = getattr(self, '_dep_entry', None) # entry = getattr(self, '_dep_entry', None)
if entry is None: # if entry is None:
print(f'FIXME: INSTANTIATING DEP CLASS {type(self)} DIRECTLY.') # print(f'FIXME: INSTANTIATING DEP CLASS {type(self)} DIRECTLY.')
@classmethod @classmethod
def dep_is_present(cls, config: Any = None) -> bool: def dep_is_present(cls, config: Any = None) -> bool:
@ -142,11 +142,11 @@ class DependencyComponent:
class DependencyEntry: class DependencyEntry:
"""Data associated with a dependency/config pair in a ba.DependencySet.""" """Data associated with a dependency/config pair in a ba.DependencySet."""
def __del__(self) -> None: # def __del__(self) -> None:
print('~DepEntry()', self.cls) # print('~DepEntry()', self.cls)
def __init__(self, depset: DependencySet, dep: Dependency[T]): def __init__(self, depset: DependencySet, dep: Dependency[T]):
print("DepEntry()", dep.cls) # print("DepEntry()", dep.cls)
self.cls = dep.cls self.cls = dep.cls
self.config = dep.config self.config = dep.config
@ -190,7 +190,7 @@ class DependencySet(Generic[T]):
""" """
def __init__(self, root_dependency: Dependency[T]): def __init__(self, root_dependency: Dependency[T]):
print('DepSet()') # print('DepSet()')
self._root_dependency = root_dependency self._root_dependency = root_dependency
self._resolved = False self._resolved = False
self._loaded = False self._loaded = False
@ -198,8 +198,8 @@ class DependencySet(Generic[T]):
# Dependency data indexed by hash. # Dependency data indexed by hash.
self.entries: Dict[int, DependencyEntry] = {} self.entries: Dict[int, DependencyEntry] = {}
def __del__(self) -> None: # def __del__(self) -> None:
print("~DepSet()") # print("~DepSet()")
def resolve(self) -> None: def resolve(self) -> None:
"""Resolve the complete set of required dependencies for this set. """Resolve the complete set of required dependencies for this set.
@ -211,7 +211,7 @@ class DependencySet(Generic[T]):
if self._resolved: if self._resolved:
raise Exception("DependencySet has already been resolved.") raise Exception("DependencySet has already been resolved.")
print('RESOLVING DEP SET') # print('RESOLVING DEP SET')
# First, recursively expand out all dependencies. # First, recursively expand out all dependencies.
self._resolve(self._root_dependency, 0) self._resolve(self._root_dependency, 0)
@ -229,7 +229,7 @@ class DependencySet(Generic[T]):
raise DependencyError(missing) raise DependencyError(missing)
self._resolved = True self._resolved = True
print('RESOLVE SUCCESS!') # print('RESOLVE SUCCESS!')
@property @property
def resolved(self) -> bool: def resolved(self) -> bool:

View File

@ -154,6 +154,8 @@ def filter_playlist(playlist: PlaylistType,
and 'default' in setting): and 'default' in setting):
entry['settings'][setting_name] = setting['default'] entry['settings'][setting_name] = setting['default']
goodlist.append(entry) goodlist.append(entry)
except ImportError as exc:
print(f'Import failed while scanning playlist: {exc}')
except Exception: except Exception:
from ba import _error from ba import _error
_error.print_exception() _error.print_exception()

View File

@ -107,7 +107,7 @@ class Session:
from ba._error import DependencyError from ba._error import DependencyError
from ba._dependency import Dependency, AssetPackage from ba._dependency import Dependency, AssetPackage
print(' WOULD LOOK AT DEP SETS', depsets) # print(' WOULD LOOK AT DEP SETS', depsets)
# first off, resolve all dep-sets we were passed. # first off, resolve all dep-sets we were passed.
# if things are missing, we'll try to gather them into # if things are missing, we'll try to gather them into
@ -140,7 +140,8 @@ class Session:
required_asset_packages: Set[str] = set() required_asset_packages: Set[str] = set()
for depset in depsets: for depset in depsets:
required_asset_packages.update(depset.get_asset_package_ids()) required_asset_packages.update(depset.get_asset_package_ids())
print('Would set host-session asset-reqs to:', required_asset_packages) # print('Would set host-session asset-reqs to:',
# required_asset_packages)
if team_names is None: if team_names is None:
team_names = ['Good Guys'] team_names = ['Good Guys']

View File

@ -503,8 +503,8 @@ class PlaylistBrowserWindow(ba.OldWindow):
position=(h + scl * 75, v + scl * 10), position=(h + scl * 75, v + scl * 10),
texture=ba.gettexture('lock'), texture=ba.gettexture('lock'),
draw_controller=btn) draw_controller=btn)
assert v is not None if v is not None:
v -= scl * 130.0 v -= scl * 130.0
except Exception: except Exception:
ba.print_exception("error listing playlist maps") ba.print_exception("error listing playlist maps")

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND --> <!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-04-03 for Ballistica version 1.5.0 build 20001</em></h4> <h4><em>last updated on 2020-04-04 for Ballistica version 1.5.0 build 20001</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module, <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> 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> <hr>

View File

@ -754,17 +754,20 @@ def checkenv() -> None:
from efrotools import PYTHON_BIN from efrotools import PYTHON_BIN
print('Checking environment...', flush=True) print('Checking environment...', flush=True)
# Make sure they've got curl.
# Make sure they've got our target python version. # Make sure they've got our target python version.
if subprocess.run(['which', PYTHON_BIN], check=False, if subprocess.run(['which', 'curl'], check=False,
capture_output=True).returncode != 0: capture_output=True).returncode != 0:
raise CleanError(f'{PYTHON_BIN} is required.') raise CleanError(f'curl is required; please install it.')
# Make sure they've got pip for that python version. # Make sure they've got pip for that python version.
if subprocess.run(f"{PYTHON_BIN} -m pip --version", if subprocess.run(f"{PYTHON_BIN} -m pip --version",
shell=True, shell=True,
check=False, check=False,
capture_output=True).returncode != 0: capture_output=True).returncode != 0:
raise CleanError('pip (for {PYTHON_BIN}) is required.') raise CleanError(
'pip (for {PYTHON_BIN}) is required; please install it.')
# Check for some required python modules. # Check for some required python modules.
for modname, minver, packagename in REQUIRED_PYTHON_MODULES: for modname, minver, packagename in REQUIRED_PYTHON_MODULES: