Skip to content

Commit

Permalink
only warn when conda_exe cannot be identified
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Jan 7, 2024
1 parent 764ba8a commit 4f1c3e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
14 changes: 11 additions & 3 deletions constructor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,17 @@ def main_build(dir_path, output_dir='.', platform=cc_platform,
env_config[config_key] = [val.strip() for val in value]
if config_key == "environment_file":
env_config[config_key] = abspath(join(dir_path, value))

exe_name, exe_version = identify_conda_exe(info.get("_conda_exe"))
if sys.platform != "win32" and (

try:
exe_name, exe_version = identify_conda_exe(info.get("_conda_exe"))
except OSError as exc:
logger.warning(
"Could not identify conda-standalone version (%s). "
"Will assume it is compatible with shortcuts.",
exc,
)
exe_name, exe_version = None, None
if sys.platform != "win32" and exe_name is not None and (
exe_name == "micromamba" or Version(exe_version) < Version("23.11.0")
):
logger.warning("conda-standalone 23.11.0 or above is required for shortcuts on Unix.")
Expand Down
9 changes: 9 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def create_installer(
debug=CONSTRUCTOR_DEBUG,
with_spaces=False,
timeout=420,
extra_constructor_args: Iterable[str] = None,
**env_vars,
) -> Tuple[Path, Path]:
if sys.platform.startswith("win") and conda_exe and _is_micromamba(conda_exe):
Expand All @@ -268,6 +269,8 @@ def create_installer(
cmd.extend(["--conda-exe", conda_exe])
if debug:
cmd.append("--debug")
if extra_constructor_args:
cmd.extend(extra_constructor_args)

_execute(cmd, timeout=timeout, **env_vars)

Expand Down Expand Up @@ -519,3 +522,9 @@ def test_register_envs(tmp_path, request):
_run_installer(input_path, installer, install_dir, request=request)
environments_txt = Path("~/.conda/environments.txt").expanduser().read_text()
assert str(install_dir) not in environments_txt


@pytest.mark.skipif(sys.platform != "darwin", reason="macOS only")
def test_cross_osx_building(tmp_path):
input_path = _example_path("noconda")
create_installer(input_path, tmp_path, extra_constructor_args=["--platform", "osx-arm64"])

0 comments on commit 4f1c3e1

Please sign in to comment.