diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-04-02 20:04:10 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-04-08 21:06:15 +0300 |
commit | d72d98d3afdd0fadaf891c90a14f68c318f666fb (patch) | |
tree | 19c7bd2f744ee914d16e01758ce83403d876024d | |
parent | 93f756ec252fee895569750caa2a956b957596cf (diff) | |
download | meson-d72d98d3afdd0fadaf891c90a14f68c318f666fb.zip meson-d72d98d3afdd0fadaf891c90a14f68c318f666fb.tar.gz meson-d72d98d3afdd0fadaf891c90a14f68c318f666fb.tar.bz2 |
mintro: removed deprecated --target-files API
-rw-r--r-- | docs/markdown/snippets/introRemovedTargetFiles.md | 4 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 32 | ||||
-rwxr-xr-x | run_unittests.py | 35 |
3 files changed, 5 insertions, 66 deletions
diff --git a/docs/markdown/snippets/introRemovedTargetFiles.md b/docs/markdown/snippets/introRemovedTargetFiles.md new file mode 100644 index 0000000..bd86f45 --- /dev/null +++ b/docs/markdown/snippets/introRemovedTargetFiles.md @@ -0,0 +1,4 @@ +## Removed the deprecated `--target-files` API + +The `--target-files` introspection API is now no longer available. The same +information can be queried with the `--targets` API introduced in 0.50.0. diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 243dc5d..32931b6 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -101,8 +101,6 @@ def add_arguments(parser): flag = '--' + val.get('key', key) parser.add_argument(flag, action='store_true', dest=key, default=False, help=val['desc']) - parser.add_argument('--target-files', action='store', dest='target_files', default=None, - help='List source files for a given target.') parser.add_argument('--backend', choices=cdata.backendlist, dest='backend', default='ninja', help='The backend to use for the --buildoptions introspection.') parser.add_argument('-a', '--all', action='store_true', dest='all', default=False, @@ -204,27 +202,6 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend) def list_buildoptions_from_source(intr: IntrospectionInterpreter) -> List[dict]: return list_buildoptions(intr.coredata) -def list_target_files(target_name: str, targets: list, source_dir: str): - sys.stderr.write("WARNING: The --target-files introspection API is deprecated. Use --targets instead.\n") - result = [] - tgt = None - - for i in targets: - if i['id'] == target_name: - tgt = i - break - - if tgt is None: - print('Target with the ID "{}" could not be found'.format(target_name)) - sys.exit(1) - - for i in tgt['target_sources']: - result += i['sources'] + i['generated_sources'] - - result = list(map(lambda x: os.path.relpath(x, source_dir), result)) - - return result - def list_buildoptions(coredata: cdata.CoreData) -> List[dict]: optlist = [] @@ -413,11 +390,9 @@ def run(options): return 1 intro_vers = '0.0.0' - source_dir = None with open(infofile, 'r') as fp: raw = json.load(fp) intro_vers = raw.get('introspection', {}).get('version', {}).get('full', '0.0.0') - source_dir = raw.get('directories', {}).get('source', None) vers_to_check = get_meson_introspection_required_version() for i in vers_to_check: @@ -427,13 +402,6 @@ def run(options): .format(intro_vers, ' and '.join(vers_to_check))) return 1 - # Handle the one option that does not have its own JSON file (meybe deprecate / remove this?) - if options.target_files is not None: - targets_file = os.path.join(infodir, 'intro-targets.json') - with open(targets_file, 'r') as fp: - targets = json.load(fp) - results += [('target_files', list_target_files(options.target_files, targets, source_dir))] - # Extract introspection information from JSON for i in intro_types.keys(): if 'func' not in intro_types[i]: diff --git a/run_unittests.py b/run_unittests.py index 19426b8..6642511 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2653,38 +2653,6 @@ int main(int argc, char **argv) { self.init(testdir, ['--cross-file=' + name], inprocess=True) self.wipe() - def test_introspect_target_files(self): - ''' - Tests that mesonintrospect --target-files returns expected output. - ''' - testdir = os.path.join(self.common_test_dir, '8 install') - self.init(testdir) - expected = { - 'stat@sta': ['stat.c'], - 'prog@exe': ['prog.c'], - } - t_intro = self.introspect('--targets') - self.assertCountEqual([t['id'] for t in t_intro], expected) - for t in t_intro: - id = t['id'] - tf_intro = self.introspect(['--target-files', id]) - self.assertEqual(tf_intro, expected[id]) - self.wipe() - - testdir = os.path.join(self.common_test_dir, '53 custom target') - self.init(testdir) - expected = { - 'bindat@cus': ['data_source.txt'], - 'a685fbc@@depfile@cus': [], - } - t_intro = self.introspect('--targets') - self.assertCountEqual([t['id'] for t in t_intro], expected) - for t in t_intro: - id = t['id'] - tf_intro = self.introspect(['--target-files', id]) - self.assertEqual(tf_intro, expected[id]) - self.wipe() - def test_compiler_run_command(self): ''' The test checks that the compiler object can be passed to @@ -4683,8 +4651,7 @@ class LinuxlikeTests(BasePlatformTests): docbook_target = t break self.assertIsInstance(docbook_target, dict) - ifile = self.introspect(['--target-files', '8d60afc@@generated-gdbus-docbook@cus'])[0] - self.assertListEqual(t['filename'], [os.path.join(self.builddir, 'gdbus/generated-gdbus-doc-' + os.path.basename(ifile))]) + self.assertEqual(os.path.basename(t['filename'][0]), 'generated-gdbus-doc-' + os.path.basename(t['target_sources'][0]['sources'][0])) def test_build_rpath(self): if is_cygwin(): |