aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-07-24 15:17:27 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-07-24 16:03:58 -0400
commit4d3432daa3e4291f88056d5a02d214c7d9f77191 (patch)
tree240b7b10246a00c8ce897b4f3d11213e8a2ae9f0 /mesonbuild/backend
parent22d842a97da45740a19f210d694ce23272a45cf9 (diff)
downloadmeson-4d3432daa3e4291f88056d5a02d214c7d9f77191.zip
meson-4d3432daa3e4291f88056d5a02d214c7d9f77191.tar.gz
meson-4d3432daa3e4291f88056d5a02d214c7d9f77191.tar.bz2
ninjabackend: track all outputs using a set
We need to verify that we don't produce multiple rules for the same file. This uniqueness check is easy to do with a set, but the original old implementation used a dict with True as the value. This isn't a terrible way to implement a set -- we do it for our own internal OrderedSet implementation, even, and back in prehistory (python 2.3) the standard library's set type was one. But it was deleted and replaced with a fast native implementation, and we should too.
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r--mesonbuild/backend/ninjabackend.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 22d5983..5cac121 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -299,7 +299,7 @@ class NinjaRule:
return estimate
class NinjaBuildElement:
- def __init__(self, all_outputs, outfilenames, rulename, infilenames, implicit_outs=None):
+ def __init__(self, all_outputs: T.Set[str], outfilenames, rulename, infilenames, implicit_outs=None):
self.implicit_outfilenames = implicit_outs or []
if isinstance(outfilenames, str):
self.outfilenames = [outfilenames]
@@ -426,7 +426,7 @@ class NinjaBuildElement:
for n in self.outfilenames:
if n in self.all_outputs:
self.output_errors = f'Multiple producers for Ninja target "{n}". Please rename your targets.'
- self.all_outputs[n] = True
+ self.all_outputs.add(n)
@dataclass
class RustDep:
@@ -485,7 +485,7 @@ class NinjaBackend(backends.Backend):
self.name = 'ninja'
self.ninja_filename = 'build.ninja'
self.fortran_deps = {}
- self.all_outputs = {}
+ self.all_outputs: T.Set[str] = set()
self.introspection_data = {}
self.created_llvm_ir_rule = PerMachine(False, False)
self.rust_crates: T.Dict[str, RustCrate] = {}