Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ v0.9.2
------

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


v0.9.1
Expand Down
26 changes: 18 additions & 8 deletions src/python_inspector/package_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ def get_pypi_data_from_purl(
# if prefer_source is True then only source distribution is used
# in case of no source distribution available then wheel is used
if not valid_distribution_urls or not prefer_source:
valid_distribution_urls.extend(
list(
get_wheel_download_urls(
purl=purl,
repos=repos,
environment=environment,
python_version=python_version,
)
wheel_urls = list(
get_wheel_download_urls(
purl=purl,
repos=repos,
environment=environment,
python_version=python_version,
)
)
wheel_url = choose_single_wheel(wheel_urls)
if wheel_url:
valid_distribution_urls.append(wheel_url)

urls = response.get("urls") or []
for url in urls:
Expand Down Expand Up @@ -110,6 +111,15 @@ def get_pypi_data_from_purl(
)


def choose_single_wheel(wheel_urls):
"""
Sort wheel urls descendingly and return the first one
"""
wheel_urls.sort(reverse=True)
if wheel_urls:
return wheel_urls[0]


def get_pypi_bugtracker_url(project_urls):
bug_tracking_url = project_urls.get("Tracker")
if not (bug_tracking_url):
Expand Down
2 changes: 1 addition & 1 deletion src/python_inspector/resolve_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

TRACE = False

__version__ = "0.9.1"
__version__ = "0.9.2"

DEFAULT_PYTHON_VERSION = "38"
PYPI_SIMPLE_URL = "https://pypi.org/simple"
Expand Down
2 changes: 1 addition & 1 deletion tests/data/azure-devops.req-310-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/azure-devops.req-38-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/default-url-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--specifier zipp==3.8.0",
"--index-url https://pypi.org/simple",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/environment-marker-test-requirements.txt",
"--index-url https://pypi.org/simple",
Expand Down
264 changes: 1 addition & 263 deletions tests/data/frozen-requirements.txt-expected.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/insecure-setup-2/setup.py-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--index-url https://pypi.org/simple",
"--python-version 27",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/insecure-setup/setup.py-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--index-url https://pypi.org/simple",
"--python-version 27",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/pdt-requirements.txt-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/pdt-requirements.txt",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/pinned-pdt-requirements.txt-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/pinned-pdt-requirements.txt",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/pinned-requirements.txt-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/pinned-requirements.txt",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/prefer-source-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--specifier zipp==3.8.0",
"--index-url https://pypi.org/simple",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--index-url https://pypi.org/simple",
"--python-version 27",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/setup/simple-setup.py-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--index-url https://pypi.org/simple",
"--python-version 27",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/setup/spdx-setup.py-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--index-url https://pypi.org/simple",
"--python-version 27",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/single-url-except-simple-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--specifier flask",
"--index-url https://thirdparty.aboutcode.org/pypi/simple/",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/single-url-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--specifier zipp==3.8.0",
"--index-url https://pypi.org/simple",
Expand Down
134 changes: 0 additions & 134 deletions tests/data/test-api-with-requirement-file.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/tilde_req-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.9.1",
"tool_version": "0.9.2",
"options": [
"--specifier zipp~=3.8.0",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def test_passing_of_json_pdt_and_json_flags():
def test_version_option():
options = ["--version"]
result = run_cli(options=options)
assert "0.9.1" in result.output
assert "0.9.2" in result.output


def test_passing_of_netrc_file_that_does_not_exist():
Expand Down