aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-11-16 22:03:26 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2016-11-18 17:37:35 -0500
commita01919976eb08277bad78bb22937601cf5a862e0 (patch)
treee366cba35d5e16664c5e3557fd44eb5f17149b07 /mesonbuild/interpreter.py
parent996f4d89f3d60731306a6a72b339eb5c2dbb5020 (diff)
downloadmeson-a01919976eb08277bad78bb22937601cf5a862e0.zip
meson-a01919976eb08277bad78bb22937601cf5a862e0.tar.gz
meson-a01919976eb08277bad78bb22937601cf5a862e0.tar.bz2
Always specify installed data with a File object. Closes #858.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 6becdb6..ac04b1a 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -483,15 +483,11 @@ class Headers(InterpreterObject):
return self.custom_install_dir
class DataHolder(InterpreterObject):
- def __init__(self, in_sourcetree, source_subdir, sources, kwargs):
+ def __init__(self, sources, install_dir):
super().__init__()
- kwsource = mesonlib.stringlistify(kwargs.get('sources', []))
- sources += kwsource
- check_stringlist(sources)
- install_dir = kwargs.get('install_dir', None)
if not isinstance(install_dir, str):
raise InterpreterException('Custom_install_dir must be a string.')
- self.held_object = build.Data(in_sourcetree, source_subdir, sources, install_dir)
+ self.held_object = build.Data(sources, install_dir)
def get_source_subdir(self):
return self.held_object.source_subdir
@@ -2208,9 +2204,19 @@ requirements use the version keyword argument instead.''')
self.evaluate_codeblock(codeblock)
self.subdir = prev_subdir
- @stringArgs
def func_install_data(self, node, args, kwargs):
- data = DataHolder(True, self.subdir, args, kwargs)
+ kwsource = mesonlib.stringlistify(kwargs.get('sources', []))
+ raw_sources = args + kwsource
+ sources = []
+ source_strings = []
+ for s in raw_sources:
+ if isinstance(s, mesonlib.File):
+ sources.append(s)
+ else:
+ source_strings.append(s)
+ sources += self.source_strings_to_files(source_strings)
+ install_dir = kwargs.get('install_dir', None)
+ data = DataHolder(sources, install_dir)
self.build.data.append(data.held_object)
return data
@@ -2240,11 +2246,12 @@ requirements use the version keyword argument instead.''')
raise InterpreterException('Output must be a string.')
if os.path.split(output)[0] != '':
raise InterpreterException('Output file name must not contain a subdirectory.')
+ (ofile_path, ofile_fname) = os.path.split(os.path.join(self.subdir, output))
+ ofile_abs = os.path.join(self.environment.build_dir, ofile_path, ofile_fname)
if 'configuration' in kwargs:
conf = kwargs['configuration']
if not isinstance(conf, ConfigurationDataHolder):
raise InterpreterException('Argument "configuration" is not of type configuration_data')
- ofile_abs = os.path.join(self.environment.build_dir, self.subdir, output)
if inputfile is not None:
# Normalize the path of the conffile to avoid duplicates
# This is especially important to convert '/' to '\' on Windows
@@ -2266,8 +2273,10 @@ requirements use the version keyword argument instead.''')
(res.stdout, res.stderr))
else:
raise InterpreterException('Configure_file must have either "configuration" or "command".')
- if isinstance(kwargs.get('install_dir', None), str):
- self.build.data.append(DataHolder(False, self.subdir, [output], kwargs).held_object)
+ idir = kwargs.get('install_dir', None)
+ if isinstance(idir, str):
+ cfile = mesonlib.File.from_built_file(ofile_path, ofile_fname)
+ self.build.data.append(DataHolder([cfile], idir).held_object)
return mesonlib.File.from_built_file(self.subdir, output)
@stringArgs