diff options
author | Mats Wichmann <mats@linux.com> | 2023-01-20 17:45:25 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2023-06-08 13:19:04 (GMT) |
commit | 5a1e170535202eae20aea6423ac5aaa78fa54efd (patch) | |
tree | 7a8bfad82febd3492fd874e363fa53c86208e78e | |
parent | c8a9f7fa18cd33526007c32068e7fd0538f53179 (diff) | |
download | SCons-5a1e170535202eae20aea6423ac5aaa78fa54efd.zip SCons-5a1e170535202eae20aea6423ac5aaa78fa54efd.tar.gz SCons-5a1e170535202eae20aea6423ac5aaa78fa54efd.tar.bz2 |
Minor scanner tweaks
Marked a couple of scanner methods that don't use "self" as
@staticmethod for consistency.
Signed-off-by: Mats Wichmann <mats@linux.com>
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | SCons/Scanner/D.py | 3 | ||||
-rw-r--r-- | SCons/Scanner/JavaTests.py | 4 | ||||
-rw-r--r-- | SCons/Scanner/LaTeX.py | 3 | ||||
-rw-r--r-- | SCons/Scanner/__init__.py | 6 |
5 files changed, 11 insertions, 6 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 2584583..f9e6cb1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -64,6 +64,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER sufficient just to check the build worked. Renamed the fixture dir to follow naming convention in test/MSVC overall, and added a sconstest.skip file, also to follow convention. + - Marked some scanner methods as @staticmethod. RELEASE 4.5.2 - Sun, 21 Mar 2023 14:08:29 -0700 diff --git a/SCons/Scanner/D.py b/SCons/Scanner/D.py index f4366df..9bc608f 100644 --- a/SCons/Scanner/D.py +++ b/SCons/Scanner/D.py @@ -43,7 +43,8 @@ class D(Classic): regex=r'(?:import\s+)([\w\s=,.]+)(?:\s*:[\s\w,=]+)?(?:;)', ) - def find_include(self, include, source_dir, path): + @staticmethod + def find_include(include, source_dir, path): # translate dots (package separators) to slashes inc = include.replace('.', '/') diff --git a/SCons/Scanner/JavaTests.py b/SCons/Scanner/JavaTests.py index cf4ca83..38a4bdb 100644 --- a/SCons/Scanner/JavaTests.py +++ b/SCons/Scanner/JavaTests.py @@ -54,8 +54,8 @@ for fname in subfiles: test.write(fname.split('/'), "\n") class DummyEnvironment(collections.UserDict): - def __init__(self,**kw) -> None: - collections.UserDict.__init__(self) + def __init__(self, **kw) -> None: + super().__init__() self.data.update(kw) self.fs = SCons.Node.FS.FS(test.workpath('')) self['ENV'] = {} diff --git a/SCons/Scanner/LaTeX.py b/SCons/Scanner/LaTeX.py index 6abe736..4412aee 100644 --- a/SCons/Scanner/LaTeX.py +++ b/SCons/Scanner/LaTeX.py @@ -289,7 +289,8 @@ class LaTeX(ScannerBase): return [filename+e for e in self.graphics_extensions] return [filename] - def sort_key(self, include): + @staticmethod + def sort_key(include): return SCons.Node.FS._my_normcase(str(include)) def find_include(self, include, source_dir, path): diff --git a/SCons/Scanner/__init__.py b/SCons/Scanner/__init__.py index c8c2732..61ba8a9 100644 --- a/SCons/Scanner/__init__.py +++ b/SCons/Scanner/__init__.py @@ -415,7 +415,8 @@ class ClassicCPP(Classic): to the constructor must return the leading bracket in group 0, and the contained filename in group 1. """ - def find_include(self, include, source_dir, path): + @staticmethod + def find_include(include, source_dir, path): include = list(map(SCons.Util.to_str, include)) if include[0] == '"': paths = (source_dir,) + tuple(path) @@ -426,7 +427,8 @@ class ClassicCPP(Classic): i = SCons.Util.silent_intern(include[1]) return n, i - def sort_key(self, include): + @staticmethod + def sort_key(include): return SCons.Node.FS._my_normcase(' '.join(include)) # Local Variables: |