From b20cfec4bc9f540cb19e86c97014776be0197eff Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 6 Jul 2021 15:09:09 +0100 Subject: 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. --- run_project_tests.py | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'run_project_tests.py') 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: -- cgit v1.1