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

Unable to parse version that ends with ~ #39

Closed
sbrunner opened this issue Jun 8, 2024 · 2 comments · Fixed by #40
Closed

Unable to parse version that ends with ~ #39

sbrunner opened this issue Jun 8, 2024 · 2 comments · Fixed by #40

Comments

@sbrunner
Copy link
Contributor

sbrunner commented Jun 8, 2024

Get the version from https://packages.debian.org/bookworm/ruby-prawn.

import debian_inspector.version
debian_inspector.version.Version.from_string('2.4.0+dfsg-1~')

=>

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sbrunner/.pyenv/versions/3.11.9/lib/python3.11/site-packages/debian_inspector/version.py", line 141, in from_string
    raise ValueError('Invalid version string: "{}"'.format(version))
ValueError: Invalid version string: "2.4.0+dfsg-1~"

Expected result:

Version(epoch=0, upstream='2.4.0+dfsg', revision='1~')
@pombredanne
Copy link
Contributor

@sbrunner Thanks for the report! ... this trailing tilde is a weird thing, but that's a valid one.

Can I interest you in a patch? 😇

Reminder to self: there is a copy of the same parsing code in https://github.com/nexB/univers/blob/main/src/univers/debian.py and this was originally forked from @xolox https://github.com/xolox/python-deb-pkg-tools/tree/master/deb_pkg_tools/version which may have the same issue.

@pombredanne
Copy link
Contributor

I added aboutcode-org/univers#133 as follow up in "univers"

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 a pull request may close this issue.

2 participants