aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2014-02-12 22:50:45 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2014-02-12 22:50:45 +0200
commiteb51163185fdeaf50646d0ae2876c94c230fa61a (patch)
treecd2065edcb904cfd116226e9f3bc439416139419
parent51827d4484845432588f850b24245d22b1d9c9f0 (diff)
downloadmeson-eb51163185fdeaf50646d0ae2876c94c230fa61a.zip
meson-eb51163185fdeaf50646d0ae2876c94c230fa61a.tar.gz
meson-eb51163185fdeaf50646d0ae2876c94c230fa61a.tar.bz2
Fix the remaining custom install dirs.
-rw-r--r--backends.py11
-rw-r--r--interpreter.py18
-rw-r--r--test cases/common/52 custom install dirs/datafile.cat1
-rw-r--r--test cases/common/52 custom install dirs/installed_files.txt2
-rw-r--r--test cases/common/52 custom install dirs/meson.build2
-rw-r--r--test cases/common/52 custom install dirs/prog.11
6 files changed, 28 insertions, 7 deletions
diff --git a/backends.py b/backends.py
index 6a1109b..e4aaced 100644
--- a/backends.py
+++ b/backends.py
@@ -587,10 +587,11 @@ class NinjaBackend(Backend):
for m in man:
for f in m.get_sources():
num = f.split('.')[-1]
- subdir = 'man' + num
+ subdir = m.get_custom_install_dir()
+ if subdir is None:
+ subdir = os.path.join(manroot, 'man' + num)
srcabs = os.path.join(self.environment.get_source_dir(), f)
- dstabs = os.path.join(manroot,
- os.path.join(subdir, f + '.gz'))
+ dstabs = os.path.join(subdir, f + '.gz')
i = [srcabs, dstabs]
d.man.append(i)
@@ -598,7 +599,9 @@ class NinjaBackend(Backend):
dataroot = self.environment.get_datadir()
data = self.build.get_data()
for de in data:
- subdir = os.path.join(dataroot, de.get_subdir())
+ subdir = de.get_custom_install_dir()
+ if subdir is None:
+ subdir = os.path.join(dataroot, de.get_subdir())
for f in de.get_sources():
srcabs = os.path.join(self.environment.get_source_dir(), f)
dstabs = os.path.join(subdir, f)
diff --git a/interpreter.py b/interpreter.py
index 1e74f40..3ca425f 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -293,6 +293,9 @@ class Data(InterpreterObject):
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):
+ raise InterpreterException('Custom_install_dir must be a string.')
def get_subdir(self):
return self.subdir
@@ -300,21 +303,30 @@ class Data(InterpreterObject):
def get_sources(self):
return self.sources
+ def get_custom_install_dir(self):
+ return self.custom_install_dir
+
class Man(InterpreterObject):
def __init__(self, sources, kwargs):
InterpreterObject.__init__(self)
self.sources = sources
self.validate_sources()
- if len(kwargs) > 0:
- raise InvalidArguments('Man function takes no keyword arguments.')
-
+ if len(kwargs) > 1:
+ raise InvalidArguments('Man function takes at most one keyword arguments.')
+ 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):
+ raise InterpreterException('Custom_install_dir must be a string.')
+
def validate_sources(self):
for s in self.sources:
num = int(s.split('.')[-1])
if num < 1 or num > 8:
raise InvalidArguments('Man file must have a file extension of a number between 1 and 8')
+ def get_custom_install_dir(self):
+ return self.custom_install_dir
+
def get_sources(self):
return self.sources
diff --git a/test cases/common/52 custom install dirs/datafile.cat b/test cases/common/52 custom install dirs/datafile.cat
new file mode 100644
index 0000000..53d81fc
--- /dev/null
+++ b/test cases/common/52 custom install dirs/datafile.cat
@@ -0,0 +1 @@
+Installed cat is installed.
diff --git a/test cases/common/52 custom install dirs/installed_files.txt b/test cases/common/52 custom install dirs/installed_files.txt
index a8a496c..ad6ce3b 100644
--- a/test cases/common/52 custom install dirs/installed_files.txt
+++ b/test cases/common/52 custom install dirs/installed_files.txt
@@ -1,2 +1,4 @@
dib/dab/dub/prog
some/dir/sample.h
+woman/prog.1.gz
+meow/datafile.cat
diff --git a/test cases/common/52 custom install dirs/meson.build b/test cases/common/52 custom install dirs/meson.build
index 5f1919a..4a222ba 100644
--- a/test cases/common/52 custom install dirs/meson.build
+++ b/test cases/common/52 custom install dirs/meson.build
@@ -2,3 +2,5 @@ project('custom install dirs', 'c')
executable('prog', 'prog.c', install : true, install_dir : 'dib/dab/dub')
headers('sample.h', install_dir : 'some/dir')
+man('prog.1', install_dir : 'woman')
+data('foobar', 'datafile.cat', install_dir : 'meow')
diff --git a/test cases/common/52 custom install dirs/prog.1 b/test cases/common/52 custom install dirs/prog.1
new file mode 100644
index 0000000..08ef7da
--- /dev/null
+++ b/test cases/common/52 custom install dirs/prog.1
@@ -0,0 +1 @@
+Man up, you.