Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse package names from functions in setup.py #4303

Merged
merged 1 commit into from
Jun 1, 2020
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 news/4292.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an issue with resolving packages with names defined by function calls in ``setup.py``.
1 change: 1 addition & 0 deletions news/4292.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated requirementslib to version ``1.5.11``.
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .models.pipfile import Pipfile
from .models.requirements import Requirement

__version__ = "1.5.10"
__version__ = "1.5.11"


logger = logging.getLogger(__name__)
Expand Down
20 changes: 20 additions & 0 deletions pipenv/vendor/requirementslib/models/setup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,16 @@ def parse_setup_function(self):
keys = list(setup.keys())
if len(keys) == 1 and keys[0] is None:
_, setup = setup.popitem()
keys = list(setup.keys())
for k in keys:
# XXX: Remove unresolved functions from the setup dictionary
if isinstance(setup[k], dict):
if not setup[k]:
continue
key = next(iter(setup[k].keys()))
val = setup[k][key]
if key in function_names and val is None or val == {}:
setup.pop(k)
return setup


Expand Down Expand Up @@ -1204,6 +1214,16 @@ def ast_parse_setup_py(path):
keys = list(setup.keys())
if len(keys) == 1 and keys[0] is None:
_, setup = setup.popitem()
keys = list(setup.keys())
for k in keys:
# XXX: Remove unresolved functions from the setup dictionary
if isinstance(setup[k], dict):
if not setup[k]:
continue
key = next(iter(setup[k].keys()))
val = setup[k][key]
if key in function_names and val is None or val == {}:
setup.pop(k)
return setup


Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requests==2.23.0
idna==2.9
urllib3==1.25.9
certifi==2020.4.5.1
requirementslib==1.5.10
requirementslib==1.5.11
attrs==19.3.0
distlib==0.3.0
packaging==20.3
Expand Down