diff options
-rw-r--r-- | interpreter.py | 18 | ||||
-rw-r--r-- | ninjabackend.py | 4 | ||||
-rw-r--r-- | test cases/common/12 data/meson.build | 4 | ||||
-rw-r--r-- | test cases/common/12 data/vanishing/meson.build | 2 | ||||
-rw-r--r-- | test cases/common/52 custom install dirs/meson.build | 3 |
5 files changed, 14 insertions, 17 deletions
diff --git a/interpreter.py b/interpreter.py index a00a1ae..7cc938d 100644 --- a/interpreter.py +++ b/interpreter.py @@ -303,17 +303,19 @@ class Headers(InterpreterObject): return self.custom_install_dir class Data(InterpreterObject): - def __init__(self, source_subdir, subdir, sources, kwargs): + def __init__(self, source_subdir, sources, kwargs): InterpreterObject.__init__(self) self.source_subdir = source_subdir - self.install_subdir = subdir self.sources = sources kwsource = kwargs.get('sources', []) if not isinstance(kwsource, list): kwsource = [kwsource] self.sources += kwsource - self.custom_install_dir = kwargs.get('install_dir', None) - if self.custom_install_dir is not None and not isinstance(self.custom_install_dir, str): + for s in self.sources: + if not isinstance(s, str): + raise InterpreterException('Install file name must be a string.') + self.install_dir = kwargs.get('install_dir', None) + if not isinstance(self.install_dir, str): raise InterpreterException('Custom_install_dir must be a string.') def get_install_subdir(self): @@ -325,8 +327,8 @@ class Data(InterpreterObject): def get_sources(self): return self.sources - def get_custom_install_dir(self): - return self.custom_install_dir + def get_install_dir(self): + return self.install_dir class InstallDir(InterpreterObject): def __init__(self, source_subdir, installable_subdir, install_dir): @@ -1264,12 +1266,10 @@ class Interpreter(): self.subdir = prev_subdir def func_install_data(self, node, args, kwargs): - if len(args ) < 1: - raise InvalidArguments('Data function must have at least one argument: the subdirectory.') for a in args: if not isinstance(a, str): raise InvalidArguments('Argument %s is not a string.' % str(a)) - data = Data(self.subdir, args[0], args[1:], kwargs) + data = Data(self.subdir, args, kwargs) self.build.data.append(data) return data diff --git a/ninjabackend.py b/ninjabackend.py index fb7dfae..96e49d2 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -462,9 +462,7 @@ class NinjaBackend(backends.Backend): dataroot = self.environment.get_datadir() data = self.build.get_data() for de in data: - subdir = de.get_custom_install_dir() - if subdir is None: - subdir = os.path.join(dataroot, de.get_install_subdir()) + subdir = de.get_install_dir() for f in de.get_sources(): srcabs = os.path.join(self.environment.get_source_dir(), de.get_source_subdir(), f) dstabs = os.path.join(subdir, f) diff --git a/test cases/common/12 data/meson.build b/test cases/common/12 data/meson.build index 5a04d6c..2193f94 100644 --- a/test cases/common/12 data/meson.build +++ b/test cases/common/12 data/meson.build @@ -1,4 +1,4 @@ project('data install test', 'c') -install_data('progname', sources : 'datafile.dat') -install_data('dummy', sources : 'etcfile.dat', install_dir : '/etc') +install_data(sources : 'datafile.dat', install_dir : 'share/progname') +install_data(sources : 'etcfile.dat', install_dir : '/etc') subdir('vanishing') diff --git a/test cases/common/12 data/vanishing/meson.build b/test cases/common/12 data/vanishing/meson.build index d2283e7..1a27137 100644 --- a/test cases/common/12 data/vanishing/meson.build +++ b/test cases/common/12 data/vanishing/meson.build @@ -1 +1 @@ -install_data('progname', sources : 'vanishing.dat')
\ No newline at end of file +install_data(sources : 'vanishing.dat', install_dir : 'share/progname') diff --git a/test cases/common/52 custom install dirs/meson.build b/test cases/common/52 custom install dirs/meson.build index 8f929b8..622ecad 100644 --- a/test cases/common/52 custom install dirs/meson.build +++ b/test cases/common/52 custom install dirs/meson.build @@ -1,6 +1,5 @@ project('custom install dirs', 'c') - executable('prog', 'prog.c', install : true, install_dir : 'dib/dab/dub') install_headers('sample.h', install_dir : 'some/dir') install_man('prog.1', install_dir : 'woman') -install_data('foobar', 'datafile.cat', install_dir : 'meow') +install_data('datafile.cat', install_dir : 'meow') |