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

setup.py: make version comply with PEP-440 #600

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

Conversation

crosser
Copy link

@crosser crosser commented Apr 24, 2023

Generating Python package version from git description makes a sensible string, but it does not comply with PEP-440. Starting from version 66, setuptools are very strict, and refuse to return result to any python package, if at least one unrelated package installed in the system has version that is not compliant with PEP-440.

Because the version of syncthing-gtk is not PEP-440 compliant, when it is installed from a .deb package (as opposed to in a venv/snap), system-wide aptdaemon crashes, and GUI upgrader cannot install any updates on the system at all:

File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1044, in init
self.scan(search_path)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1077, in scan
self.add(dist)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1096, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2631, in hashcmp
self.parsed_version,
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2679, in parsed_version
self._parsed_version = parse_version(self.version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/version.py", line 266, in init
raise InvalidVersion(f"Invalid version: '{version}'")
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: 'v0.9.4.4-ds-git20221205-12a9702d29ab'
(package: syncthing-gtk)

This change brings the version as used for Python package to compliance with PEP-440. This fixes apdaemon crash, and the distro can be upgraded again.

@crosser crosser force-pushed the make-version-pep440-compliant branch from 8c54266 to f797621 Compare April 24, 2023 17:56
Generating Python package version from git description makes a sensible
string, but it does not comply with PEP-440. Starting from version 66,
setuptools are very strict, and refuse to return result to _any_ python
package, if at least one _unrelated_ package installed in the system has
version that is not compliant with PEP-440.

Because the version of syncthing-gtk is not PEP-440 compliant, when it
is installed from a .deb package (as opposed to in a venv/snap),
system-wide `aptdaemon` crashes, and GUI upgrader cannot install any
updates on the system at all:

   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1044, in __init__
     self.scan(search_path)
   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1077, in scan
     self.add(dist)
   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1096, in add
     dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2631, in hashcmp
     self.parsed_version,
     ^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2679, in parsed_version
     self._parsed_version = parse_version(self.version)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/version.py", line 266, in __init__
     raise InvalidVersion(f"Invalid version: '{version}'")
 pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: 'v0.9.4.4-ds-git20221205-12a9702d29ab'
 (package: syncthing-gtk)

This change brings the version as used for Python package to compliance
with PEP-440. This fixes apdaemon crash, and the distro can be upgraded
again.

Signed-off-by: Eugene Crosser <evgenii.cherkashin@ionos.com>
@crosser crosser force-pushed the make-version-pep440-compliant branch from f797621 to 07282e5 Compare April 24, 2023 18:00
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.

None yet

1 participant