setup.py: make version comply with PEP-440 #600
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.