Skip to content

Commit f2b19f9

Browse files
authored
Merge pull request #115 from nexB/release/v0.9.4
Prepare for release v0.9.4
2 parents 24c71b3 + 283ac89 commit f2b19f9

23 files changed

+88
-82
lines changed

Diff for: CHANGELOG.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
Changelog
22
=========
33

4-
next-version
5-
------------
4+
5+
v0.9.4
6+
------
67

78
- Create PyPI cache location in the home directory if a cache directory cannot be made at the project root.
9+
- Replace packaging with packvers.
10+
- Prevent duplicated package versions.
811

912

1013
v0.9.3

Diff for: requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ commoncode==30.2.0
88
dparse2==0.7.0
99
idna==3.3
1010
importlib-metadata==4.12.0
11-
intbitset==3.0.1
11+
intbitset==3.0.2
1212
packageurl-python==0.10.0
1313
packaging==21.3
1414
packvers==21.5

Diff for: src/python_inspector/dependencies.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def get_extra_data_from_requirements(requirements_file="requirements.txt"):
5050
yield package_data.extra_data
5151

5252

53+
def is_requirement_pinned(requirement: Requirement):
54+
specifiers = requirement.specifier
55+
return specifiers and len(specifiers) == 1 and next(iter(specifiers)).operator in {"==", "==="}
56+
57+
5358
def get_dependency(specifier):
5459
"""
5560
Return a DependentPackage given a requirement ``specifier`` string.
@@ -63,26 +68,22 @@ def get_dependency(specifier):
6368

6469
requirement = Requirement(requirement_string=specifier)
6570

66-
# TODO: use new InstallRequirement.from_specifier constructor when available
67-
ir = InstallRequirement(
68-
req=requirement,
69-
requirement_line=specifier,
70-
)
71-
7271
scope = "install"
7372
is_runtime = True
7473
is_optional = False
7574

76-
if ir.name:
75+
if requirement.name:
7776
# will be None if not pinned
78-
version = ir.get_pinned_version
79-
purl = PackageURL(type="pypi", name=ir.name, version=version).to_string()
77+
version = None
78+
if is_requirement_pinned(requirement):
79+
version = str(list(requirement.specifier)[0].version)
80+
purl = PackageURL(type="pypi", name=requirement.name, version=version).to_string()
8081

8182
return models.DependentPackage(
8283
purl=purl,
8384
scope=scope,
8485
is_runtime=is_runtime,
8586
is_optional=is_optional,
86-
is_resolved=ir.is_pinned or False,
87+
is_resolved=False or is_requirement_pinned(requirement),
8788
extracted_requirement=specifier,
8889
)

Diff for: src/python_inspector/resolve_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
TRACE = False
2222

23-
__version__ = "0.9.3"
23+
__version__ = "0.9.4"
2424

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

Diff for: tests/data/azure-devops.req-310-expected.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.3",
5+
"tool_version": "0.9.4",
66
"options": [
7-
"--requirement /home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
7+
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
88
"--index-url https://pypi.org/simple",
99
"--python-version 310",
1010
"--operating-system linux",
@@ -17,7 +17,7 @@
1717
"files": [
1818
{
1919
"type": "file",
20-
"path": "/home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
20+
"path": "/home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
2121
"package_data": [
2222
{
2323
"type": "pypi",

Diff for: tests/data/azure-devops.req-38-expected.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"headers": {
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
5-
"tool_version": "0.9.3",
5+
"tool_version": "0.9.4",
66
"options": [
7-
"--requirement /home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
7+
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
88
"--index-url https://pypi.org/simple",
99
"--python-version 38",
1010
"--operating-system linux",
@@ -17,7 +17,7 @@
1717
"files": [
1818
{
1919
"type": "file",
20-
"path": "/home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
20+
"path": "/home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
2121
"package_data": [
2222
{
2323
"type": "pypi",

Diff for: tests/data/default-url-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--specifier zipp==3.8.0",
88
"--index-url https://pypi.org/simple",

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

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/environment-marker-test-requirements.txt",
88
"--index-url https://pypi.org/simple",

Diff for: tests/data/frozen-requirements.txt-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/frozen-requirements.txt",
88
"--index-url https://pypi.org/simple",

Diff for: tests/data/insecure-setup-2/setup.py-expected.json

+47-45
Large diffs are not rendered by default.

Diff for: tests/data/insecure-setup/setup.py-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--index-url https://pypi.org/simple",
88
"--python-version 27",

Diff for: tests/data/pdt-requirements.txt-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/pdt-requirements.txt",
88
"--index-url https://pypi.org/simple",

Diff for: tests/data/pinned-pdt-requirements.txt-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/pinned-pdt-requirements.txt",
88
"--index-url https://pypi.org/simple",

Diff for: tests/data/pinned-requirements.txt-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/pinned-requirements.txt",
88
"--index-url https://pypi.org/simple",

Diff for: tests/data/prefer-source-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--specifier zipp==3.8.0",
88
"--index-url https://pypi.org/simple",

Diff for: tests/data/setup/no-direct-dependencies-setup.py-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--index-url https://pypi.org/simple",
88
"--python-version 27",

Diff for: tests/data/setup/simple-setup.py-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--index-url https://pypi.org/simple",
88
"--python-version 27",

Diff for: tests/data/setup/spdx-setup.py-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--index-url https://pypi.org/simple",
88
"--python-version 27",

Diff for: tests/data/single-url-except-simple-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--specifier flask",
88
"--index-url https://thirdparty.aboutcode.org/pypi/simple/",

Diff for: tests/data/single-url-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--specifier zipp==3.8.0",
88
"--index-url https://pypi.org/simple",

Diff for: tests/data/tilde_req-expected.json

+1-1
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--specifier zipp~=3.8.0",
88
"--index-url https://pypi.org/simple",

Diff for: tests/test_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def test_passing_of_json_pdt_and_json_flags():
373373
def test_version_option():
374374
options = ["--version"]
375375
result = run_cli(options=options)
376-
assert "0.9.3" in result.output
376+
assert "0.9.4" in result.output
377377

378378

379379
def test_passing_of_netrc_file_that_does_not_exist():

Diff for: tests/test_resolution.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ def test_without_supported_wheels():
150150
"pkg:pypi/[email protected]",
151151
"pkg:pypi/[email protected]",
152152
"pkg:pypi/[email protected]",
153-
"pkg:pypi/setuptools@65.7.0",
154-
"pkg:pypi/txaio@22.2.1",
153+
"pkg:pypi/setuptools@66.0.0",
154+
"pkg:pypi/txaio@23.1.1",
155155
]
156156

157157

0 commit comments

Comments
 (0)