diff options
-rw-r--r-- | coredata.py | 27 | ||||
-rw-r--r-- | interpreter.py | 4 | ||||
-rwxr-xr-x | meson_install.py | 2 | ||||
-rw-r--r-- | ninjabackend.py | 14 | ||||
-rwxr-xr-x | run_tests.py | 22 | ||||
-rw-r--r-- | test cases/common/47 options/meson.build | 4 |
6 files changed, 67 insertions, 6 deletions
diff --git a/coredata.py b/coredata.py index e7d8bcd..177a9d0 100644 --- a/coredata.py +++ b/coredata.py @@ -55,6 +55,33 @@ class CoreData(): self.ext_progs = {} self.ext_libs = {} + def get_builtin_option(self, optname): + if optname == 'type': + return self.buildtype + if optname == 'strip': + return self.strip + if optname == 'coverage': + return self.coverage + if optname == 'pch': + return self.use_pch + if optname == 'unity': + return self.unity + if optname == 'prefix': + return self.prefix + if optname == 'libdir': + return self.libdir + if optname == 'bindir': + return self.bindir + if optname == 'includedir': + return self.includedir + if optname == 'datadir': + return self.datadir + if optname == 'mandir': + return self.mandir + if optname == 'localedir': + return self.localedir + raise RuntimeError('Tried to get unknown builtin option %s' % optname) + def load(filename): obj = pickle.load(open(filename, 'rb')) if not isinstance(obj, CoreData): diff --git a/interpreter.py b/interpreter.py index 2b75fa8..941d6bd 100644 --- a/interpreter.py +++ b/interpreter.py @@ -937,6 +937,10 @@ class Interpreter(): raise InterpreterException('Argument of get_option must be a string.') if self.subproject != '': optname = self.subproject + '-' + optname + try: + return self.environment.get_coredata().get_builtin_option(optname) + except RuntimeError: + pass if optname not in self.environment.coredata.user_options: raise InterpreterException('Tried to access unknown option "%s".' % optname) return self.environment.coredata.user_options[optname].value diff --git a/meson_install.py b/meson_install.py index 0d6db82..179b053 100755 --- a/meson_install.py +++ b/meson_install.py @@ -190,7 +190,7 @@ def install_targets(d): os.unlink(symlinkfilename) except FileNotFoundError: pass - os.symlink(fname, symlinkfilename) + os.symlink(os.path.split(fname)[-1], symlinkfilename) except NotImplementedError: if not printed_symlink_error: print("Symlink creation does not work on this platform.") diff --git a/ninjabackend.py b/ninjabackend.py index ad8447d..b21572a 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -901,9 +901,14 @@ rule FORTRAN_DEP_HACK crstr = '' rule = 'rule %s%s_COMPILER\n' % (langname, crstr) depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE') + quoted_depargs = [] + for d in depargs: + if d != '$out' and d != '$in': + d = qstr % d + quoted_depargs.append(d) command = " command = %s $ARGS %s %s %s $in\n" % \ (' '.join(compiler.get_exelist()),\ - ' '.join([qstr % d for d in depargs]),\ + ' '.join(quoted_depargs),\ ' '.join(compiler.get_output_args('$out')),\ ' '.join(compiler.get_compile_only_args())) description = ' description = Compiling %s object $out\n' % langname @@ -927,13 +932,18 @@ rule FORTRAN_DEP_HACK crstr = '' rule = 'rule %s%s_PCH\n' % (langname, crstr) depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE') + quoted_depargs = [] + for d in depargs: + if d != '$out' and d != '$in': + d = qstr % d + quoted_depargs.append(d) if compiler.get_id() == 'msvc': output = '' else: output = ' '.join(compiler.get_output_args('$out')) command = " command = %s $ARGS %s %s %s $in\n" % \ (' '.join(compiler.get_exelist()),\ - ' '.join([qstr % d for d in depargs]),\ + ' '.join(quoted_depargs),\ output,\ ' '.join(compiler.get_compile_only_args())) description = ' description = Precompiling header %s\n' % '$in' diff --git a/run_tests.py b/run_tests.py index 8ed0f69..671289b 100755 --- a/run_tests.py +++ b/run_tests.py @@ -15,7 +15,7 @@ # limitations under the License. from glob import glob -import os, subprocess, shutil, sys, platform +import os, subprocess, shutil, sys, platform, signal import environment from environment import is_windows @@ -27,6 +27,17 @@ test_build_dir = 'work area' install_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], 'install dir') meson_command = './meson.py' +class StopException(Exception): + def __init__(self): + super(Exception, self).__init__('Stopped by user') + +stop = False +def stop_handler(signal, frame): + global stop + stop = True +signal.signal(signal.SIGINT, stop_handler) +signal.signal(signal.SIGTERM, stop_handler) + #unity_flags = ['--unity'] unity_flags = [] msbuild_exe = shutil.which('msbuild') @@ -93,7 +104,7 @@ def validate_install(srcdir, installdir): return '' def run_and_log(logfile, testdir, should_succeed=True): - global passing_tests, failing_tests + global passing_tests, failing_tests, stop (msg, stdo, stde) = run_test(testdir, should_succeed) if msg != '': print('Fail:', msg) @@ -109,6 +120,8 @@ def run_and_log(logfile, testdir, should_succeed=True): if print_debug: print(stdo) print(stde, file=sys.stderr) + if stop: + raise StopException() def run_test(testdir, should_succeed): global compile_commands @@ -309,7 +322,10 @@ if __name__ == '__main__': os.chdir(script_dir) check_format() pbfile = generate_prebuilt_object() - run_tests() + try: + run_tests() + except StopException: + pass os.unlink(pbfile) print('\nTotal passed tests:', passing_tests) print('Total failed tests:', failing_tests) diff --git a/test cases/common/47 options/meson.build b/test cases/common/47 options/meson.build index 6604d8a..796c27f 100644 --- a/test cases/common/47 options/meson.build +++ b/test cases/common/47 options/meson.build @@ -11,3 +11,7 @@ endif if get_option('combo_opt') != 'combo' error('Incorrect value to combo option.') endif + +if get_option('includedir') != 'include' + error('Incorrect value in builtin option.') +endif |