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

Make sure the solver sees the correct subdir #5350

Merged
merged 8 commits into from
Jun 4, 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
8 changes: 7 additions & 1 deletion conda_build/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,8 @@ def get_install_actions(
with utils.LoggingContext(conda_log_level):
with capture():
try:
precs = _install_actions(prefix, index, specs)["LINK"]
_actions = _install_actions(prefix, index, specs, subdir=subdir)
precs = _actions["LINK"]
except (NoPackagesFoundError, UnsatisfiableError) as exc:
raise DependencyNeedsBuildingError(exc, subdir=subdir)
except (
Expand Down Expand Up @@ -1256,14 +1257,19 @@ def install_actions(
prefix: str | os.PathLike | Path,
index,
specs: Iterable[str | MatchSpec],
subdir: str | None = None,
) -> InstallActionsType:
# This is copied over from https://github.com/conda/conda/blob/23.11.0/conda/plan.py#L471
# but reduced to only the functionality actually used within conda-build.
subdir_kwargs = {}
if subdir not in (None, "", "noarch"):
subdir_kwargs["CONDA_SUBDIR"] = subdir

with env_vars(
{
"CONDA_ALLOW_NON_CHANNEL_URLS": "true",
"CONDA_SOLVER_IGNORE_TIMESTAMPS": "false",
**subdir_kwargs,
},
callback=reset_context,
):
Expand Down
19 changes: 19 additions & 0 deletions news/5350-subdir-cross
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Ensure cross-building recipes select the correct noarch package variants. (#5341 via #5350)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target_platform:
- win-64
18 changes: 18 additions & 0 deletions tests/test-recipes/metadata/_cross_unix_windows_mingw/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package:
name: foo
version: 0.0.1

build:
number: 0
script:
- echo 'hello'
- ls $PREFIX
# this is the unix layout.
- test ! -d $PREFIX/x86_64-w64-mingw32
- test -d $PREFIX/Library

requirements:
build:
host:
- m2w64-sysroot_win-64
run:
9 changes: 9 additions & 0 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,15 @@ def test_add_pip_as_python_dependency_from_condarc_file(
api.build(testing_metadata)


@pytest.mark.skipif(on_win, reason="Tests cross-compilation targeting Windows")
def test_cross_unix_windows_mingw(testing_config):
recipe = os.path.join(metadata_dir, "_cross_unix_windows_mingw")
testing_config.channel_urls = [
"conda-forge",
]
api.build(recipe, config=testing_config)


@pytest.mark.parametrize(
"recipe", sorted(Path(metadata_dir, "_build_script_errors").glob("*"))
)
Expand Down