diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-06-16 18:54:52 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-06-16 18:56:16 +0530 |
commit | c631cac04c59f6ce741ddcf32754fb260042ffec (patch) | |
tree | d82dfda7472a9da70ce142dcf4a583ee2310a365 | |
parent | f7eef79c0dd8adf74f79a85ca814f07c9beb4e29 (diff) | |
download | meson-c631cac04c59f6ce741ddcf32754fb260042ffec.zip meson-c631cac04c59f6ce741ddcf32754fb260042ffec.tar.gz meson-c631cac04c59f6ce741ddcf32754fb260042ffec.tar.bz2 |
tests: Fix 103 manygen when both cl and gcc are available
Meson uses the 'CC' environment variable, so manygen.py should too
-rwxr-xr-x | test cases/common/103 manygen/subdir/manygen.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test cases/common/103 manygen/subdir/manygen.py b/test cases/common/103 manygen/subdir/manygen.py index 3c692ee..4411183 100755 --- a/test cases/common/103 manygen/subdir/manygen.py +++ b/test cases/common/103 manygen/subdir/manygen.py @@ -13,7 +13,15 @@ if not os.path.isdir(outdir): print('Outdir does not exist.') sys.exit(1) -if shutil.which('cl'): +# Emulate the environment.detect_c_compiler() logic +compiler = os.environ.get('CC', None) +if not compiler: + compiler = shutil.which('cl') or \ + shutil.which('gcc') or \ + shutil.which('clang') or \ + shutil.which('cc') + +if 'cl' in os.path.basename(compiler): libsuffix = '.lib' is_vs = True compiler = 'cl' @@ -22,11 +30,6 @@ else: libsuffix = '.a' is_vs = False linker = 'ar' - compiler = shutil.which('gcc') - if compiler is None: - compiler = shutil.which('clang') - if compiler is None: - compiler = shutil.which('cc') if compiler is None: print('No known compilers found.') sys.exit(1) |