Skip to content

Commit

Permalink
BUG fix usage of channel data
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Jun 1, 2024
1 parent 5474c13 commit 93912a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 5 additions & 5 deletions conda_forge_feedstock_check_solvable/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,21 +329,21 @@ def _get_run_exports_from_run_exports_json(channel_url, subdir, filename):
def _has_run_exports_in_channel_data(channel_url, filename):
cd = _download_channeldata(channel_url)
name_ver, _ = filename.rsplit("-", 1)
name, _ = name_ver.rsplit("-", 1)
name, ver = name_ver.rsplit("-", 1)

if "packages" not in cd:
return True

if "name" not in cd["packages"]:
if name not in cd["packages"]:
return True

if "run_exports" not in cd["packages"][name]:
return True

if cd["packages"][name]["run_exports"]:
return True
else:
if ver not in cd["packages"][name]["run_exports"]:
return False
else:
return True


def _get_run_exports_from_artifact_info(channel, subdir, filename):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
_get_run_exports_from_artifact_info,
_get_run_exports_from_download,
_get_run_exports_from_run_exports_json,
_has_run_exports_in_channel_data,
convert_spec_to_conda_build,
get_run_exports,
)
Expand Down Expand Up @@ -51,6 +52,15 @@ def test_convert_spec_to_conda_build(inreq, outreq):
],
)
def test_utils_get_run_exports(full_channel_url, filename, expected):
if expected == DEFAULT_RUN_EXPORTS:
assert not _has_run_exports_in_channel_data(
full_channel_url.rsplit("/", 1)[0], filename
)
else:
assert _has_run_exports_in_channel_data(
full_channel_url.rsplit("/", 1)[0], filename
)

assert get_run_exports(full_channel_url, filename) == expected

assert (
Expand Down

0 comments on commit 93912a6

Please sign in to comment.