Skip to content

Commit 7d34a08

Browse files
committed
Do not return duplicates binaries #93
Reference: #93 Signed-off-by: Tushar Goel <[email protected]>
1 parent 61ea828 commit 7d34a08

File tree

3 files changed

+9
-404
lines changed

3 files changed

+9
-404
lines changed

src/python_inspector/package_data.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@ def get_pypi_data_from_purl(
6767
# if prefer_source is True then only source distribution is used
6868
# in case of no source distribution available then wheel is used
6969
if not valid_distribution_urls or not prefer_source:
70-
valid_distribution_urls.extend(
71-
list(
72-
get_wheel_download_urls(
73-
purl=purl,
74-
repos=repos,
75-
environment=environment,
76-
python_version=python_version,
77-
)
70+
wheel_urls = list(
71+
get_wheel_download_urls(
72+
purl=purl,
73+
repos=repos,
74+
environment=environment,
75+
python_version=python_version,
7876
)
7977
)
78+
wheel_urls.sort(reverse=True)
79+
if len(wheel_urls) > 0:
80+
valid_distribution_urls.append(wheel_urls[0])
8081

8182
urls = response.get("urls") or []
8283
for url in urls:

tests/data/frozen-requirements.txt-expected.json

-262
Large diffs are not rendered by default.

tests/data/test-api-with-requirement-file.json

-134
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)