diff options
-rw-r--r-- | build.py | 7 | ||||
-rw-r--r-- | interpreter.py | 8 | ||||
-rwxr-xr-x | meson_install.py | 32 | ||||
-rw-r--r-- | modules/gnome.py | 5 | ||||
-rw-r--r-- | ninjabackend.py | 3 | ||||
-rw-r--r-- | test cases/common/60 install script/meson.build | 4 | ||||
-rw-r--r-- | test cases/frameworks/10 gtk-doc/doc/meson.build | 2 | ||||
-rw-r--r-- | test cases/frameworks/10 gtk-doc/installed_files.txt | 15 |
8 files changed, 51 insertions, 25 deletions
@@ -72,7 +72,7 @@ class Build: self.pot = [] self.subprojects = {} self.pkgconfig_gens = [] - self.install_script = None + self.install_scripts = [] self.install_dirs = [] def has_language(self, language): @@ -894,3 +894,8 @@ class PkgConfigGenerator(): self.description = description self.version = version self.filebase = filebase + +class InstallScript: + def __init__(self, cmd_arr): + assert(isinstance(cmd_arr, list)) + self.cmd_arr = cmd_arr diff --git a/interpreter.py b/interpreter.py index 0db5963..a54133a 100644 --- a/interpreter.py +++ b/interpreter.py @@ -721,10 +721,10 @@ class MesonMain(InterpreterObject): 'current_build_dir' : self.current_build_dir_method, 'source_root' : self.source_root_method, 'build_root' : self.build_root_method, - 'set_install_script' : self.set_install_script_method, + 'add_install_script' : self.add_install_script_method, }) - def set_install_script_method(self, args, kwargs): + def add_install_script_method(self, args, kwargs): if len(args) != 1: raise InterpreterException('Set_install_script takes exactly one argument.') check_stringlist(args) @@ -733,7 +733,7 @@ class MesonMain(InterpreterObject): self.interpreter.subdir, scriptbase) if not os.path.isfile(scriptfile): raise InterpreterException('Can not find install script %s.' % scriptbase) - self.build.install_script = scriptfile + self.build.install_scripts.append(build.InstallScript([scriptfile])) def current_source_dir_method(self, args, kwargs): src = self.interpreter.environment.source_dir @@ -912,6 +912,8 @@ class Interpreter(): if v.name in self.build.targets: raise InterpreterException('Tried to create target %s which already exists.' % v.name) self.build.targets[v.name] = v + elif isinstance(v, build.InstallScript): + self.build.install_scripts.append(v) else: print(v) raise InterpreterException('Module returned a value of unknown type.') diff --git a/meson_install.py b/meson_install.py index 5643298..c5c17ba 100755 --- a/meson_install.py +++ b/meson_install.py @@ -29,7 +29,7 @@ class InstallData(): self.data = [] self.po_package_name = '' self.po = [] - self.install_script = None + self.install_scripts = [] self.install_subdirs = [] def do_install(datafilename): @@ -119,26 +119,28 @@ def install_headers(d): shutil.copystat(fullfilename, outfilename) def run_install_script(d): - if d.install_script is None: - return env = {'MESON_SOURCE_ROOT' : d.source_dir, 'MESON_BUILD_ROOT' : d.build_dir, 'MESON_INSTALL_PREFIX' : d.prefix } - script = d.install_script - print('Running custom install script %s' % script) - suffix = os.path.splitext(script)[1].lower() - if platform.system().lower() == 'windows' and suffix != '.bat': - first_line = open(script).readline().strip() - if first_line.startswith('#!'): - commands = first_line[2:].split('#')[0].strip().split() - commands[0] = shutil.which(commands[0].split('/')[-1]) - if commands[0] is None: - raise RuntimeError("Don't know how to run script %s." % script) - script = commands + [script] child_env = os.environ.copy() child_env.update(env) - subprocess.check_call(script, env=child_env) + + for i in d.install_scripts: + script = i.cmd_arr[0] + print('Running custom install script %s' % script) + suffix = os.path.splitext(script)[1].lower() + if platform.system().lower() == 'windows' and suffix != '.bat': + first_line = open(script).readline().strip() + if first_line.startswith('#!'): + commands = first_line[2:].split('#')[0].strip().split() + commands[0] = shutil.which(commands[0].split('/')[-1]) + if commands[0] is None: + raise RuntimeError("Don't know how to run script %s." % script) + final_command = commands + [script] + i.cmd_arr[1:] + else: + final_command = i.cmd_arr + subprocess.check_call(final_command, env=child_env) def is_elf_platform(): platname = platform.system().lower() diff --git a/modules/gnome.py b/modules/gnome.py index 64e91df..ed56989 100644 --- a/modules/gnome.py +++ b/modules/gnome.py @@ -192,7 +192,10 @@ class GnomeModule: state.subdir, os.path.normpath(os.path.join(state.subdir, src_dir)), modulename] - return build.RunTarget(targetname, command, args, state.subdir) + res = [build.RunTarget(targetname, command, args, state.subdir)] + if kwargs.get('install', True): + res.append(build.InstallScript([command] + args)) + return res def gdbus_codegen(self, state, args, kwargs): if len(args) != 2: diff --git a/ninjabackend.py b/ninjabackend.py index 9781990..1aea454 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -431,8 +431,7 @@ class NinjaBackend(backends.Backend): d.man.append(i) def generate_custom_install_script(self, d): - d.install_script = self.build.install_script - + d.install_scripts = self.build.install_scripts def generate_header_install(self, d): incroot = self.environment.get_includedir() diff --git a/test cases/common/60 install script/meson.build b/test cases/common/60 install script/meson.build index ed415b6..66db0a7 100644 --- a/test cases/common/60 install script/meson.build +++ b/test cases/common/60 install script/meson.build @@ -1,8 +1,8 @@ project('custom install script', 'c') if meson.get_compiler('c').get_id() == 'msvc' - meson.set_install_script('myinstall.bat') + meson.add_install_script('myinstall.bat') else - meson.set_install_script('myinstall.sh') + meson.add_install_script('myinstall.sh') endif executable('prog', 'prog.c', install : true) diff --git a/test cases/frameworks/10 gtk-doc/doc/meson.build b/test cases/frameworks/10 gtk-doc/doc/meson.build index 4c67a19..2940d41 100644 --- a/test cases/frameworks/10 gtk-doc/doc/meson.build +++ b/test cases/frameworks/10 gtk-doc/doc/meson.build @@ -1,3 +1,3 @@ gnome = import('gnome') -gnome.gtkdoc('foobar', src_dir : '../include') +gnome.gtkdoc('foobar', src_dir : '../include', install : true) diff --git a/test cases/frameworks/10 gtk-doc/installed_files.txt b/test cases/frameworks/10 gtk-doc/installed_files.txt new file mode 100644 index 0000000..c8ec9d6 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/installed_files.txt @@ -0,0 +1,15 @@ +usr/share/gtk-doc/html/foobar/api-index-full.html +usr/share/gtk-doc/html/foobar/ch01.html +usr/share/gtk-doc/html/foobar/deprecated-api-index.html +usr/share/gtk-doc/html/foobar/foobar.devhelp2 +usr/share/gtk-doc/html/foobar/foobar-foo.html +usr/share/gtk-doc/html/foobar/home.png +usr/share/gtk-doc/html/foobar/index.html +usr/share/gtk-doc/html/foobar/index.sgml +usr/share/gtk-doc/html/foobar/left-insensitive.png +usr/share/gtk-doc/html/foobar/left.png +usr/share/gtk-doc/html/foobar/right-insensitive.png +usr/share/gtk-doc/html/foobar/right.png +usr/share/gtk-doc/html/foobar/style.css +usr/share/gtk-doc/html/foobar/up-insensitive.png +usr/share/gtk-doc/html/foobar/up.png |