Skip to content

Commit 1554082

Browse files
committed
Prepare for release v0.9.4
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 24c71b3 commit 1554082

21 files changed

+37
-29
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ next-version
77
- Create PyPI cache location in the home directory if a cache directory cannot be made at the project root.
88

99

10+
v0.9.4
11+
------
12+
13+
- Replace packaging with packvers.
14+
- Prevent duplicated package versions.
15+
16+
1017
v0.9.3
1118
------
1219

src/python_inspector/dependencies.py

Lines changed: 11 additions & 10 deletions
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
)

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.3"
23+
__version__ = "0.9.4"
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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--requirement /home/jono/nexb/src/python-inspector/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.3",
5+
"tool_version": "0.9.4",
66
"options": [
77
"--requirement /home/jono/nexb/src/python-inspector/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.3",
5+
"tool_version": "0.9.4",
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.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",

tests/data/frozen-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.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",

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

0 commit comments

Comments
 (0)