Skip to content

Commit 95f2d37

Browse files
authored
Fix ResolutionImpossible for lief==0.15.1 (#206)
* Fix ResolutionImpossible for lief==0.15.1 Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com> * Fix formatting issue Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com> * Regenrate test files Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com> --------- Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent f1ac839 commit 95f2d37

10 files changed

+123
-40
lines changed

src/python_inspector/package_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def get_pypi_data_from_purl(
6464
)
6565
)
6666

67+
valid_distribution_urls = [url for url in valid_distribution_urls if url]
68+
6769
# if prefer_source is True then only source distribution is used
6870
# in case of no source distribution available then wheel is used
6971
if not valid_distribution_urls or not prefer_source:

src/python_inspector/utils_pypi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ def get_python_dot_version(version):
145145
"manylinux1_x86_64",
146146
"manylinux2010_x86_64",
147147
"manylinux2014_x86_64",
148+
"manylinux2014_aarch6",
149+
"musllinux_1_2_x86_64",
150+
"manylinux_2_33_aarch64",
148151
],
149152
"macos": [
150153
"macosx_10_6_intel",

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@
10331033
"subpath": null,
10341034
"primary_language": "Python",
10351035
"description": "cryptography is a package which provides cryptographic recipes and primitives to Python developers.\npyca/cryptography\n=================\n\n.. image:: https://img.shields.io/pypi/v/cryptography.svg\n :target: https://pypi.org/project/cryptography/\n :alt: Latest Version\n\n.. image:: https://readthedocs.org/projects/cryptography/badge/?version=latest\n :target: https://cryptography.io\n :alt: Latest Docs\n\n.. image:: https://github.com/pyca/cryptography/workflows/CI/badge.svg?branch=main\n :target: https://github.com/pyca/cryptography/actions?query=workflow%3ACI+branch%3Amain\n\n\n``cryptography`` is a package which provides cryptographic recipes and\nprimitives to Python developers. Our goal is for it to be your \"cryptographic\nstandard library\". It supports Python 3.7+ and PyPy3 7.3.11+.\n\n``cryptography`` includes both high level recipes and low level interfaces to\ncommon cryptographic algorithms such as symmetric ciphers, message digests, and\nkey derivation functions. For example, to encrypt something with\n``cryptography``'s high level symmetric encryption recipe:\n\n.. code-block:: pycon\n\n >>> from cryptography.fernet import Fernet\n >>> # Put this somewhere safe!\n >>> key = Fernet.generate_key()\n >>> f = Fernet(key)\n >>> token = f.encrypt(b\"A really secret message. Not for prying eyes.\")\n >>> token\n b'...'\n >>> f.decrypt(token)\n b'A really secret message. Not for prying eyes.'\n\nYou can find more information in the `documentation`_.\n\nYou can install ``cryptography`` with:\n\n.. code-block:: console\n\n $ pip install cryptography\n\nFor full details see `the installation documentation`_.\n\nDiscussion\n~~~~~~~~~~\n\nIf you run into bugs, you can file them in our `issue tracker`_.\n\nWe maintain a `cryptography-dev`_ mailing list for development discussion.\n\nYou can also join ``#pyca`` on ``irc.libera.chat`` to ask questions or get\ninvolved.\n\nSecurity\n~~~~~~~~\n\nNeed to report a security issue? Please consult our `security reporting`_\ndocumentation.\n\n\n.. _`documentation`: https://cryptography.io/\n.. _`the installation documentation`: https://cryptography.io/en/latest/installation/\n.. _`issue tracker`: https://github.com/pyca/cryptography/issues\n.. _`cryptography-dev`: https://mail.python.org/mailman/listinfo/cryptography-dev\n.. _`security reporting`: https://cryptography.io/en/latest/security/",
1036-
"release_date": "2025-03-02T00:00:42",
1036+
"release_date": "2025-03-02T00:00:28",
10371037
"parties": [
10381038
{
10391039
"type": "person",
@@ -1067,11 +1067,11 @@
10671067
"Topic :: Security :: Cryptography"
10681068
],
10691069
"homepage_url": null,
1070-
"download_url": "https://files.pythonhosted.org/packages/d7/fc/99fe639bcdf58561dfad1faa8a7369d1dc13f20acd78371bb97a01613585/cryptography-44.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
1071-
"size": 4167812,
1070+
"download_url": "https://files.pythonhosted.org/packages/f3/cd/2558cc08f7b1bb40683f99ff4327f8dcfc7de3affc669e9065e14824511b/cryptography-44.0.2-cp37-abi3-musllinux_1_2_x86_64.whl",
1071+
"size": 4298367,
10721072
"sha1": null,
1073-
"md5": "c4d1bb9c2ff2e88d4c4bbfe67d92a008",
1074-
"sha256": "9a1e657c0f4ea2a23304ee3f964db058c9e9e635cc7019c4aa21c330755ef6fd",
1073+
"md5": "3d99f96dacf683212ee78a468b3ab242",
1074+
"sha256": "3b721b8b4d948b218c88cb8c45a01793483821e709afe5f622861fc6182b20a7",
10751075
"sha512": null,
10761076
"bug_tracking_url": null,
10771077
"code_view_url": null,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@
10331033
"subpath": null,
10341034
"primary_language": "Python",
10351035
"description": "cryptography is a package which provides cryptographic recipes and primitives to Python developers.\npyca/cryptography\n=================\n\n.. image:: https://img.shields.io/pypi/v/cryptography.svg\n :target: https://pypi.org/project/cryptography/\n :alt: Latest Version\n\n.. image:: https://readthedocs.org/projects/cryptography/badge/?version=latest\n :target: https://cryptography.io\n :alt: Latest Docs\n\n.. image:: https://github.com/pyca/cryptography/workflows/CI/badge.svg?branch=main\n :target: https://github.com/pyca/cryptography/actions?query=workflow%3ACI+branch%3Amain\n\n\n``cryptography`` is a package which provides cryptographic recipes and\nprimitives to Python developers. Our goal is for it to be your \"cryptographic\nstandard library\". It supports Python 3.7+ and PyPy3 7.3.11+.\n\n``cryptography`` includes both high level recipes and low level interfaces to\ncommon cryptographic algorithms such as symmetric ciphers, message digests, and\nkey derivation functions. For example, to encrypt something with\n``cryptography``'s high level symmetric encryption recipe:\n\n.. code-block:: pycon\n\n >>> from cryptography.fernet import Fernet\n >>> # Put this somewhere safe!\n >>> key = Fernet.generate_key()\n >>> f = Fernet(key)\n >>> token = f.encrypt(b\"A really secret message. Not for prying eyes.\")\n >>> token\n b'...'\n >>> f.decrypt(token)\n b'A really secret message. Not for prying eyes.'\n\nYou can find more information in the `documentation`_.\n\nYou can install ``cryptography`` with:\n\n.. code-block:: console\n\n $ pip install cryptography\n\nFor full details see `the installation documentation`_.\n\nDiscussion\n~~~~~~~~~~\n\nIf you run into bugs, you can file them in our `issue tracker`_.\n\nWe maintain a `cryptography-dev`_ mailing list for development discussion.\n\nYou can also join ``#pyca`` on ``irc.libera.chat`` to ask questions or get\ninvolved.\n\nSecurity\n~~~~~~~~\n\nNeed to report a security issue? Please consult our `security reporting`_\ndocumentation.\n\n\n.. _`documentation`: https://cryptography.io/\n.. _`the installation documentation`: https://cryptography.io/en/latest/installation/\n.. _`issue tracker`: https://github.com/pyca/cryptography/issues\n.. _`cryptography-dev`: https://mail.python.org/mailman/listinfo/cryptography-dev\n.. _`security reporting`: https://cryptography.io/en/latest/security/",
1036-
"release_date": "2025-03-02T00:00:42",
1036+
"release_date": "2025-03-02T00:00:28",
10371037
"parties": [
10381038
{
10391039
"type": "person",
@@ -1067,11 +1067,11 @@
10671067
"Topic :: Security :: Cryptography"
10681068
],
10691069
"homepage_url": null,
1070-
"download_url": "https://files.pythonhosted.org/packages/d7/fc/99fe639bcdf58561dfad1faa8a7369d1dc13f20acd78371bb97a01613585/cryptography-44.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
1071-
"size": 4167812,
1070+
"download_url": "https://files.pythonhosted.org/packages/f3/cd/2558cc08f7b1bb40683f99ff4327f8dcfc7de3affc669e9065e14824511b/cryptography-44.0.2-cp37-abi3-musllinux_1_2_x86_64.whl",
1071+
"size": 4298367,
10721072
"sha1": null,
1073-
"md5": "c4d1bb9c2ff2e88d4c4bbfe67d92a008",
1074-
"sha256": "9a1e657c0f4ea2a23304ee3f964db058c9e9e635cc7019c4aa21c330755ef6fd",
1073+
"md5": "3d99f96dacf683212ee78a468b3ab242",
1074+
"sha256": "3b721b8b4d948b218c88cb8c45a01793483821e709afe5f622861fc6182b20a7",
10751075
"sha512": null,
10761076
"bug_tracking_url": null,
10771077
"code_view_url": null,

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

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

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

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

tests/data/test-api-expected.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@
474474
"subpath": null,
475475
"primary_language": "Python",
476476
"description": "Safely add untrusted strings to HTML/XML markup.\n# MarkupSafe\n\nMarkupSafe implements a text object that escapes characters so it is\nsafe to use in HTML and XML. Characters that have special meanings are\nreplaced so that they display as the actual characters. This mitigates\ninjection attacks, meaning untrusted user input can safely be displayed\non a page.\n\n\n## Examples\n\n```pycon\n>>> from markupsafe import Markup, escape\n\n>>> # escape replaces special characters and wraps in Markup\n>>> escape(\"<script>alert(document.cookie);</script>\")\nMarkup('&lt;script&gt;alert(document.cookie);&lt;/script&gt;')\n\n>>> # wrap in Markup to mark text \"safe\" and prevent escaping\n>>> Markup(\"<strong>Hello</strong>\")\nMarkup('<strong>hello</strong>')\n\n>>> escape(Markup(\"<strong>Hello</strong>\"))\nMarkup('<strong>hello</strong>')\n\n>>> # Markup is a str subclass\n>>> # methods and operators escape their arguments\n>>> template = Markup(\"Hello <em>{name}</em>\")\n>>> template.format(name='\"World\"')\nMarkup('Hello <em>&#34;World&#34;</em>')\n```\n\n## Donate\n\nThe Pallets organization develops and supports MarkupSafe and other\npopular packages. In order to grow the community of contributors and\nusers, and allow the maintainers to devote more time to the projects,\n[please donate today][].\n\n[please donate today]: https://palletsprojects.com/donate",
477-
"release_date": "2024-10-18T15:20:55",
477+
"release_date": "2024-10-18T15:20:59",
478478
"parties": [
479479
{
480480
"type": "person",
@@ -495,11 +495,11 @@
495495
"Typing :: Typed"
496496
],
497497
"homepage_url": null,
498-
"download_url": "https://files.pythonhosted.org/packages/22/35/137da042dfb4720b638d2937c38a9c2df83fe32d20e8c8f3185dbfef05f7/MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
499-
"size": 20866,
498+
"download_url": "https://files.pythonhosted.org/packages/bd/6e/61ebf08d8940553afff20d1fb1ba7294b6f8d279df9fd0c0db911b4bbcfd/MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl",
499+
"size": 21091,
500500
"sha1": null,
501-
"md5": "6fb2985db3f3b1aec8d8615221fb91ea",
502-
"sha256": "bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d",
501+
"md5": "ef4de80fb119dfe436aa346068b6cbc8",
502+
"sha256": "b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171",
503503
"sha512": null,
504504
"bug_tracking_url": null,
505505
"code_view_url": "https://github.com/pallets/markupsafe/",

tests/data/test-api-pdt-expected.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@
474474
"subpath": null,
475475
"primary_language": "Python",
476476
"description": "Safely add untrusted strings to HTML/XML markup.\n# MarkupSafe\n\nMarkupSafe implements a text object that escapes characters so it is\nsafe to use in HTML and XML. Characters that have special meanings are\nreplaced so that they display as the actual characters. This mitigates\ninjection attacks, meaning untrusted user input can safely be displayed\non a page.\n\n\n## Examples\n\n```pycon\n>>> from markupsafe import Markup, escape\n\n>>> # escape replaces special characters and wraps in Markup\n>>> escape(\"<script>alert(document.cookie);</script>\")\nMarkup('&lt;script&gt;alert(document.cookie);&lt;/script&gt;')\n\n>>> # wrap in Markup to mark text \"safe\" and prevent escaping\n>>> Markup(\"<strong>Hello</strong>\")\nMarkup('<strong>hello</strong>')\n\n>>> escape(Markup(\"<strong>Hello</strong>\"))\nMarkup('<strong>hello</strong>')\n\n>>> # Markup is a str subclass\n>>> # methods and operators escape their arguments\n>>> template = Markup(\"Hello <em>{name}</em>\")\n>>> template.format(name='\"World\"')\nMarkup('Hello <em>&#34;World&#34;</em>')\n```\n\n## Donate\n\nThe Pallets organization develops and supports MarkupSafe and other\npopular packages. In order to grow the community of contributors and\nusers, and allow the maintainers to devote more time to the projects,\n[please donate today][].\n\n[please donate today]: https://palletsprojects.com/donate",
477-
"release_date": "2024-10-18T15:20:55",
477+
"release_date": "2024-10-18T15:20:59",
478478
"parties": [
479479
{
480480
"type": "person",
@@ -495,11 +495,11 @@
495495
"Typing :: Typed"
496496
],
497497
"homepage_url": null,
498-
"download_url": "https://files.pythonhosted.org/packages/22/35/137da042dfb4720b638d2937c38a9c2df83fe32d20e8c8f3185dbfef05f7/MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
499-
"size": 20866,
498+
"download_url": "https://files.pythonhosted.org/packages/bd/6e/61ebf08d8940553afff20d1fb1ba7294b6f8d279df9fd0c0db911b4bbcfd/MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl",
499+
"size": 21091,
500500
"sha1": null,
501-
"md5": "6fb2985db3f3b1aec8d8615221fb91ea",
502-
"sha256": "bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d",
501+
"md5": "ef4de80fb119dfe436aa346068b6cbc8",
502+
"sha256": "b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171",
503503
"sha512": null,
504504
"bug_tracking_url": null,
505505
"code_view_url": "https://github.com/pallets/markupsafe/",
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"files": [],
3+
"packages": [
4+
{
5+
"type": "pypi",
6+
"namespace": null,
7+
"name": "lief",
8+
"version": "0.15.1",
9+
"qualifiers": {},
10+
"subpath": null,
11+
"primary_language": "Python",
12+
"description": "Library to instrument executable formats\nAbout\n=====\n\nThe purpose of this project is to provide a cross platform library that can parse, modify and\nabstract ELF, PE and MachO formats.\n\nMain features:\n\n * **Parsing**: LIEF can parse ELF, PE, MachO, OAT, DEX, VDEX, ART and provides an user-friendly API to access to format internals.\n * **Modify**: LIEF enables to modify some parts of these formats\n * **Abstract**: Three formats have common features like sections, symbols, entry point... LIEF factors them.\n * **API**: LIEF can be used in C, C++ and Python\n\n\nDownloads / Install\n===================\n\nFirst, make sure to have an updated version of setuptools:\n\n.. code-block:: console\n\n $ pip install setuptools --upgrade\n\nTo install the latest **version** (release):\n\n.. code-block:: console\n\n $ pip install lief\n\nTo install nightly build:\n\n.. code-block:: console\n\n $ pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief\n\n\nGetting started\n===============\n\nPython\n------\n\n.. code-block:: python\n\n import lief\n\n # ELF\n binary = lief.parse(\"/usr/bin/ls\")\n print(binary)\n\n # PE\n binary = lief.parse(\"C:\\\\Windows\\\\explorer.exe\")\n print(binary)\n\n # Mach-O\n binary = lief.parse(\"/usr/bin/ls\")\n print(binary)\n\nC++\n---\n\n.. code-block:: cpp\n\n #include <LIEF/LIEF.hpp>\n\n int main(int argc, char** argv) {\n // ELF\n try {\n std::unique_ptr<LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse(\"/bin/ls\");\n std::cout << *elf << '\\n';\n } catch (const LIEF::exception& err) {\n std::cerr << err.what() << '\\n';\n }\n\n // PE\n try {\n std::unique_ptr<LIEF::PE::Binary> pe = LIEF::PE::Parser::parse(\"C:\\\\Windows\\\\explorer.exe\");\n std::cout << *pe << '\\n';\n } catch (const LIEF::exception& err) {\n std::cerr << err.what() << '\\n';\n }\n\n // Mach-O\n try {\n std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse(\"/bin/ls\");\n std::cout << *macho << '\\n';\n } catch (const LIEF::exception& err) {\n std::cerr << err.what() << '\\n';\n }\n\n return 0;\n }\n\nC (Limited API)\n----------------\n\n.. code-block:: cpp\n\n #include <LIEF/LIEF.h>\n\n int main(int argc, char** argv) {\n Elf_Binary_t* elf = elf_parse(\"/usr/bin/ls\");\n\n Elf_Section_t** sections = elf->sections;\n\n for (size_t i = 0; sections[i] != NULL; ++i) {\n printf(\"%s\\n\", sections[i]->name);\n }\n\n elf_binary_destroy(elf);\n return 0;\n }\n\nDocumentation\n=============\n\n* `Main documentation <https://lief-project.github.io/doc/latest/index.html>`_\n* `Tutorial <https://lief-project.github.io/doc/latest/tutorials/index.html>`_\n* `API <https://lief-project.github.io/doc/latest/api/index.html>`_\n* `Doxygen <https://lief-project.github.io/doc/latest/doxygen/index.html>`_\n\nContact\n=======\n\n* **Mail**: contact at lief.re\n* **Gitter**: `lief-project <https://gitter.im/lief-project>`_\n\n\nAuthors\n=======\n\nRomain Thomas `@rh0main <https://twitter.com/rh0main>`_ - `Quarkslab <https://www.quarkslab.com>`_\n\n----\n\nLIEF is provided under the `Apache 2.0 license <https://github.com/lief-project/LIEF/blob/0.12.3/LICENSE>`_",
13+
"release_date": "2024-07-23T14:52:11",
14+
"parties": [
15+
{
16+
"type": "person",
17+
"role": "author",
18+
"name": null,
19+
"email": "Romain Thomas <contact@lief.re>",
20+
"url": null
21+
}
22+
],
23+
"keywords": [
24+
"parser",
25+
"elf",
26+
"pe",
27+
"macho",
28+
"reverse-engineering",
29+
"Development Status :: 4 - Beta",
30+
"Programming Language :: C++",
31+
"Programming Language :: Python :: 3",
32+
"Topic :: Software Development :: Libraries"
33+
],
34+
"homepage_url": "https://lief-project.github.io/",
35+
"download_url": "https://files.pythonhosted.org/packages/bd/e8/398583add15a3a74207624be6a853a30a986252440f19b4052022cea911a/lief-0.15.1-cp312-cp312-musllinux_1_2_x86_64.whl",
36+
"size": 2476427,
37+
"sha1": null,
38+
"md5": "0a223b5258a2a5a112b92af3f38cf9f2",
39+
"sha256": "c2ec738bcafee8a569741f4a749f0596823b12f10713306c7d0cbbf85759f51c",
40+
"sha512": null,
41+
"bug_tracking_url": "https://github.com/lief-project/LIEF/issues",
42+
"code_view_url": null,
43+
"vcs_url": null,
44+
"copyright": null,
45+
"license_expression": null,
46+
"declared_license": {
47+
"license": "Apache License 2.0"
48+
},
49+
"notice_text": null,
50+
"source_packages": [],
51+
"file_references": [],
52+
"extra_data": {},
53+
"dependencies": [],
54+
"repository_homepage_url": null,
55+
"repository_download_url": null,
56+
"api_data_url": "https://pypi.org/pypi/lief/0.15.1/json",
57+
"datasource_id": null,
58+
"purl": "pkg:pypi/lief@0.15.1"
59+
}
60+
],
61+
"resolution": [
62+
{
63+
"package": "pkg:pypi/lief@0.15.1",
64+
"dependencies": []
65+
}
66+
]
67+
}

tests/test_api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ def test_api_with_python_311():
107107
check_data_results(results=results.to_dict(generic_paths=True), expected_file=expected_file)
108108

109109

110+
def test_api_with_lief_python_312():
111+
expected_file = test_env.get_test_loc("test-api-with-lief-python-312.json", must_exist=False)
112+
results = resolver_api(
113+
specifiers=["lief==0.15.1"],
114+
python_version="3.12",
115+
operating_system="linux",
116+
prefer_source=True,
117+
)
118+
check_data_results(results=results.to_dict(generic_paths=True), expected_file=expected_file)
119+
120+
110121
def test_api_with_partial_setup_py():
111122
expected_file = test_env.get_test_loc("test-api-with-partial-setup-py.json", must_exist=False)
112123
results = resolver_api(

0 commit comments

Comments
 (0)