From 3419a5016faaa7361d8f85072f77d8b4854e0560 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 8 Nov 2024 13:20:37 +0100 Subject: [PATCH] do not test __osx and __glibc twice --- constructor/osxpkg.py | 4 +++- constructor/shar.py | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/constructor/osxpkg.py b/constructor/osxpkg.py index a2280adf2..388f85422 100644 --- a/constructor/osxpkg.py +++ b/constructor/osxpkg.py @@ -330,6 +330,8 @@ def move_script(src, dst, info, ensure_shebang=False, user_script_type=None): path_exists_error_text = info.get( "install_path_exists_error_text", default_path_exists_error_text ).format(CHOSEN_PATH=f"$2/{pkg_name_lower}") + # __osx is tested by the PKG metadata directly, no need to repeat + virtual_specs = [spec for spec in info.get("virtual_specs", ()) if "__osx" not in spec] replace = { 'NAME': info['name'], 'NAME_LOWER': pkg_name_lower, @@ -344,7 +346,7 @@ def move_script(src, dst, info, ensure_shebang=False, user_script_type=None): 'SHORTCUTS': shortcuts_flags(info), 'ENABLE_SHORTCUTS': str(info['_enable_shortcuts']).lower(), 'REGISTER_ENVS': str(info.get("register_envs", True)).lower(), - 'VIRTUAL_SPECS': shlex.join(info.get("virtual_specs", ())), + 'VIRTUAL_SPECS': shlex.join(virtual_specs), } data = preprocess(data, ppd) custom_variables = info.get('script_env_variables', {}) diff --git a/constructor/shar.py b/constructor/shar.py index 7e5a5157e..ee03ad40e 100644 --- a/constructor/shar.py +++ b/constructor/shar.py @@ -75,6 +75,12 @@ def get_header(conda_exec, tarball, info): ppd['enable_shortcuts'] = str(info['_enable_shortcuts']).lower() ppd['check_path_spaces'] = info.get("check_path_spaces", True) install_lines = list(add_condarc(info)) + # Omit __osx and __glibc because those are tested with shell code direcly + virtual_specs = [ + spec + for spec in info.get("virtual_specs", ()) + if "__osx" not in spec and "__glibc" not in spec + ] # Needs to happen first -- can be templated replace = { 'CONSTRUCTOR_VERSION': info['CONSTRUCTOR_VERSION'], @@ -94,7 +100,7 @@ def get_header(conda_exec, tarball, info): 'SHORTCUTS': shortcuts_flags(info), 'REGISTER_ENVS': str(info.get("register_envs", True)).lower(), 'TOTAL_INSTALLATION_SIZE_KB': str(approx_size_kb(info, "total")), - 'VIRTUAL_SPECS': shlex.join(info.get("virtual_specs", ())) + 'VIRTUAL_SPECS': shlex.join(virtual_specs) } if has_license: replace['LICENSE'] = read_ascii_only(info['license_file'])