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

fix: Correct check if a requirement is a direct requirement #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johbo
Copy link
Collaborator

@johbo johbo commented Nov 5, 2023

"r.comes_from" can be "None" if a requirement is directly specified and not listed in a requirements file.

I've noticed the following traceback:

ERROR: Exception:
Traceback (most recent call last):
  File "/nix/store/r3g6kc8h7li85wbsnnw07053kghc8wb2-python3.10-pip-20.1.1/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
    status = self.run(options, args)
  File "/nix/store/kvqpw2w6ck254qp99jn84y66yr3sg2nv-python3.10-pip2nix-0.9.0.dev1/lib/python3.10/site-packages/pip2nix/generate.py", line 343, in run
    with Contexter() as ctx:
  File "/nix/store/gda35s57qcxrmmfj28qw7n1izqs1zc25-python3.10-contexter-0.1.4/lib/python3.10/site-packages/contexter.py", line 96, in __exit__
    reraise(exc)
  File "/nix/store/gda35s57qcxrmmfj28qw7n1izqs1zc25-python3.10-contexter-0.1.4/lib/python3.10/site-packages/contexter.py", line 26, in reraise
    raise exc[1].with_traceback(exc[2])
  File "/nix/store/kvqpw2w6ck254qp99jn84y66yr3sg2nv-python3.10-pip2nix-0.9.0.dev1/lib/python3.10/site-packages/pip2nix/generate.py", line 346, in run
    requirement_set = self.super_run(options, args)
  File "/nix/store/kvqpw2w6ck254qp99jn84y66yr3sg2nv-python3.10-pip2nix-0.9.0.dev1/lib/python3.10/site-packages/pip2nix/generate.py", line 325, in super_run
    self.process_requirements(
  File "/nix/store/kvqpw2w6ck254qp99jn84y66yr3sg2nv-python3.10-pip2nix-0.9.0.dev1/lib/python3.10/site-packages/pip2nix/generate.py", line 88, in process_requirements
    packages_base = [
  File "/nix/store/kvqpw2w6ck254qp99jn84y66yr3sg2nv-python3.10-pip2nix-0.9.0.dev1/lib/python3.10/site-packages/pip2nix/generate.py", line 90, in <listcomp>
    if r.is_direct and not r.comes_from.startswith('-c ')]
AttributeError: 'NoneType' object has no attribute 'startswith'

Found the issue while running the following command:

pip2nix generate trytond

"r.comes_from" can be "None" if a requirement is directly specified and not
listed in a requirements file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant