MCPcopy Create free account
hub / github.com/conda/constructor / get_repodata

Function get_repodata

constructor/conda_interface.py:109–139  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

107 pass
108
109 def get_repodata(url):
110 if CONDA_MAJOR_MINOR >= (23, 5):
111 from conda.core.subdir_data import SubdirData as _SubdirData
112 from conda.models.channel import Channel
113
114 subdir_data = _SubdirData(Channel(url))
115 raw_repodata_str, _ = subdir_data.repo_fetch.fetch_latest()
116 else:
117 # Backwards compatibility: for conda 4.6+
118 from conda.core.subdir_data import fetch_repodata_remote_request
119
120 raw_repodata_str = fetch_repodata_remote_request(url, None, None)
121
122 # noarch-only repos are valid. if the native subdir is not present,
123 # we might get an empty repodata back. In that case, we need to add the minimal
124 # info to make it valid for the rest of constructor.
125 if not raw_repodata_str or raw_repodata_str == r"{}":
126 full_repodata = {
127 "_url": url,
128 "info": {"subdir": url.rstrip("/").split("/")[-1]},
129 "packages": {},
130 "packages.conda": {},
131 "removed": [],
132 }
133 elif isinstance(raw_repodata_str, dict):
134 # conda 26.x+ may return an already-parsed dict from fetch_latest()
135 full_repodata = raw_repodata_str
136 else:
137 full_repodata = json.loads(raw_repodata_str)
138
139 return full_repodata
140
141 def write_repodata(cache_dir, url, full_repodata, used_packages, info):
142 used_repodata = {

Callers 1

write_index_cacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected