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

Update repodata handling approaches #676

Merged
merged 5 commits into from
May 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
26 changes: 12 additions & 14 deletions constructor/conda_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,24 @@
pass

def get_repodata(url):
if CONDA_MAJOR_MINOR >= (4, 5):
if CONDA_MAJOR_MINOR >= (23, 5):
from conda.core.subdir_data import SubdirData as _SubdirData
from conda.models.channel import Channel
subdir_data = _SubdirData(Channel(url))
raw_repodata_str, _ = subdir_data.repo_fetch.fetch_latest()
else:
# Backwards compatibility: for conda 4.6+
from conda.core.subdir_data import fetch_repodata_remote_request
raw_repodata_str = fetch_repodata_remote_request(url, None, None)
elif CONDA_MAJOR_MINOR >= (4, 4):
from conda.core.repodata import fetch_repodata_remote_request
raw_repodata_str = fetch_repodata_remote_request(url, None, None)
elif CONDA_MAJOR_MINOR >= (4, 3):
from conda.core.repodata import fetch_repodata_remote_request
repodata_obj = fetch_repodata_remote_request(None, url, None, None)
raw_repodata_str = json.dumps(repodata_obj)
else:
raise NotImplementedError("unsupported version of conda: %s" % CONDA_INTERFACE_VERSION)

# noarch-only repos are valid. In this case, the architecture specific channel will
# return None
if raw_repodata_str is None:
# noarch-only repos are valid. if the native subdir is not present,
# we might get an empty repodata back. In that case, we need to add the minimal
# info to make it valid for the rest of constructor.
if not raw_repodata_str or raw_repodata_str == r'{}':
full_repodata = {
'_url': url,
'info': {
'subdir': cc_platform
'subdir': url.rstrip('/').split('/')[-1]
},
'packages': {},
'packages.conda': {},
Expand Down
19 changes: 19 additions & 0 deletions news/676-new-repodata-interface
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Add compatibility for the new repodata interface in conda 23.5. (#676)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>