diff options
23 files changed, 25 insertions, 28 deletions
diff --git a/.travis.yml b/.travis.yml index 2564742..9b4e0a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,4 @@ script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && ./run_tests.py"; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./run_tests.py --backend=ninja ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) ./run_tests.py --backend=ninja ; fi diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index cc85e77..b3bb1f2 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1129,6 +1129,12 @@ class Interpreter(): self.sanity_check_ast() self.variables = {} self.builtin = {} + self.generators = [] + self.visited_subdirs = {} + self.global_args_frozen = False + self.subprojects = {} + self.subproject_stack = [] + self.build_func_dict() self.parse_project() self.builtin['build_machine'] = BuildMachine(self.coredata.compilers) if not self.build.environment.is_cross_build(): @@ -1145,13 +1151,7 @@ class Interpreter(): else: self.builtin['target_machine'] = self.builtin['host_machine'] self.builtin['meson'] = MesonMain(build, self) - self.build_func_dict() self.build_def_files = [os.path.join(self.subdir, environment.build_filename)] - self.generators = [] - self.visited_subdirs = {} - self.global_args_frozen = False - self.subprojects = {} - self.subproject_stack = [] def build_func_dict(self): self.funcs = {'project' : self.func_project, @@ -1203,9 +1203,7 @@ class Interpreter(): Parses project() and initializes languages, compilers etc. Do this early because we need this before we parse the rest of the AST. """ - project = self.ast.lines[0] - args, kwargs = self.reduce_arguments(project.args) - self.func_project(project, args, kwargs) + self.evaluate_codeblock(self.ast, end=1) def module_method_callback(self, invalues): unwrap_single = False @@ -1282,7 +1280,7 @@ class Interpreter(): self.evaluate_codeblock(self.ast, start=1) mlog.log('Build targets in project:', mlog.bold(str(len(self.build.targets)))) - def evaluate_codeblock(self, node, start=0): + def evaluate_codeblock(self, node, start=0, end=None): if node is None: return if not isinstance(node, mparser.CodeBlockNode): @@ -1290,8 +1288,8 @@ class Interpreter(): e.lineno = node.lineno e.colno = node.colno raise e - statements = node.lines - i = start + statements = node.lines[start:end] + i = 0 while i < len(statements): cur = statements[i] try: diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index afabc62..25f2c6b 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - # Copyright 2014-2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index f35d821..f7da1e0 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - # Copyright 2012-2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 2086c37..a18912e 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - # Copyright 2014-2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/mesonbuild/scripts/commandrunner.py b/mesonbuild/scripts/commandrunner.py index 1c37f5c..1c37f5c 100644..100755 --- a/mesonbuild/scripts/commandrunner.py +++ b/mesonbuild/scripts/commandrunner.py diff --git a/mesonbuild/scripts/delwithsuffix.py b/mesonbuild/scripts/delwithsuffix.py index e112101..e112101 100644..100755 --- a/mesonbuild/scripts/delwithsuffix.py +++ b/mesonbuild/scripts/delwithsuffix.py diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py index 7124c6f..7124c6f 100644..100755 --- a/mesonbuild/scripts/depfixer.py +++ b/mesonbuild/scripts/depfixer.py diff --git a/mesonbuild/scripts/dirchanger.py b/mesonbuild/scripts/dirchanger.py index 93a901d..93a901d 100644..100755 --- a/mesonbuild/scripts/dirchanger.py +++ b/mesonbuild/scripts/dirchanger.py diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py index 1f0a391..ba6b242 100644 --- a/mesonbuild/scripts/gettext.py +++ b/mesonbuild/scripts/gettext.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - # Copyright 2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py index e87a379..e87a379 100644..100755 --- a/mesonbuild/scripts/gtkdochelper.py +++ b/mesonbuild/scripts/gtkdochelper.py diff --git a/mesonbuild/scripts/meson_benchmark.py b/mesonbuild/scripts/meson_benchmark.py index 6d138b0..6d138b0 100644..100755 --- a/mesonbuild/scripts/meson_benchmark.py +++ b/mesonbuild/scripts/meson_benchmark.py diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py index d2ae357..d2ae357 100644..100755 --- a/mesonbuild/scripts/meson_exe.py +++ b/mesonbuild/scripts/meson_exe.py diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index 5cf02e6..5cf02e6 100644..100755 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py diff --git a/mesonbuild/scripts/meson_test.py b/mesonbuild/scripts/meson_test.py index acf7cd5..acf7cd5 100644..100755 --- a/mesonbuild/scripts/meson_test.py +++ b/mesonbuild/scripts/meson_test.py diff --git a/mesonbuild/scripts/regen_checker.py b/mesonbuild/scripts/regen_checker.py index ddf4943..ddf4943 100644..100755 --- a/mesonbuild/scripts/regen_checker.py +++ b/mesonbuild/scripts/regen_checker.py diff --git a/mesonbuild/scripts/scanbuild.py b/mesonbuild/scripts/scanbuild.py index f90c3c7..f13a1a4 100644 --- a/mesonbuild/scripts/scanbuild.py +++ b/mesonbuild/scripts/scanbuild.py @@ -1,5 +1,4 @@ # Copyright 2016 The Meson development team - # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index c117301..c117301 100644..100755 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py diff --git a/mesonbuild/scripts/vcstagger.py b/mesonbuild/scripts/vcstagger.py index 3f36e0a..3f36e0a 100644..100755 --- a/mesonbuild/scripts/vcstagger.py +++ b/mesonbuild/scripts/vcstagger.py diff --git a/run_tests.py b/run_tests.py index b57dd39..1e094ad 100755 --- a/run_tests.py +++ b/run_tests.py @@ -68,6 +68,7 @@ failing_tests = 0 skipped_tests = 0 failing_logs = [] print_debug = 'MESON_PRINT_TEST_OUTPUT' in os.environ +do_debug = not {'MESON_PRINT_TEST_OUTPUT', 'TRAVIS', 'APPVEYOR'}.isdisjoint(os.environ) meson_command = os.path.join(os.getcwd(), 'meson') if not os.path.exists(meson_command): @@ -117,7 +118,7 @@ def setup_commands(backend): ninja_command = environment.detect_ninja() if ninja_command is None: raise RuntimeError('Could not find Ninja v1.6 or newer') - if print_debug: + if do_debug: compile_commands = [ninja_command, '-v'] else: compile_commands = [ninja_command] @@ -378,7 +379,8 @@ def run_tests(extra_args): print('Failed test%s: %s' % (without_install, t)) print('Reason:', result.msg) failing_tests += 1 - failing_logs.append(result.mlog) + failing_logs.append(result.stdo) + failing_logs.append(result.stde) else: print('Succeeded test%s: %s' % (without_install, t)) passing_tests += 1 diff --git a/test cases/common/1 trivial/meson.build b/test cases/common/1 trivial/meson.build index 3f14539..1f7b375 100644 --- a/test cases/common/1 trivial/meson.build +++ b/test cases/common/1 trivial/meson.build @@ -1,5 +1,8 @@ # Comment on the first line -project('trivial test', 'c', meson_version : '>=0.27.0') +project('trivial test', + # Comment inside a function call + array for language list + ['c'], + meson_version : '>=0.27.0') #this is a comment sources = 'trivial.c' diff --git a/test cases/swift/2 multifile/main.swift b/test cases/swift/2 multifile/main.swift index 8f39ba6..9867e85 100644 --- a/test cases/swift/2 multifile/main.swift +++ b/test cases/swift/2 multifile/main.swift @@ -1 +1,5 @@ +#if swift(>=3.0) printSomething(text:"String from main") +#else +printSomething("String from main") +#endif diff --git a/tools/ac_converter.py b/tools/ac_converter.py index c7c9f44..4f284af 100755 --- a/tools/ac_converter.py +++ b/tools/ac_converter.py @@ -94,7 +94,7 @@ function_data = \ 'HAVE_READLINK': ('readlink', 'unistd.h'), 'HAVE_RES_INIT': ('res_init', 'resolv.h'), 'HAVE_SENDMMSG': ('sendmmsg', 'sys/socket.h'), - 'HAVE_SOCKET' : ('socket',' sys/socket.h'), + 'HAVE_SOCKET' : ('socket', 'sys/socket.h'), 'HAVE_GETENV': ('getenv', 'stdlib.h'), 'HAVE_SETENV': ('setenv', 'stdlib.h'), 'HAVE_PUTENV': ('putenv', 'stdlib.h'), @@ -115,7 +115,6 @@ function_data = \ 'HAVE_SYMLINK': ('symlink', 'unistd.h'), 'HAVE_SYSCTLBYNAME': ('sysctlbyname', 'sys/sysctl.h'), 'HAVE_TIMEGM': ('timegm', 'time.h'), - 'HAVE_UNSETENV': ('unsetenv', 'stdlib.h'), 'HAVE_USELOCALE': ('uselocale', 'xlocale.h'), 'HAVE_UTIMES': ('utimes', 'sys/time.h'), 'HAVE_VALLOC': ('valloc', 'stdlib.h'), @@ -280,7 +279,7 @@ endforeach print('check_functions = [') for token in functions: - if len(func) == 3: + if len(token) == 3: token, fdata0, fdata1 = token print(" ['%s', '%s', '#include<%s>']," % (token, fdata0, fdata1)) else: |