From 8fd97b1ee9ce345b120619eedc40614a6ab46465 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Wed, 3 Jun 2020 16:55:52 -0700 Subject: [PATCH] Tidying --- .idea/dictionaries/ericf.xml | 6 ++++++ tests/test_efro/test_dataclasses.py | 1 + tests/test_efro/test_entity.py | 3 +++ tools/efro/entity/_entity.py | 1 + tools/efro/util.py | 3 ++- tools/efrotools/pybuild.py | 13 ++++++++----- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index ecf35539..635c0d21 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -41,6 +41,7 @@ adbcfaca adbpath addgame + addlevel addr addrstr adisp @@ -344,6 +345,7 @@ compounddict compoundlist conditionalize + configdict configerror confighash configkey @@ -619,6 +621,7 @@ fdict fecfc feedparser + ffaeff ffap fhash fhashes @@ -761,6 +764,7 @@ genutils getaccountid getactivity + getcampaign getclass getcollide getcollidemodel @@ -772,7 +776,9 @@ getdata getinputdevice getkillerplayer + getlevel getlevelname + getlevels getlog getmaps getmodel diff --git a/tests/test_efro/test_dataclasses.py b/tests/test_efro/test_dataclasses.py index f00c4aa9..470bf01b 100644 --- a/tests/test_efro/test_dataclasses.py +++ b/tests/test_efro/test_dataclasses.py @@ -159,6 +159,7 @@ def test_assign() -> None: dataclass_assign(tclass, {'lfval': [1]}) +# noinspection PyTypeHints def test_validate() -> None: """Testing validation.""" diff --git a/tests/test_efro/test_entity.py b/tests/test_efro/test_entity.py index 97354d92..063ab689 100644 --- a/tests/test_efro/test_entity.py +++ b/tests/test_efro/test_entity.py @@ -80,6 +80,7 @@ class EntityTest(entity.Entity): fval2 = entity.Field('f2', entity.Float3Value()) +# noinspection PyTypeHints def test_entity_values() -> None: """Test various entity assigns for value and type correctness.""" ent = EntityTest() @@ -133,6 +134,7 @@ def test_entity_values() -> None: assert dict(ent.str_int_dict.items()) == {'foo': 123} +# noinspection PyTypeHints def test_entity_values_2() -> None: """Test various entity assigns for value and type correctness.""" @@ -189,6 +191,7 @@ def test_entity_values_2() -> None: assert static_type_equals(ent.grp.compoundlist[0].subval, bool) +# noinspection PyTypeHints def test_field_copies() -> None: """Test copying various values between fields.""" ent1 = EntityTest() diff --git a/tools/efro/entity/_entity.py b/tools/efro/entity/_entity.py index 9f66ab10..144fec0f 100644 --- a/tools/efro/entity/_entity.py +++ b/tools/efro/entity/_entity.py @@ -121,6 +121,7 @@ class EntityMixin: self.d_data = target.d_data # Make sure target blows up if someone tries to use it. + # noinspection PyTypeHints target.d_data = None # type: ignore def pruned_data(self) -> Dict[str, Any]: diff --git a/tools/efro/util.py b/tools/efro/util.py index c7a2b69a..5ce9a3c3 100644 --- a/tools/efro/util.py +++ b/tools/efro/util.py @@ -53,6 +53,7 @@ def utc_now() -> datetime.datetime: return datetime.datetime.now(datetime.timezone.utc) +# noinspection PyUnresolvedReferences def empty_weakref(objtype: Type[T]) -> ReferenceType[T]: """Return an invalidated weak-reference for the specified type.""" # At runtime, all weakrefs are the same; our type arg is just @@ -99,7 +100,7 @@ class DispatchMethodWrapper(Generic[TARG, TRET]): registry: Dict[Any, Callable] -# noinspection PyProtectedMember +# noinspection PyProtectedMember,PyTypeHints def dispatchmethod( func: Callable[[Any, TARG], TRET]) -> DispatchMethodWrapper[TARG, TRET]: diff --git a/tools/efrotools/pybuild.py b/tools/efrotools/pybuild.py index 0bd301c6..f8bd65f8 100644 --- a/tools/efrotools/pybuild.py +++ b/tools/efrotools/pybuild.py @@ -47,8 +47,11 @@ def build_apple(arch: str, debug: bool = False) -> None: os.chdir(builddir) # TEMP: Check out a particular commit while the branch head is broken. - # efrotools.run('git checkout 1a9c71dca298c03517e8236b81cf1d9c8c521cbf') - efrotools.run(f'git checkout {PYTHON_VERSION_MAJOR}') + # We can actually fix this to use the current one, but something + # broke in the underlying build even on old commits so keeping it + # locked for now... + efrotools.run('git checkout bf1ed73d0d5ff46862ba69dd5eb2ffaeff6f19b6') + # efrotools.run(f'git checkout {PYTHON_VERSION_MAJOR}') # On mac we currently have to add the _scproxy module or urllib will # fail. @@ -152,7 +155,7 @@ def build_apple(arch: str, debug: bool = False) -> None: # Turn doc strings on; looks like it only adds a few hundred k. txt = txt.replace('--without-doc-strings', '--with-doc-strings') - # We're currently aiming at 10.13+ on mac + # Set mac/ios version reqs # (see issue with utimensat and futimens). txt = efrotools.replace_one(txt, 'MACOSX_DEPLOYMENT_TARGET=10.8', 'MACOSX_DEPLOYMENT_TARGET=10.13') @@ -178,7 +181,7 @@ def build_apple(arch: str, debug: bool = False) -> None: dline = 'python$(PYTHON_VER)m' splitlen = len(txt.split(dline)) if splitlen != 14: - raise Exception('unexpected configure lines') + raise RuntimeError(f'Unexpected configure line count {splitlen}.') txt = txt.replace(dline, 'python$(PYTHON_VER)dm') efrotools.writefile('Makefile', txt) @@ -282,7 +285,7 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: efrotools.writefile('pybuild/packages/python.py', ftxt) # Set this to a particular cpython commit to target exact releases from git - commit = '43364a7ae01fbe4288ef42622259a0038ce1edcc' # 3.7.6 release + commit = 'd7c567b08f9d7d6aef21b881340a2b72731129db' # 3.7.7 release if commit is not None: ftxt = efrotools.readfile('pybuild/source.py')