Skip to content

Commit

Permalink
Fix some issues with virtual_specs (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp authored Nov 11, 2024
1 parent 77f5155 commit f8cc8d1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
3 changes: 2 additions & 1 deletion constructor/osx/prepare_installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ touch "$PREFIX/conda-meta/history"
# but we haven't created $PREFIX/pkgs yet... do it in a temporary location
# shellcheck disable=SC2050
if [ "__VIRTUAL_SPECS__" != "" ]; then
notify 'Checking virtual specs compatibility: __VIRTUAL_SPECS__'
notify "Checking virtual specs compatibility: __VIRTUAL_SPECS__"
CONDA_SOLVER="classic" \
CONDA_PKGS_DIRS="$(mktemp -d)" \
SYSTEM_VERSION_COMPAT=0 \
"$CONDA_EXEC" create --dry-run --prefix "$PREFIX/envs/_virtual_specs_checks" --offline __VIRTUAL_SPECS__ __NO_RCS_ARG__
fi

Expand Down
4 changes: 3 additions & 1 deletion constructor/osxpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
'NO_RCS_ARG': info.get('_ignore_condarcs_arg', ''),
}
data = preprocess(data, ppd)
Expand Down
8 changes: 7 additions & 1 deletion constructor/shar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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),
'NO_RCS_ARG': info.get('_ignore_condarcs_arg', ''),
}
if has_license:
Expand Down
19 changes: 19 additions & 0 deletions news/887-vspecs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Do not run conda-based virtual specs tests for `__glibc` and `__osx`. These are already tested by the installation script in an earlier step. (#868 via #887)

### Bug fixes

* Address quoting issue that created unneeded files in installation directory. (#865 via #887)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>

0 comments on commit f8cc8d1

Please sign in to comment.