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

Parsing of Wheel version from PEP508 url does not completely extract version number #1931

Closed
3 tasks done
edwardgeorge opened this issue Jan 22, 2020 · 2 comments
Closed
3 tasks done
Assignees
Labels
kind/bug Something isn't working as expected

Comments

@edwardgeorge
Copy link
Contributor

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: MacOS 10.14.6 Mojave

  • Poetry version: 1.0.2

  • Link of a Gist with the contents of your pyproject.toml file: n/a

Issue

When a dependency has a dependency with a PEP508 '@' URI reference pointing to a wheel, and particularly when the version of the requirement is >=10 then the version it parses is incorrect. Specifically it only parses the first digit of the version number.

In our case, our dependency (here ourdep) has the following metadata:

Requires-Dist: log-setup @ https://.../log-setup/12/log_setup-14.0.0-py2.py3-none-any.whl

(private url censored)

Then we see in the debug logs:

   1: fact: ourdep (479) depends on log_setup (1)

And therefore pippi update -vvv fails with a SolverProblemError.

   1: conflict: ourdep (479) depends on log_setup (1)
   1: ! ourdep (479) is partially satisfied by not ourdep (>=457,<479 || >479)
   1: ! which is caused by "ourdep (>=457,<479 || >479) requires log-setup (1)"
   1: ! thus: ourdep (>=457) requires log-setup (1)
   1: ! not log-setup (1) is satisfied by log-setup (>=12)
   1: ! which is caused by "ourproject depends on log-setup (>=12)"
   1: ! thus: ourdep is forbidden
   1: ! ourdep (>=457) is satisfied by ourdep (>=457)
   1: ! which is caused by "ourproject depends on ourdep (>=457)"
   1: ! thus: version solving failed

This is caused by the regexp for wheels in poetry/packages/__init__.py in dependency_from_pep_508():

if link.is_wheel:
    m = re.match(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))", link.filename)

which is too non-greedy and only matches the first digit:

(Pdb) link.filename
'log_setup-14.0.0-py2.py3-none-any.whl'
(Pdb) re.match(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))", link.filename)
<re.Match object; span=(0, 11), match='log_setup-1'> 

As you can see from the pdb session above, it only matches log_setup-1 not log_setup-14 or log_setup-14.0.0.

@edwardgeorge edwardgeorge added the kind/bug Something isn't working as expected label Jan 22, 2020
@edwardgeorge
Copy link
Contributor Author

Fixed by #1932

Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

1 participant