diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2023-01-03 15:14:35 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-01-20 00:18:42 -0500 |
commit | 3f733437daee4f391fdae9b51540c699e3ff6795 (patch) | |
tree | e3ade8b38c18f5c19e028184e2ef70ce23624c5e | |
parent | dd83d5e4a184d7bebc00637b0c0ba15d1b34d3e3 (diff) | |
download | meson-3f733437daee4f391fdae9b51540c699e3ff6795.zip meson-3f733437daee4f391fdae9b51540c699e3ff6795.tar.gz meson-3f733437daee4f391fdae9b51540c699e3ff6795.tar.bz2 |
coredata: use a frozenset instead of a dict where values are always None
-rw-r--r-- | mesonbuild/coredata.py | 43 | ||||
-rw-r--r-- | unittests/allplatformstests.py | 6 |
2 files changed, 25 insertions, 24 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index fd8b4b2..b4c7924 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -1251,24 +1251,25 @@ BULITIN_DIR_NOPREFIX_OPTIONS: T.Dict[OptionKey, T.Dict[str, str]] = { OptionKey('purelibdir', module='python'): {}, } -FORBIDDEN_TARGET_NAMES = {'clean': None, - 'clean-ctlist': None, - 'clean-gcno': None, - 'clean-gcda': None, - 'coverage': None, - 'coverage-text': None, - 'coverage-xml': None, - 'coverage-html': None, - 'phony': None, - 'PHONY': None, - 'all': None, - 'test': None, - 'benchmark': None, - 'install': None, - 'uninstall': None, - 'build.ninja': None, - 'scan-build': None, - 'reconfigure': None, - 'dist': None, - 'distcheck': None, - } +FORBIDDEN_TARGET_NAMES = frozenset({ + 'clean', + 'clean-ctlist', + 'clean-gcno', + 'clean-gcda', + 'coverage', + 'coverage-text', + 'coverage-xml', + 'coverage-html', + 'phony', + 'PHONY', + 'all', + 'test', + 'benchmark', + 'install', + 'uninstall', + 'build.ninja', + 'scan-build', + 'reconfigure', + 'dist', + 'distcheck', +}) diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index a98cd94..ac60907 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -1507,12 +1507,12 @@ class AllPlatformTests(BasePlatformTests): test. Needs to be a unit test because it accesses Meson internals. ''' testdir = os.path.join(self.common_test_dir, '150 reserved targets') - targets = mesonbuild.coredata.FORBIDDEN_TARGET_NAMES + targets = set(mesonbuild.coredata.FORBIDDEN_TARGET_NAMES) # We don't actually define a target with this name - targets.pop('build.ninja') + targets.remove('build.ninja') # Remove this to avoid multiple entries with the same name # but different case. - targets.pop('PHONY') + targets.remove('PHONY') for i in targets: self.assertPathExists(os.path.join(testdir, i)) |