diff options
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r-- | mesonbuild/scripts/depscan.py | 16 | ||||
-rw-r--r-- | mesonbuild/scripts/run_tool.py | 5 |
2 files changed, 14 insertions, 7 deletions
diff --git a/mesonbuild/scripts/depscan.py b/mesonbuild/scripts/depscan.py index 3b26f92..6f92715 100644 --- a/mesonbuild/scripts/depscan.py +++ b/mesonbuild/scripts/depscan.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations import json import os @@ -20,9 +21,12 @@ import re import sys import typing as T -from ..backend.ninjabackend import TargetDependencyScannerInfo, ninja_quote +from ..backend.ninjabackend import ninja_quote from ..compilers.compilers import lang_suffixes +if T.TYPE_CHECKING: + from ..backend.ninjabackend import TargetDependencyScannerInfo + CPP_IMPORT_RE = re.compile(r'\w*import ([a-zA-Z0-9]+);') CPP_EXPORT_RE = re.compile(r'\w*export module ([a-zA-Z0-9]+);') @@ -38,13 +42,13 @@ FORTRAN_USE_RE = re.compile(FORTRAN_USE_PAT, re.IGNORECASE) class DependencyScanner: def __init__(self, pickle_file: str, outfile: str, sources: T.List[str]): with open(pickle_file, 'rb') as pf: - self.target_data = pickle.load(pf) # type: TargetDependencyScannerInfo + self.target_data: TargetDependencyScannerInfo = pickle.load(pf) self.outfile = outfile self.sources = sources - self.provided_by = {} # type: T.Dict[str, str] - self.exports = {} # type: T.Dict[str, str] - self.needs = {} # type: T.Dict[str, T.List[str]] - self.sources_with_exports = [] # type: T.List[str] + self.provided_by: T.Dict[str, str] = {} + self.exports: T.Dict[str, str] = {} + self.needs: T.Dict[str, T.List[str]] = {} + self.sources_with_exports: T.List[str] = [] def scan_file(self, fname: str) -> None: suffix = os.path.splitext(fname)[1][1:].lower() diff --git a/mesonbuild/scripts/run_tool.py b/mesonbuild/scripts/run_tool.py index 700f459..f120df2 100644 --- a/mesonbuild/scripts/run_tool.py +++ b/mesonbuild/scripts/run_tool.py @@ -11,8 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations -import subprocess import itertools import fnmatch from pathlib import Path @@ -22,6 +22,9 @@ from ..compilers import lang_suffixes from ..mesonlib import Popen_safe import typing as T +if T.TYPE_CHECKING: + import subprocess + def parse_pattern_file(fname: Path) -> T.List[str]: patterns = [] try: |