Skip to content

Commit

Permalink
pre-initialize _enable_shortcuts based on configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl authored Dec 20, 2024
1 parent f60260c commit c51d488
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions constructor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,26 +187,27 @@ def main_build(dir_path, output_dir='.', platform=cc_platform,
else:
env_config[config_key] = value

if exe_type is None or exe_version is None:
logger.warning(
"Could not identify conda-standalone / micromamba version. "
"Will assume it is compatible with shortcuts."
# Installers will provide shortcut options and features only if the user
# didn't opt-out by setting every `menu_packages` item to an empty list
info['_enable_shortcuts'] = bool(
info.get("menu_packages", True)
or any(
env.get("menu_packages", True)
for env in info.get("extra_envs", {}).values()
)
elif sys.platform != "win32" and (
exe_type != StandaloneExe.CONDA or (exe_version and exe_version < Version("23.11.0"))
):
logger.warning("conda-standalone 23.11.0 or above is required for shortcuts on Unix.")
info['_enable_shortcuts'] = "incompatible"
else:
# Installers will provide shortcut options and features only if the user
# didn't opt-out by setting every `menu_packages` item to an empty list
info['_enable_shortcuts'] = bool(
info.get("menu_packages", True)
or any(
env.get("menu_packages", True)
for env in info.get("extra_envs", {}).values()
)

if info['_enable_shortcuts']:
if exe_type is None or exe_version is None:
logger.warning(
"Could not identify conda-standalone / micromamba version. "
"Will assume it is compatible with shortcuts."
)
)
elif sys.platform != "win32" and (
exe_type != StandaloneExe.CONDA or (exe_version and exe_version < Version("23.11.0"))
):
logger.warning("conda-standalone 23.11.0 or above is required for shortcuts on Unix.")
info['_enable_shortcuts'] = "incompatible"

# Add --no-rc option to CONDA_EXE command so that existing
# .condarc files do not pollute the installation process.
Expand Down

0 comments on commit c51d488

Please sign in to comment.