From 9d559b2b39d4ba084ad479bfb3100b62c13c7d61 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Tue, 25 Aug 2015 23:09:54 +0300 Subject: [PATCH] More robust windows detection and more logs. --- meson.py | 3 +++ meson_test.py | 4 ++-- mesonlib.py | 3 ++- run_tests.py | 8 ++++---- symbolextractor.py | 7 ++++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/meson.py b/meson.py index 01a46fcf8..db4560984 100755 --- a/meson.py +++ b/meson.py @@ -19,6 +19,7 @@ import datetime import os.path import environment, interpreter, mesonlib import build +import platform import mlog, coredata from coredata import MesonException @@ -118,6 +119,8 @@ itself as required.''' env = environment.Environment(self.source_dir, self.build_dir, self.meson_script_file, self.options) mlog.initialize(env.get_log_dir()) mlog.debug('Build started at', datetime.datetime.now().isoformat()) + mlog.debug('Python binary:', sys.executable) + mlog.debug('Python system:', platform.system()) mlog.log(mlog.bold('The Meson build system')) mlog.log('Version:', coredata.version) mlog.log('Source dir:', mlog.bold(self.source_dir)) diff --git a/meson_test.py b/meson_test.py index 4273e9b78..9353b1841 100755 --- a/meson_test.py +++ b/meson_test.py @@ -17,7 +17,7 @@ import sys, os, subprocess, time, datetime, pickle, multiprocessing, json import concurrent.futures as conc import argparse -import platform +import mesonlib tests_failed = False @@ -62,7 +62,7 @@ def write_json_log(jsonlogfile, test_name, result): jsonlogfile.write(json.dumps(result) + '\n') def run_with_mono(fname): - if fname.endswith('.exe') and not platform.system().lower() == 'windows': + if fname.endswith('.exe') and not mesonlib.is_windows(): return True return False diff --git a/mesonlib.py b/mesonlib.py index c7cf20817..76fb792fa 100644 --- a/mesonlib.py +++ b/mesonlib.py @@ -76,7 +76,8 @@ def is_linux(): return platform.system().lower() == 'linux' def is_windows(): - return platform.system().lower() == 'windows' + platname = platform.system().lower() + return platname == 'windows' or 'mingw' in platname def is_debianlike(): try: diff --git a/run_tests.py b/run_tests.py index 673c55b70..7d5f92f47 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, signal +import os, subprocess, shutil, sys, signal from io import StringIO import sys import environment @@ -91,11 +91,11 @@ def setup_commands(backend): install_commands = [ninja_command, 'install'] def platform_fix_filename(fname): - if platform.system() == 'Darwin': + if mesonlib.is_osx(): if fname.endswith('.so'): return fname[:-2] + 'dylib' return fname.replace('.so.', '.dylib.') - elif platform.system() == 'Windows': + elif mesonlib.is_windows(): if fname.endswith('.so'): (p, f) = os.path.split(fname) f = f[3:-2] + 'dll' @@ -105,7 +105,7 @@ def platform_fix_filename(fname): return fname def validate_install(srcdir, installdir): - if platform.system() == 'Windows': + if mesonlib.is_windows(): # Don't really know how Windows installs should work # so skip. return '' diff --git a/symbolextractor.py b/symbolextractor.py index b184cff7d..f2c709dfe 100755 --- a/symbolextractor.py +++ b/symbolextractor.py @@ -22,7 +22,8 @@ # This file is basically a reimplementation of # http://cgit.freedesktop.org/libreoffice/core/commit/?id=3213cd54b76bc80a6f0516aac75a48ff3b2ad67c -import sys, subprocess, platform +import sys, subprocess +import mesonlib import argparse parser = argparse.ArgumentParser() @@ -84,9 +85,9 @@ def gen_symbols(libfilename, outfilename, cross_host): # toolset but there are more important things # to do. dummy_syms(outfilename) - elif platform.system() == 'Linux': + elif mesonlib.is_linux(): linux_syms(libfilename, outfilename) - elif platform.system() == 'Darwin': + elif mesonlib.is_osx(): osx_syms(libfilename, outfilename) else: dummy_syms(outfilename)