Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when conda_exe cannot be identified #743

Merged
merged 5 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions constructor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,16 @@ def main_build(dir_path, output_dir='.', platform=cc_platform,
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 / micromamba 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
2 changes: 1 addition & 1 deletion news/474-menuinst-v2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Enhancements

* Add support for `menuinst` v2, which extends shortcut (menu items) creation from Windows to Linux and macOS. See [`menuinst` documentation](https://conda.github.io/menuinst/) for more information. Note that this feature requires `conda-standalone 23.11.0` or later. `micromamba` doesn't support v2-style menu items yet. (#474)
* Add support for `menuinst` v2, which extends shortcut (menu items) creation from Windows to Linux and macOS. See [`menuinst` documentation](https://conda.github.io/menuinst/) for more information. Note that this feature requires `conda-standalone 23.11.0` or later. `micromamba` doesn't support v2-style menu items yet. (#474, #743)

### Bug fixes

Expand Down
29 changes: 29 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,29 @@ 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")
tmp_env = tmp_path / "env"
subprocess.check_call(
[
sys.executable,
"-mconda",
"create",
"-p",
tmp_env,
"-y",
"micromamba",
"--platform",
"osx-arm64",
],
)
micromamba_arm64 = tmp_env / "bin" / "micromamba"
create_installer(
input_path,
tmp_path,
conda_exe=micromamba_arm64,
extra_constructor_args=["--platform", "osx-arm64"],
)