diff options
-rw-r--r-- | mesonbuild/compilers.py | 30 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 6 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 30 | ||||
-rwxr-xr-x | run_unittests.py | 14 |
4 files changed, 45 insertions, 35 deletions
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/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/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() |