diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-18 19:59:48 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-18 18:30:47 +0200 |
commit | c693bd9bb4be3b2f5413277aba723cb58223b44b (patch) | |
tree | d1f747173854fee64d497c718f66c7ae600e216e /mesonbuild/interpreter.py | |
parent | 67c106a00152b44409a36ce7295a232afd09941c (diff) | |
download | meson-c693bd9bb4be3b2f5413277aba723cb58223b44b.zip meson-c693bd9bb4be3b2f5413277aba723cb58223b44b.tar.gz meson-c693bd9bb4be3b2f5413277aba723cb58223b44b.tar.bz2 |
Allow passing arguments to install scripts
Closes #1213
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index b586997..5dc87cc 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1007,26 +1007,26 @@ class MesonMain(InterpreterObject): }) def add_install_script_method(self, args, kwargs): - if len(args) != 1: - raise InterpreterException('Set_install_script takes exactly one argument.') - check_stringlist(args) + if len(args) < 1: + raise InterpreterException('add_install_script takes one or more arguments') + check_stringlist(args, 'add_install_script args must be strings') scriptbase = args[0] - scriptfile = os.path.join(self.interpreter.environment.source_dir, - self.interpreter.subdir, scriptbase) - if not os.path.isfile(scriptfile): - raise InterpreterException('Can not find install script %s.' % scriptbase) - self.build.install_scripts.append(build.InstallScript([scriptfile])) + search_dir = os.path.join(self.interpreter.environment.source_dir, + self.interpreter.subdir) + script = dependencies.ExternalProgram(scriptbase, search_dir=search_dir) + extras = args[1:] + self.build.install_scripts.append({'exe': script.get_command(), 'args': extras}) def add_postconf_script_method(self, args, kwargs): if len(args) < 1: - raise InterpreterException('Not enough arguments') - check_stringlist(args, 'add_postconf_script arguments must be strings.') + raise InterpreterException('add_postconf_script takes one or more arguments') + check_stringlist(args, 'add_postconf_script arguments must be strings') scriptbase = args[0] search_dir = os.path.join(self.interpreter.environment.source_dir, self.interpreter.subdir) - exe = dependencies.ExternalProgram(scriptbase, search_dir=search_dir) + script = dependencies.ExternalProgram(scriptbase, search_dir=search_dir) extras = args[1:] - self.build.postconf_scripts.append({'exe': exe, 'args': extras}) + self.build.postconf_scripts.append({'exe': script, 'args': extras}) def current_source_dir_method(self, args, kwargs): src = self.interpreter.environment.source_dir |