summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-12-11 10:01:10 -0800
committerDylan Baker <dylan@pnwbakers.com>2024-03-29 13:06:54 -0700
commitfae1363bd3d4b6aec4b2de41f58385e277d91eca (patch)
treedb8da7aa366cc4ef83a30b81809d7a46c092b698 /mesonbuild/scripts
parent934c9074bdd81c31a67d87a290247007332cdbcf (diff)
downloadmeson-fae1363bd3d4b6aec4b2de41f58385e277d91eca.tar.gz
scripts/depscan: combine pickle and JSON data into a single file
We don't need to write and pass two separate files to the depscanner, I've used the pickle because the pickle serializer/deserializer should be faster than JSON, thought I haven't tested.
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/depscan.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/mesonbuild/scripts/depscan.py b/mesonbuild/scripts/depscan.py
index 3a61370a9..c0ac09b52 100644
--- a/mesonbuild/scripts/depscan.py
+++ b/mesonbuild/scripts/depscan.py
@@ -5,7 +5,6 @@
from __future__ import annotations
import collections
-import json
import os
import pathlib
import pickle
@@ -32,11 +31,11 @@ FORTRAN_SUBMOD_RE = re.compile(FORTRAN_SUBMOD_PAT, re.IGNORECASE)
FORTRAN_USE_RE = re.compile(FORTRAN_USE_PAT, re.IGNORECASE)
class DependencyScanner:
- def __init__(self, pickle_file: str, outfile: str, sources: T.List[str]):
+ def __init__(self, pickle_file: str, outfile: str):
with open(pickle_file, 'rb') as pf:
self.target_data: TargetDependencyScannerInfo = pickle.load(pf)
self.outfile = outfile
- self.sources = sources
+ self.sources = self.target_data.sources
self.provided_by: T.Dict[str, str] = {}
self.exports: T.Dict[str, str] = {}
self.needs: collections.defaultdict[str, T.List[str]] = collections.defaultdict(list)
@@ -183,9 +182,7 @@ class DependencyScanner:
return 0
def run(args: T.List[str]) -> int:
- assert len(args) == 3, 'got wrong number of arguments!'
- pickle_file, outfile, jsonfile = args
- with open(jsonfile, encoding='utf-8') as f:
- sources = json.load(f)
- scanner = DependencyScanner(pickle_file, outfile, sources)
+ assert len(args) == 2, 'got wrong number of arguments!'
+ outfile, pickle_file = args
+ scanner = DependencyScanner(pickle_file, outfile)
return scanner.scan()