Skip to content

Commit 27fe710

Browse files
authored
Merge pull request #96 from nexB/single_binary
Do not return duplicates binaries #93
2 parents 61ea828 + 437df9e commit 27fe710

22 files changed

+38
-423
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ v0.9.2
66
------
77

88
- Make os and python version as mandatory input parameters.
9+
- Do not return duplicates binaries.
910

1011

1112
v0.9.1

src/python_inspector/package_data.py

Lines changed: 18 additions & 8 deletions
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_url = choose_single_wheel(wheel_urls)
79+
if wheel_url:
80+
valid_distribution_urls.append(wheel_url)
8081

8182
urls = response.get("urls") or []
8283
for url in urls:
@@ -110,6 +111,15 @@ def get_pypi_data_from_purl(
110111
)
111112

112113

114+
def choose_single_wheel(wheel_urls):
115+
"""
116+
Sort wheel urls descendingly and return the first one
117+
"""
118+
wheel_urls.sort(reverse=True)
119+
if wheel_urls:
120+
return wheel_urls[0]
121+
122+
113123
def get_pypi_bugtracker_url(project_urls):
114124
bug_tracking_url = project_urls.get("Tracker")
115125
if not (bug_tracking_url):

src/python_inspector/resolve_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
TRACE = False
2222

23-
__version__ = "0.9.1"
23+
__version__ = "0.9.2"
2424

2525
DEFAULT_PYTHON_VERSION = "38"
2626
PYPI_SIMPLE_URL = "https://pypi.org/simple"

tests/data/azure-devops.req-310-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.1",
5+
"tool_version": "0.9.2",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
88
"--index-url https://pypi.org/simple",

tests/data/azure-devops.req-38-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.1",
5+
"tool_version": "0.9.2",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
88
"--index-url https://pypi.org/simple",

tests/data/default-url-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.1",
5+
"tool_version": "0.9.2",
66
"options": [
77
"--specifier zipp==3.8.0",
88
"--index-url https://pypi.org/simple",

tests/data/environment-marker-test-requirements.txt-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.1",
5+
"tool_version": "0.9.2",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/environment-marker-test-requirements.txt",
88
"--index-url https://pypi.org/simple",

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

Lines changed: 1 addition & 263 deletions
Large diffs are not rendered by default.

tests/data/insecure-setup-2/setup.py-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.1",
5+
"tool_version": "0.9.2",
66
"options": [
77
"--index-url https://pypi.org/simple",
88
"--python-version 27",

tests/data/insecure-setup/setup.py-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.1",
5+
"tool_version": "0.9.2",
66
"options": [
77
"--index-url https://pypi.org/simple",
88
"--python-version 27",

0 commit comments

Comments
 (0)