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

avocado.utils.kernel.check_version is broken with imports and actual check #6058

Open
clebergnu opened this issue Oct 29, 2024 · 0 comments
Open
Assignees
Labels

Comments

@clebergnu
Copy link
Contributor

Describe the bug
Commit 58738b6 fixed an import time compatibility issue on avocado.utils.kernel with regards to either pkg_resources or packaging.

That in fact only masked some other problems:

  1. The version module is not directly accessible in packaging
  2. The behavior of version.parse() is different between the one coming from pkg_resources and from packaging.

Steps to reproduce
To reproduce 1, run:

python3 -c 'import packaging; packaging.version.parse("1.2.3")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'packaging' has no attribute 'version'

To reproduce 2, on a system with packaging, run:

$ python3 -c 'from packaging.version import parse; parse("6.11.4-201.fc40.x86_64")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.12/site-packages/packaging/version.py", line 54, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '6.11.4-201.fc40.x86_64'

While on a system with pkg_resources you'd get:

python3 -c 'import pkg_resources; print(pkg_resources.packaging.version.parse("6.11.4-201.fc40.x86_64"))'
6.11.4-201.fc40.x86_64
@clebergnu clebergnu added the bug label Oct 29, 2024
@mr-avocado mr-avocado bot moved this to Triage in Default project Oct 29, 2024
@richtja richtja moved this from Triage to In progress in Default project Oct 29, 2024
@richtja richtja added this to the 109 - Codename TBD milestone Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In progress
Development

No branches or pull requests

2 participants