diff --git a/build/ab.py b/build/ab.py index 5ad3ca8f..92fe324d 100644 --- a/build/ab.py +++ b/build/ab.py @@ -32,7 +32,8 @@ class PathFinderImpl(PathFinder): def find_spec(self, fullname, path, target=None): - if not path: + # The second test here is needed for Python 3.9. + if not path or not path[0]: path = ["."] if len(path) != 1: return None @@ -114,7 +115,7 @@ def wrapper(*, name=None, replaces=None, **kwargs): t.callback = func t.traits.add(func.__name__) if "args" in kwargs: - t.args |= kwargs["args"] + t.args.update(kwargs["args"]) del kwargs["args"] if "traits" in kwargs: t.traits |= kwargs["traits"] @@ -354,8 +355,15 @@ def convert(value, target): return output +def _removesuffix(self, suffix): + # suffix='' should not call self[:-0]. + if suffix and self.endswith(suffix): + return self[:-len(suffix)] + else: + return self[:] + def loadbuildfile(filename): - filename = filename.replace("/", ".").removesuffix(".py") + filename = _removesuffix(filename.replace("/", "."), ".py") builtins.__import__(filename) diff --git a/build/c.py b/build/c.py index 0045e634..f84fea5d 100644 --- a/build/c.py +++ b/build/c.py @@ -81,6 +81,12 @@ def cxxfile( cfileimpl(self, name, srcs, deps, suffix, commands, label, cflags) +def _removeprefix(self, prefix): + if self.startswith(prefix): + return self[len(prefix):] + else: + return self[:] + def findsources(name, srcs, deps, cflags, filerule, cwd): for f in filenamesof(srcs): if f.endswith(".h") or f.endswith(".hh"): @@ -90,7 +96,7 @@ def findsources(name, srcs, deps, cflags, filerule, cwd): for s in flatten(srcs): objs += [ filerule( - name=join(name, f.removeprefix("$(OBJ)/")), + name=join(name, _removeprefix(f,"$(OBJ)/")), srcs=[f], deps=deps, cflags=sorted(set(cflags)), @@ -102,6 +108,8 @@ def findsources(name, srcs, deps, cflags, filerule, cwd): or f.endswith(".cpp") or f.endswith(".S") or f.endswith(".s") + or f.endswith(".m") + or f.endswith(".mm") ] if any(f.endswith(".o") for f in filenamesof([s])): objs += [s] diff --git a/src/arch/snes/build.py b/src/arch/snes/build.py index 9d6b5c37..956a49b7 100644 --- a/src/arch/snes/build.py +++ b/src/arch/snes/build.py @@ -29,7 +29,7 @@ items={ "0:ccp.sys@sr": "src+ccp", "0:bdos.sys@sr": "src/bdos", - "0:cls.com": "apps+cls", + "0:cls.com": "apps+cls" } | MINIMAL_APPS | MINIMAL_APPS_SRCS