Skip to content

Commit b42f24b

Browse files
committed
Resolve azure-devops dependency
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 34e018d commit b42f24b

File tree

6 files changed

+2081
-40
lines changed

6 files changed

+2081
-40
lines changed

src/python_inspector/resolution.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ def is_valid_version(
192192
"""
193193
Return True if the parsed_version is valid for the given identifier.
194194
"""
195-
if (
196-
any(parsed_version not in r.specifier for r in requirements[identifier])
197-
or parsed_version in bad_versions
198-
):
195+
if parsed_version in bad_versions:
196+
return False
197+
if any(parsed_version not in r.specifier for r in requirements[identifier]):
198+
if all(not r.specifier for r in requirements[identifier]):
199+
return True
199200
return False
200201
return True
201202

@@ -504,7 +505,11 @@ def find_matches(
504505

505506
def is_satisfied_by(self, requirement: Requirement, candidate: Candidate) -> bool:
506507
"""Whether the given requirement can be satisfied by a candidate. Overridden."""
507-
return candidate.version in requirement.specifier
508+
if candidate.version in requirement.specifier:
509+
return True
510+
elif not requirement.specifier:
511+
return True
512+
return False
508513

509514
def _iter_dependencies(self, candidate: Candidate) -> Generator[Requirement, None, None]:
510515
"""

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

Lines changed: 2015 additions & 0 deletions
Large diffs are not rendered by default.

tests/data/azure-devops.req.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
azure-devops
2+
azure-storage-blob
3+
click

tests/data/pinned-pdt-requirements.txt-expected.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@
727727
{
728728
"key": "openpyxl",
729729
"package_name": "openpyxl",
730-
"installed_version": "3.0.10",
730+
"installed_version": "3.2.0b1",
731731
"dependencies": [
732732
{
733733
"key": "et-xmlfile",
@@ -2681,12 +2681,12 @@
26812681
"type": "pypi",
26822682
"namespace": null,
26832683
"name": "openpyxl",
2684-
"version": "3.0.10",
2684+
"version": "3.2.0b1",
26852685
"qualifiers": {},
26862686
"subpath": null,
26872687
"primary_language": "Python",
26882688
"description": ".. image:: https://coveralls.io/repos/bitbucket/openpyxl/openpyxl/badge.svg?branch=default\n :target: https://coveralls.io/bitbucket/openpyxl/openpyxl?branch=default\n :alt: coverage status\n\nIntroduction\n------------\n\nopenpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.\n\nIt was born from lack of existing library to read/write natively from Python\nthe Office Open XML format.\n\nAll kudos to the PHPExcel team as openpyxl was initially based on PHPExcel.\n\n\nSecurity\n--------\n\nBy default openpyxl does not guard against quadratic blowup or billion laughs\nxml attacks. To guard against these attacks install defusedxml.\n\nMailing List\n------------\n\nThe user list can be found on http://groups.google.com/group/openpyxl-users\n\n\nSample code::\n\n from openpyxl import Workbook\n wb = Workbook()\n\n # grab the active worksheet\n ws = wb.active\n\n # Data can be assigned directly to cells\n ws['A1'] = 42\n\n # Rows can also be appended\n ws.append([1, 2, 3])\n\n # Python types will automatically be converted\n import datetime\n ws['A2'] = datetime.datetime.now()\n\n # Save the file\n wb.save(\"sample.xlsx\")\n\n\nDocumentation\n-------------\n\nThe documentation is at: https://openpyxl.readthedocs.io\n\n* installation methods\n* code examples\n* instructions for contributing\n\nRelease notes: https://openpyxl.readthedocs.io/en/stable/changes.html\n\n\n",
2689-
"release_date": "2022-05-19T15:43:03",
2689+
"release_date": "2022-05-19T15:36:19",
26902690
"parties": [
26912691
{
26922692
"type": "person",
@@ -2705,11 +2705,11 @@
27052705
],
27062706
"keywords": [],
27072707
"homepage_url": "https://openpyxl.readthedocs.io",
2708-
"download_url": "https://files.pythonhosted.org/packages/7b/60/9afac4fd6feee0ac09339de4101ee452ea643d26e9ce44c7708a0023f503/openpyxl-3.0.10-py2.py3-none-any.whl",
2709-
"size": 242144,
2708+
"download_url": "https://files.pythonhosted.org/packages/e2/5e/1fe4ea74f5c0afc681cbb1f34836fa251280c5aa3012dc803f6aac1382d6/openpyxl-3.2.0b1-py2.py3-none-any.whl",
2709+
"size": 253611,
27102710
"sha1": null,
2711-
"md5": "8c57b36e745fe4c437d190272e50debb",
2712-
"sha256": "0ab6d25d01799f97a9464630abacbb34aafecdcaa0ef3cba6d6b3499867d0355",
2711+
"md5": "ae7adfa1ea9ffe2ceae5d6f5151645f0",
2712+
"sha256": "c9c32c7304ad9de30aa6632dd9836469fce0338e91f3e7875a1395f9163a3eec",
27132713
"sha512": null,
27142714
"bug_tracking_url": "https://foss.heptapod.net/openpyxl/openpyxl/-/issues",
27152715
"code_view_url": "https://foss.heptapod.net/openpyxl/openpyxl",
@@ -2724,20 +2724,20 @@
27242724
"dependencies": [],
27252725
"repository_homepage_url": null,
27262726
"repository_download_url": null,
2727-
"api_data_url": "https://pypi.org/pypi/openpyxl/3.0.10/json",
2727+
"api_data_url": "https://pypi.org/pypi/openpyxl/3.2.0b1/json",
27282728
"datasource_id": null,
2729-
"purl": "pkg:pypi/openpyxl@3.0.10"
2729+
"purl": "pkg:pypi/openpyxl@3.2.0b1"
27302730
},
27312731
{
27322732
"type": "pypi",
27332733
"namespace": null,
27342734
"name": "openpyxl",
2735-
"version": "3.0.10",
2735+
"version": "3.2.0b1",
27362736
"qualifiers": {},
27372737
"subpath": null,
27382738
"primary_language": "Python",
27392739
"description": ".. image:: https://coveralls.io/repos/bitbucket/openpyxl/openpyxl/badge.svg?branch=default\n :target: https://coveralls.io/bitbucket/openpyxl/openpyxl?branch=default\n :alt: coverage status\n\nIntroduction\n------------\n\nopenpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.\n\nIt was born from lack of existing library to read/write natively from Python\nthe Office Open XML format.\n\nAll kudos to the PHPExcel team as openpyxl was initially based on PHPExcel.\n\n\nSecurity\n--------\n\nBy default openpyxl does not guard against quadratic blowup or billion laughs\nxml attacks. To guard against these attacks install defusedxml.\n\nMailing List\n------------\n\nThe user list can be found on http://groups.google.com/group/openpyxl-users\n\n\nSample code::\n\n from openpyxl import Workbook\n wb = Workbook()\n\n # grab the active worksheet\n ws = wb.active\n\n # Data can be assigned directly to cells\n ws['A1'] = 42\n\n # Rows can also be appended\n ws.append([1, 2, 3])\n\n # Python types will automatically be converted\n import datetime\n ws['A2'] = datetime.datetime.now()\n\n # Save the file\n wb.save(\"sample.xlsx\")\n\n\nDocumentation\n-------------\n\nThe documentation is at: https://openpyxl.readthedocs.io\n\n* installation methods\n* code examples\n* instructions for contributing\n\nRelease notes: https://openpyxl.readthedocs.io/en/stable/changes.html\n\n\n",
2740-
"release_date": "2022-05-19T15:43:05",
2740+
"release_date": "2022-05-19T15:36:22",
27412741
"parties": [
27422742
{
27432743
"type": "person",
@@ -2756,11 +2756,11 @@
27562756
],
27572757
"keywords": [],
27582758
"homepage_url": "https://openpyxl.readthedocs.io",
2759-
"download_url": "https://files.pythonhosted.org/packages/2c/b8/ff77a718173fd73e49f883b4fda88f11af1fc51edb9252af3785b0cad987/openpyxl-3.0.10.tar.gz",
2760-
"size": 179688,
2759+
"download_url": "https://files.pythonhosted.org/packages/d0/ba/a48d1d7b5ff6f8628a76115fdf1f86bfff519ebef87be2ce2fcc0f344370/openpyxl-3.2.0b1.tar.gz",
2760+
"size": 188944,
27612761
"sha1": null,
2762-
"md5": "ebcc3a30768a45163d5143f1f7bf0224",
2763-
"sha256": "e47805627aebcf860edb4edf7987b1309c1b3632f3750538ed962bbcc3bd7449",
2762+
"md5": "ffe0ca8751be87279fc75f3f586a4a26",
2763+
"sha256": "77a7c531d70bd4cd65e03cb583186819a75257048736b71581d8c115758598e4",
27642764
"sha512": null,
27652765
"bug_tracking_url": "https://foss.heptapod.net/openpyxl/openpyxl/-/issues",
27662766
"code_view_url": "https://foss.heptapod.net/openpyxl/openpyxl",
@@ -2775,9 +2775,9 @@
27752775
"dependencies": [],
27762776
"repository_homepage_url": null,
27772777
"repository_download_url": null,
2778-
"api_data_url": "https://pypi.org/pypi/openpyxl/3.0.10/json",
2778+
"api_data_url": "https://pypi.org/pypi/openpyxl/3.2.0b1/json",
27792779
"datasource_id": null,
2780-
"purl": "pkg:pypi/openpyxl@3.0.10"
2780+
"purl": "pkg:pypi/openpyxl@3.2.0b1"
27812781
},
27822782
{
27832783
"type": "pypi",

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@
678678
"pkg:pypi/click@8.0.4",
679679
"pkg:pypi/jinja2@3.1.2",
680680
"pkg:pypi/license-expression@30.0.0",
681-
"pkg:pypi/openpyxl@3.0.10",
681+
"pkg:pypi/openpyxl@3.2.0b1",
682682
"pkg:pypi/packageurl-python@0.9.9",
683683
"pkg:pypi/saneyaml@0.5.2"
684684
]
@@ -768,7 +768,7 @@
768768
"dependencies": []
769769
},
770770
{
771-
"package": "pkg:pypi/openpyxl@3.0.10",
771+
"package": "pkg:pypi/openpyxl@3.2.0b1",
772772
"dependencies": [
773773
"pkg:pypi/et-xmlfile@1.1.0"
774774
]
@@ -2588,12 +2588,12 @@
25882588
"type": "pypi",
25892589
"namespace": null,
25902590
"name": "openpyxl",
2591-
"version": "3.0.10",
2591+
"version": "3.2.0b1",
25922592
"qualifiers": {},
25932593
"subpath": null,
25942594
"primary_language": "Python",
25952595
"description": ".. image:: https://coveralls.io/repos/bitbucket/openpyxl/openpyxl/badge.svg?branch=default\n :target: https://coveralls.io/bitbucket/openpyxl/openpyxl?branch=default\n :alt: coverage status\n\nIntroduction\n------------\n\nopenpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.\n\nIt was born from lack of existing library to read/write natively from Python\nthe Office Open XML format.\n\nAll kudos to the PHPExcel team as openpyxl was initially based on PHPExcel.\n\n\nSecurity\n--------\n\nBy default openpyxl does not guard against quadratic blowup or billion laughs\nxml attacks. To guard against these attacks install defusedxml.\n\nMailing List\n------------\n\nThe user list can be found on http://groups.google.com/group/openpyxl-users\n\n\nSample code::\n\n from openpyxl import Workbook\n wb = Workbook()\n\n # grab the active worksheet\n ws = wb.active\n\n # Data can be assigned directly to cells\n ws['A1'] = 42\n\n # Rows can also be appended\n ws.append([1, 2, 3])\n\n # Python types will automatically be converted\n import datetime\n ws['A2'] = datetime.datetime.now()\n\n # Save the file\n wb.save(\"sample.xlsx\")\n\n\nDocumentation\n-------------\n\nThe documentation is at: https://openpyxl.readthedocs.io\n\n* installation methods\n* code examples\n* instructions for contributing\n\nRelease notes: https://openpyxl.readthedocs.io/en/stable/changes.html\n\n\n",
2596-
"release_date": "2022-05-19T15:43:03",
2596+
"release_date": "2022-05-19T15:36:19",
25972597
"parties": [
25982598
{
25992599
"type": "person",
@@ -2612,11 +2612,11 @@
26122612
],
26132613
"keywords": [],
26142614
"homepage_url": "https://openpyxl.readthedocs.io",
2615-
"download_url": "https://files.pythonhosted.org/packages/7b/60/9afac4fd6feee0ac09339de4101ee452ea643d26e9ce44c7708a0023f503/openpyxl-3.0.10-py2.py3-none-any.whl",
2616-
"size": 242144,
2615+
"download_url": "https://files.pythonhosted.org/packages/e2/5e/1fe4ea74f5c0afc681cbb1f34836fa251280c5aa3012dc803f6aac1382d6/openpyxl-3.2.0b1-py2.py3-none-any.whl",
2616+
"size": 253611,
26172617
"sha1": null,
2618-
"md5": "8c57b36e745fe4c437d190272e50debb",
2619-
"sha256": "0ab6d25d01799f97a9464630abacbb34aafecdcaa0ef3cba6d6b3499867d0355",
2618+
"md5": "ae7adfa1ea9ffe2ceae5d6f5151645f0",
2619+
"sha256": "c9c32c7304ad9de30aa6632dd9836469fce0338e91f3e7875a1395f9163a3eec",
26202620
"sha512": null,
26212621
"bug_tracking_url": "https://foss.heptapod.net/openpyxl/openpyxl/-/issues",
26222622
"code_view_url": "https://foss.heptapod.net/openpyxl/openpyxl",
@@ -2631,20 +2631,20 @@
26312631
"dependencies": [],
26322632
"repository_homepage_url": null,
26332633
"repository_download_url": null,
2634-
"api_data_url": "https://pypi.org/pypi/openpyxl/3.0.10/json",
2634+
"api_data_url": "https://pypi.org/pypi/openpyxl/3.2.0b1/json",
26352635
"datasource_id": null,
2636-
"purl": "pkg:pypi/openpyxl@3.0.10"
2636+
"purl": "pkg:pypi/openpyxl@3.2.0b1"
26372637
},
26382638
{
26392639
"type": "pypi",
26402640
"namespace": null,
26412641
"name": "openpyxl",
2642-
"version": "3.0.10",
2642+
"version": "3.2.0b1",
26432643
"qualifiers": {},
26442644
"subpath": null,
26452645
"primary_language": "Python",
26462646
"description": ".. image:: https://coveralls.io/repos/bitbucket/openpyxl/openpyxl/badge.svg?branch=default\n :target: https://coveralls.io/bitbucket/openpyxl/openpyxl?branch=default\n :alt: coverage status\n\nIntroduction\n------------\n\nopenpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.\n\nIt was born from lack of existing library to read/write natively from Python\nthe Office Open XML format.\n\nAll kudos to the PHPExcel team as openpyxl was initially based on PHPExcel.\n\n\nSecurity\n--------\n\nBy default openpyxl does not guard against quadratic blowup or billion laughs\nxml attacks. To guard against these attacks install defusedxml.\n\nMailing List\n------------\n\nThe user list can be found on http://groups.google.com/group/openpyxl-users\n\n\nSample code::\n\n from openpyxl import Workbook\n wb = Workbook()\n\n # grab the active worksheet\n ws = wb.active\n\n # Data can be assigned directly to cells\n ws['A1'] = 42\n\n # Rows can also be appended\n ws.append([1, 2, 3])\n\n # Python types will automatically be converted\n import datetime\n ws['A2'] = datetime.datetime.now()\n\n # Save the file\n wb.save(\"sample.xlsx\")\n\n\nDocumentation\n-------------\n\nThe documentation is at: https://openpyxl.readthedocs.io\n\n* installation methods\n* code examples\n* instructions for contributing\n\nRelease notes: https://openpyxl.readthedocs.io/en/stable/changes.html\n\n\n",
2647-
"release_date": "2022-05-19T15:43:05",
2647+
"release_date": "2022-05-19T15:36:22",
26482648
"parties": [
26492649
{
26502650
"type": "person",
@@ -2663,11 +2663,11 @@
26632663
],
26642664
"keywords": [],
26652665
"homepage_url": "https://openpyxl.readthedocs.io",
2666-
"download_url": "https://files.pythonhosted.org/packages/2c/b8/ff77a718173fd73e49f883b4fda88f11af1fc51edb9252af3785b0cad987/openpyxl-3.0.10.tar.gz",
2667-
"size": 179688,
2666+
"download_url": "https://files.pythonhosted.org/packages/d0/ba/a48d1d7b5ff6f8628a76115fdf1f86bfff519ebef87be2ce2fcc0f344370/openpyxl-3.2.0b1.tar.gz",
2667+
"size": 188944,
26682668
"sha1": null,
2669-
"md5": "ebcc3a30768a45163d5143f1f7bf0224",
2670-
"sha256": "e47805627aebcf860edb4edf7987b1309c1b3632f3750538ed962bbcc3bd7449",
2669+
"md5": "ffe0ca8751be87279fc75f3f586a4a26",
2670+
"sha256": "77a7c531d70bd4cd65e03cb583186819a75257048736b71581d8c115758598e4",
26712671
"sha512": null,
26722672
"bug_tracking_url": "https://foss.heptapod.net/openpyxl/openpyxl/-/issues",
26732673
"code_view_url": "https://foss.heptapod.net/openpyxl/openpyxl",
@@ -2682,9 +2682,9 @@
26822682
"dependencies": [],
26832683
"repository_homepage_url": null,
26842684
"repository_download_url": null,
2685-
"api_data_url": "https://pypi.org/pypi/openpyxl/3.0.10/json",
2685+
"api_data_url": "https://pypi.org/pypi/openpyxl/3.2.0b1/json",
26862686
"datasource_id": null,
2687-
"purl": "pkg:pypi/openpyxl@3.0.10"
2687+
"purl": "pkg:pypi/openpyxl@3.2.0b1"
26882688
},
26892689
{
26902690
"type": "pypi",

tests/test_cli.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,24 @@ def test_cli_with_environment_marker_and_complex_ranges():
162162
)
163163

164164

165+
@pytest.mark.online
166+
def test_cli_with_azure_devops():
167+
requirements_file = test_env.get_test_loc("azure-devops.req.txt")
168+
expected_file = test_env.get_test_loc("azure-devops.req-expected.json", must_exist=False)
169+
extra_options = [
170+
"--operating-system",
171+
"linux",
172+
"--python-version",
173+
"38",
174+
]
175+
check_requirements_resolution(
176+
requirements_file=requirements_file,
177+
expected_file=expected_file,
178+
extra_options=extra_options,
179+
regen=REGEN_TEST_FIXTURES,
180+
)
181+
182+
165183
@pytest.mark.online
166184
def test_cli_with_multiple_index_url_and_tilde_req_with_max_rounds():
167185
expected_file = test_env.get_test_loc("tilde_req-expected.json", must_exist=False)

0 commit comments

Comments
 (0)