diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2021-07-06 15:09:09 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-07-07 20:08:12 +0200 |
commit | b20cfec4bc9f540cb19e86c97014776be0197eff (patch) | |
tree | c5419dbaae3c57f07f02b085761167f8d41084d1 | |
parent | 609864a66ddc6af559fadadd76a266d64ae9991e (diff) | |
download | meson-b20cfec4bc9f540cb19e86c97014776be0197eff.zip meson-b20cfec4bc9f540cb19e86c97014776be0197eff.tar.gz meson-b20cfec4bc9f540cb19e86c97014776be0197eff.tar.bz2 |
Use None as Environment object build_dir in detect_system_compiler()
The Environment object constructor accepts None as build_dir (for quite
a while now), so don't bother with creating a temporary directory for
use as the build_dir, if we're not going to need it.
Future work: Environment.__init__() sets scratch_dir to '' if build_dir
is None, which seems a little wonky, as it isn't a path.
-rwxr-xr-x | run_project_tests.py | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index 833bf7e..57a8188 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -1386,33 +1386,32 @@ def check_meson_commands_work(use_tmpdir: bool, extra_args: T.List[str]) -> None def detect_system_compiler(options: 'CompilerArgumentType') -> None: global host_c_compiler, compiler_id_map - with TemporaryDirectoryWinProof(prefix='b ', dir=None if options.use_tmpdir else '.') as build_dir: - fake_opts = get_fake_options('/') - if options.cross_file: - fake_opts.cross_file = [options.cross_file] - if options.native_file: - fake_opts.native_file = [options.native_file] + fake_opts = get_fake_options('/') + if options.cross_file: + fake_opts.cross_file = [options.cross_file] + if options.native_file: + fake_opts.native_file = [options.native_file] - env = environment.Environment(None, build_dir, fake_opts) + env = environment.Environment(None, None, fake_opts) - print_compilers(env, MachineChoice.HOST) - if options.cross_file: - print_compilers(env, MachineChoice.BUILD) + print_compilers(env, MachineChoice.HOST) + if options.cross_file: + print_compilers(env, MachineChoice.BUILD) - for lang in sorted(compilers.all_languages): - try: - comp = compiler_from_language(env, lang, MachineChoice.HOST) - # note compiler id for later use with test.json matrix - compiler_id_map[lang] = comp.get_id() - except mesonlib.MesonException: - comp = None - - # note C compiler for later use by platform_fix_name() - if lang == 'c': - if comp: - host_c_compiler = comp.get_id() - else: - raise RuntimeError("Could not find C compiler.") + for lang in sorted(compilers.all_languages): + try: + comp = compiler_from_language(env, lang, MachineChoice.HOST) + # note compiler id for later use with test.json matrix + compiler_id_map[lang] = comp.get_id() + except mesonlib.MesonException: + comp = None + + # note C compiler for later use by platform_fix_name() + if lang == 'c': + if comp: + host_c_compiler = comp.get_id() + else: + raise RuntimeError("Could not find C compiler.") def print_compilers(env: 'Environment', machine: MachineChoice) -> None: |