diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-04-28 00:34:12 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-04-28 00:34:37 +0300 |
commit | d9d70372b4bfce1e8c13aa340bca2699fec3f366 (patch) | |
tree | a29dd9a0b2e7d22b938d5c164272e8dc5dece938 /interpreter.py | |
parent | 5b0322ad15b88a038d3f472ff0937655c9d65cb7 (diff) | |
download | meson-d9d70372b4bfce1e8c13aa340bca2699fec3f366.zip meson-d9d70372b4bfce1e8c13aa340bca2699fec3f366.tar.gz meson-d9d70372b4bfce1e8c13aa340bca2699fec3f366.tar.bz2 |
Can generate configuration files with custom scripts.
Diffstat (limited to 'interpreter.py')
-rw-r--r-- | interpreter.py | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/interpreter.py b/interpreter.py index 7940c94..f6ae8bb 100644 --- a/interpreter.py +++ b/interpreter.py @@ -549,6 +549,7 @@ class MesonMain(InterpreterObject): 'has_exe_wrapper' : self.has_exe_wrapper_method, 'is_unity' : self.is_unity_method, 'current_source_dir' : self.current_source_dir_method, + 'current_build_dir' : self.current_build_dir_method, }) def current_source_dir_method(self, args, kwargs): @@ -558,6 +559,13 @@ class MesonMain(InterpreterObject): return src return os.path.join(src, sub) + def current_build_dir_method(self, args, kwargs): + src = self.interpreter.environment.build_dir + sub = self.interpreter.subdir + if sub == '': + return src + return os.path.join(src, sub) + def has_exe_wrapper_method(self, args, kwargs): if self.is_cross_build_method(None, None): return 'exe_wrap' in self.build.environment.cross_info @@ -1092,19 +1100,24 @@ class Interpreter(): raise InterpreterException('Required keyword argument "input" not defined.') if not 'output' in kwargs: raise InterpreterException('Required keyword argument "output" not defined.') - if not 'configuration' in kwargs: - raise InterpreterException('Required keyword argument "configuration" not defined.') - inputfile = kwargs['input'] - output = kwargs['output'] - conf = kwargs['configuration'] - if not isinstance(conf, ConfigurationDataHolder): - raise InterpreterException('Argument "configuration" is not of type configuration_data') - - conffile = os.path.join(self.subdir, inputfile) - self.build_def_files.append(conffile) - c = ConfigureFileHolder(self.subdir, inputfile, output, conf.held_object) - self.build.configure_files.append(c.held_object) - conf.mark_used() + if 'configuration' in kwargs: + inputfile = kwargs['input'] + output = kwargs['output'] + conf = kwargs['configuration'] + if not isinstance(conf, ConfigurationDataHolder): + raise InterpreterException('Argument "configuration" is not of type configuration_data') + + conffile = os.path.join(self.subdir, inputfile) + self.build_def_files.append(conffile) + c = ConfigureFileHolder(self.subdir, inputfile, output, conf.held_object) + self.build.configure_files.append(c.held_object) + conf.mark_used() + elif 'command' in kwargs: + res = self.func_run_command(node, kwargs['command'], {}) + if res.returncode != 0: + raise InterpreterException('Running configure command failed.') + else: + raise InterpreterException('Configure_file must have either "configuration" or "command".') def func_include_directories(self, node, args, kwargs): absbase = os.path.join(self.environment.get_source_dir(), self.subdir) |