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

yield libc virtual package only if libc_version is truthy #12293

Merged
merged 2 commits into from
Jan 30, 2023
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
3 changes: 2 additions & 1 deletion conda/plugins/virtual_packages/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ def conda_virtual_packages():
# Default to glibc when using CONDA_SUBDIR var
libc_family = "glibc"
libc_version = os.getenv(f"CONDA_OVERRIDE_{libc_family.upper()}", libc_version)
yield CondaVirtualPackage(libc_family, libc_version, None)
if libc_version:
yield CondaVirtualPackage(libc_family, libc_version, None)
19 changes: 19 additions & 0 deletions news/12267-conda-override-glibc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Don't export `__glibc` virtual package when `CONDA_OVERRIDE_GLIBC=""` (#12267)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
21 changes: 21 additions & 0 deletions tests/plugins/test_virtual_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,24 @@ def test_subdir_override():
assert not any(
(p.name in platform_virtual_packages and p.name != expected) for p in virtual
)


def test_glibc_override():
"""
Conda should not produce a libc virtual package when CONDA_OVERRIDE_GLIBC=""
"""
for version in "", "1.0":
with env_vars(
{"CONDA_SUBDIR": "linux-64", "CONDA_OVERRIDE_GLIBC": version},
stack_callback=conda_tests_ctxt_mgmt_def_pol,
):
packages = conda.core.index.get_reduced_index(
context.default_prefix,
context.default_channels,
context.subdirs,
(),
context.repodata_fns[0],
)
virtual = [p for p in packages if p.channel.name == "@"]
libc_exported = any("libc" in p.name for p in virtual)
assert libc_exported == bool(version)