Skip to content

Commit

Permalink
Do not yield osx virtual package when CONDA_OVERRIDE_OSX="" (conda#12715
Browse files Browse the repository at this point in the history
)

* Do not yield osx virtual package when CONDA_OVERRIDE_OSX=""

* Add changelog

* adding newline

* Trigger CI

---------

Co-authored-by: Travis Hathaway <[email protected]>
  • Loading branch information
lesteve and travishathaway authored May 30, 2023
1 parent 2e48858 commit f83014e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion conda/plugins/virtual_packages/osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ def conda_virtual_packages():

_, dist_version = context.os_distribution_name_version
dist_version = os.environ.get("CONDA_OVERRIDE_OSX", dist_version)
yield CondaVirtualPackage("osx", dist_version, None)
if dist_version:
yield CondaVirtualPackage("osx", dist_version, None)
19 changes: 19 additions & 0 deletions news/12715-osx-virtual-package
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Don't export `__osx` virtual package when `CONDA_OVERRIDE_OSX=""` (#12715)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
19 changes: 19 additions & 0 deletions tests/plugins/test_virtual_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,22 @@ def test_glibc_override():
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)


def test_osx_override():
"""Conda should not produce a osx virtual package when CONDA_OVERRIDE_OSX=""."""
for version in "", "1.0":
with env_vars(
{"CONDA_SUBDIR": "osx-64", "CONDA_OVERRIDE_OSX": 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 == "@"]
osx_exported = any("osx" in p.name for p in virtual)
assert osx_exported == bool(version)

0 comments on commit f83014e

Please sign in to comment.