Skip to content

Commit

Permalink
yield libc virtual package only if libc_version is truthy (conda#12293)
Browse files Browse the repository at this point in the history
* yield libc virtual package only if libc_version is truthy

* test glibc override
  • Loading branch information
dholth authored Jan 30, 2023
1 parent bc65885 commit d2d1208
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
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)

0 comments on commit d2d1208

Please sign in to comment.