diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-11-03 18:37:23 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-11-03 18:37:23 +0200 |
commit | a500c6cfa885ab9da7527d6f983f162f31e47710 (patch) | |
tree | f8044d17e42f53d5da52d9470fe9432f5f8132d2 | |
parent | d767bcf86db95d5d9f17306b3c17d56f93b0e873 (diff) | |
download | meson-a500c6cfa885ab9da7527d6f983f162f31e47710.zip meson-a500c6cfa885ab9da7527d6f983f162f31e47710.tar.gz meson-a500c6cfa885ab9da7527d6f983f162f31e47710.tar.bz2 |
Can install data files from subdirectories.
-rw-r--r-- | interpreter.py | 14 | ||||
-rw-r--r-- | ninjabackend.py | 4 | ||||
-rw-r--r-- | test cases/common/12 data/installed_files.txt | 1 | ||||
-rw-r--r-- | test cases/common/12 data/meson.build | 1 | ||||
-rw-r--r-- | test cases/common/12 data/vanishing/meson.build | 1 | ||||
-rw-r--r-- | test cases/common/12 data/vanishing/vanishing.dat | 1 |
6 files changed, 15 insertions, 7 deletions
diff --git a/interpreter.py b/interpreter.py index 1ca1713..d01ebc0 100644 --- a/interpreter.py +++ b/interpreter.py @@ -301,9 +301,10 @@ class Headers(InterpreterObject): return self.custom_install_dir class Data(InterpreterObject): - def __init__(self, subdir, sources, kwargs): + def __init__(self, source_subdir, subdir, sources, kwargs): InterpreterObject.__init__(self) - self.subdir = subdir + self.source_subdir = source_subdir + self.install_subdir = subdir self.sources = sources kwsource = kwargs.get('sources', []) if not isinstance(kwsource, list): @@ -313,8 +314,11 @@ class Data(InterpreterObject): if self.custom_install_dir is not None and not isinstance(self.custom_install_dir, str): raise InterpreterException('Custom_install_dir must be a string.') - def get_subdir(self): - return self.subdir + def get_install_subdir(self): + return self.install_subdir + + def get_source_subdir(self): + return self.source_subdir def get_sources(self): return self.sources @@ -1210,7 +1214,7 @@ class Interpreter(): for a in args: if not isinstance(a, str): raise InvalidArguments('Argument %s is not a string.' % str(a)) - data = Data(args[0], args[1:], kwargs) + data = Data(self.subdir, args[0], args[1:], kwargs) self.build.data.append(data) return data diff --git a/ninjabackend.py b/ninjabackend.py index 178e371..398b0ef 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -459,9 +459,9 @@ class NinjaBackend(backends.Backend): for de in data: subdir = de.get_custom_install_dir() if subdir is None: - subdir = os.path.join(dataroot, de.get_subdir()) + subdir = os.path.join(dataroot, de.get_install_subdir()) for f in de.get_sources(): - srcabs = os.path.join(self.environment.get_source_dir(), f) + srcabs = os.path.join(self.environment.get_source_dir(), de.get_source_subdir(), f) dstabs = os.path.join(subdir, f) i = [srcabs, dstabs] d.data.append(i) diff --git a/test cases/common/12 data/installed_files.txt b/test cases/common/12 data/installed_files.txt index 362b7ce..8d7ff70 100644 --- a/test cases/common/12 data/installed_files.txt +++ b/test cases/common/12 data/installed_files.txt @@ -1 +1,2 @@ share/progname/datafile.dat +share/progname/vanishing.dat diff --git a/test cases/common/12 data/meson.build b/test cases/common/12 data/meson.build index ea9cfd7..8507046 100644 --- a/test cases/common/12 data/meson.build +++ b/test cases/common/12 data/meson.build @@ -1,2 +1,3 @@ project('data install test', 'c') install_data('progname', sources : 'datafile.dat') +subdir('vanishing') diff --git a/test cases/common/12 data/vanishing/meson.build b/test cases/common/12 data/vanishing/meson.build new file mode 100644 index 0000000..d2283e7 --- /dev/null +++ b/test cases/common/12 data/vanishing/meson.build @@ -0,0 +1 @@ +install_data('progname', sources : 'vanishing.dat')
\ No newline at end of file diff --git a/test cases/common/12 data/vanishing/vanishing.dat b/test cases/common/12 data/vanishing/vanishing.dat new file mode 100644 index 0000000..b7d0609 --- /dev/null +++ b/test cases/common/12 data/vanishing/vanishing.dat @@ -0,0 +1 @@ +This is a data file to be installed in a subdirectory. |