Filenames are now lists

This commit is contained in:
Daniel Mensinger 2018-11-29 14:53:28 +01:00
parent b91c5aad85
commit b034f52656
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
4 changed files with 13 additions and 9 deletions

View File

@ -10,4 +10,9 @@ compatibility.
Furthermore the option `-a,--all`, `-i,--indent` and `-f,--force-new`
were added to print all introspection information in one go, format the
JSON output (the default is still compact JSON) and foce use the new
output format, even if only one introspection command was given.
output format, even if only one introspection command was given.
Additionlly the format of target was changed:
- `filename` is now a list of output filenames
- `install_filename` is now also a list of installed files
- New: the `sources` key. It stores the source files of a target and there compiler parameters

View File

@ -2120,6 +2120,9 @@ class RunTarget(Target):
def get_filename(self):
return self.name
def get_outputs(self):
return [self.name]
def type_suffix(self):
return "@run"

View File

@ -93,11 +93,7 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend)
if not isinstance(target, build.Target):
raise RuntimeError('Something weird happened. File a bug.')
fname = target.get_filename()
if isinstance(fname, list):
fname = [os.path.join(target.subdir, x) for x in fname]
else:
fname = os.path.join(target.subdir, fname)
fname = [os.path.join(target.subdir, x) for x in target.get_outputs()]
t = {
'name': target.get_basename(),

View File

@ -1436,7 +1436,7 @@ class AllPlatformTests(BasePlatformTests):
# Get name of static library
targets = self.introspect('--targets')
self.assertEqual(len(targets), 1)
libname = targets[0]['filename']
libname = targets[0]['filename'][0]
# Build and get contents of static library
self.build()
before = self._run(['ar', 't', os.path.join(self.builddir, libname)]).split()
@ -3168,7 +3168,7 @@ recommended as it is not supported on some platforms''')
('name', str),
('id', str),
('type', str),
('filename', str),
('filename', list),
('build_by_default', bool),
('sources', list),
('installed', bool),
@ -4368,7 +4368,7 @@ class LinuxlikeTests(BasePlatformTests):
break
self.assertIsInstance(docbook_target, dict)
ifile = self.introspect(['--target-files', 'generated-gdbus-docbook@cus'])[0]
self.assertEqual(t['filename'], 'gdbus/generated-gdbus-doc-' + os.path.basename(ifile))
self.assertListEqual(t['filename'], ['gdbus/generated-gdbus-doc-' + os.path.basename(ifile)])
def test_build_rpath(self):
if is_cygwin():