Fix the remaining custom install dirs.
This commit is contained in:
parent
51827d4484
commit
eb51163185
11
backends.py
11
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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Installed cat is installed.
|
|
@ -1,2 +1,4 @@
|
|||
dib/dab/dub/prog
|
||||
some/dir/sample.h
|
||||
woman/prog.1.gz
|
||||
meow/datafile.cat
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Man up, you.
|
Loading…
Reference in New Issue