diff options
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | mesonbuild/compilers.py | 30 | ||||
-rw-r--r-- | mesonbuild/dependencies.py | 6 | ||||
-rw-r--r-- | mesonbuild/environment.py | 3 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 6 | ||||
-rw-r--r-- | mesonbuild/mesonmain.py | 8 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 30 | ||||
-rwxr-xr-x | run_unittests.py | 14 |
8 files changed, 65 insertions, 42 deletions
@@ -4,9 +4,11 @@ MesonĀ® is a project to create the best possible next-generation build system. -####Build status +#### Status -[](https://travis-ci.org/mesonbuild/meson) [](https://ci.appveyor.com/project/jpakkane/meson) +[](https://pypi.python.org/pypi/meson) +[](https://travis-ci.org/mesonbuild/meson) +[](https://ci.appveyor.com/project/jpakkane/meson) ####Dependencies @@ -38,6 +40,10 @@ executable run the following command: Note that the source checkout may not be `meson` because it would clash with the generated binary name. +This will zip all files inside the source checkout into the script +which includes hundreds of tests, so you might want to temporarily +remove those before running it. + ####Running Meson requires that you have a source directory and a build directory diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index ced2b6f..8f8851f 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1846,11 +1846,7 @@ class VisualStudioCCompiler(CCompiler): } def get_option_link_args(self, options): - # FIXME: See GnuCCompiler.get_option_link_args - if 'c_winlibs' in options: - return options['c_winlibs'].value[:] - else: - return msvc_winlibs[:] + return options['c_winlibs'].value[:] def unix_link_flags_to_native(self, args): result = [] @@ -1955,11 +1951,7 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): return args def get_option_link_args(self, options): - # FIXME: See GnuCCompiler.get_option_link_args - if 'cpp_winlibs' in options: - return options['cpp_winlibs'].value[:] - else: - return msvc_winlibs[:] + return options['cpp_winlibs'].value[:] GCC_STANDARD = 0 GCC_OSX = 1 @@ -2071,17 +2063,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): def get_option_link_args(self, options): if self.gcc_type == GCC_MINGW: - # FIXME: This check is needed because we currently pass - # cross-compiler options to the native compiler too and when - # cross-compiling from Windows to Linux, `options` will contain - # Linux-specific options which doesn't include `c_winlibs`. The - # proper fix is to allow cross-info files to specify compiler - # options and to maintain both cross and native compiler options in - # coredata: https://github.com/mesonbuild/meson/issues/1029 - if 'c_winlibs' in options: - return options['c_winlibs'].value[:] - else: - return gnu_winlibs[:] + return options['c_winlibs'].value[:] return [] class GnuCPPCompiler(GnuCompiler, CPPCompiler): @@ -2119,11 +2101,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): def get_option_link_args(self, options): if self.gcc_type == GCC_MINGW: - # FIXME: See GnuCCompiler.get_option_link_args - if 'cpp_winlibs' in options: - return options['cpp_winlibs'].value[:] - else: - return gnu_winlibs[:] + return options['cpp_winlibs'].value[:] return [] def get_compiler_check_args(self): diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index 38945b4..4e87e4e 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -233,7 +233,7 @@ class PkgConfigDependency(Dependency): '(%s)' % out.decode().strip()) PkgConfigDependency.pkgconfig_found = True return - except Exception: + except (FileNotFoundError, PermissionError): pass PkgConfigDependency.pkgconfig_found = False if not self.silent: @@ -358,7 +358,7 @@ class WxDependency(Dependency): self.wxc = wxc WxDependency.wx_found = True return - except Exception: + except (FileNotFoundError, PermissionError): pass WxDependency.wxconfig_found = False mlog.log('Found wx-config:', mlog.red('NO')) @@ -1040,7 +1040,7 @@ class GnuStepDependency(Dependency): gp = subprocess.Popen([confprog, '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) gp.communicate() - except FileNotFoundError: + except (FileNotFoundError, PermissionError): self.args = None mlog.log('Dependency GnuStep found:', mlog.red('NO'), '(no gnustep-config)') return diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index cc62010..098f8ca 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -43,7 +43,8 @@ def detect_ninja(): for n in ['ninja', 'ninja-build']: try: p = subprocess.Popen([n, '--version'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) - except FileNotFoundError: + except (FileNotFoundError, PermissionError): + # Doesn't exist in PATH or isn't executable continue version = p.communicate()[0].decode(errors='ignore') # Perhaps we should add a way for the caller to know the failure mode diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 3b9f975..ef99511 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1762,12 +1762,12 @@ class Interpreter(): raise InvalidCode('Tried to use unknown language "%s".' % lang) comp.sanity_check(self.environment.get_scratch_dir(), self.environment) self.coredata.compilers[lang] = comp + # Native compiler always exist so always add its options. + new_options = comp.get_options() if cross_comp is not None: cross_comp.sanity_check(self.environment.get_scratch_dir(), self.environment) self.coredata.cross_compilers[lang] = cross_comp - new_options = cross_comp.get_options() - else: - new_options = comp.get_options() + new_options.update(cross_comp.get_options()) optprefix = lang + '_' for i in new_options: if not i.startswith(optprefix): diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 57c814c..1d4863c 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -240,7 +240,13 @@ def run(mainfile, args): return 1 if len(args) >= 2 and args[0] == '--internal': if args[1] != 'regenerate': - sys.exit(run_script_command(args[1:])) + script = args[1] + try: + sys.exit(run_script_command(args[1:])) + except MesonException as e: + mlog.log(mlog.red('\nError in {} helper script:'.format(script))) + mlog.log(e) + sys.exit(1) args = args[2:] handshake = True else: diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index e05c641..19ed39a 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -93,9 +93,19 @@ class Resolver: def resolve(self, packagename): fname = os.path.join(self.subdir_root, packagename + '.wrap') dirname = os.path.join(self.subdir_root, packagename) - if os.path.isdir(dirname): - # The directory is there? Great, use it. - return packagename + try: + if os.listdir(dirname): + # The directory is there and not empty? Great, use it. + return packagename + else: + mlog.warning('Subproject directory %s is empty, possibly because of an unfinished' + 'checkout, removing to reclone' % dirname) + os.rmdir(checkoutdir) + except NotADirectoryError: + raise RuntimeError('%s is not a directory, can not use as subproject.' % dirname) + except FileNotFoundError: + pass + if not os.path.isfile(fname): # No wrap file with this name? Give up. return None @@ -118,6 +128,15 @@ class Resolver: revno = p.get('revision') is_there = os.path.isdir(checkoutdir) if is_there: + try: + subprocess.check_call(['git', 'rev-parse']) + is_there = True + except subprocess.CalledProcessError: + raise RuntimeError('%s is not empty but is not a valid ' + 'git repository, we can not work with it' + ' as a subproject directory.' % ( + checkoutdir)) + if revno.lower() == 'head': # Failure to do pull is not a fatal error, # because otherwise you can't develop without @@ -134,6 +153,11 @@ class Resolver: if revno.lower() != 'head': subprocess.check_call(['git', 'checkout', revno], cwd=checkoutdir) + push_url = p.get('push-url') + if push_url: + subprocess.check_call(['git', 'remote', 'set-url', + '--push', 'origin', push_url], + cwd=checkoutdir) def get_hg(self, p): checkoutdir = os.path.join(self.subdir_root, p.get('directory')) revno = p.get('revision') diff --git a/run_unittests.py b/run_unittests.py index fff0c35..39e93c9 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -190,9 +190,16 @@ class LinuxlikeTests(unittest.TestCase): self.run_target('check_exists') def test_qt5dependency_qmake_detection(self): - # Can't be sure that `qmake` is Qt5, so just try qmake-qt5. + # Verify that qmake is for Qt5 if not shutil.which('qmake-qt5'): - raise unittest.SkipTest('qt5 not found') + if not shutil.which('qmake'): + raise unittest.SkipTest('QMake not found') + # For some inexplicable reason qmake --version gives different + # results when run from the command line vs invoked by Python. + # Check for both cases in case this behaviour changes in the future. + output = subprocess.getoutput(['qmake', '--version']) + if 'Qt version 5' not in output and 'qt5' not in output: + raise unittest.SkipTest('Qmake found, but it is not for Qt 5.') # Disable pkg-config codepath and force searching with qmake/qmake-qt5 os.environ['PKG_CONFIG_LIBDIR'] = self.builddir os.environ['PKG_CONFIG_PATH'] = self.builddir @@ -200,8 +207,9 @@ class LinuxlikeTests(unittest.TestCase): self.init(testdir) # Confirm that the dependency was found with qmake msg = 'Qt5 native `qmake-qt5` dependency (modules: Core) found: YES\n' + msg2 = 'Qt5 native `qmake` dependency (modules: Core) found: YES\n' mesonlog = self.get_meson_log() - self.assertTrue(msg in mesonlog) + self.assertTrue(msg in mesonlog or msg2 in mesonlog) if __name__ == '__main__': unittest.main() |