kozec / syncthing-gtk

GTK3 & python based GUI for Syncthing
GNU General Public License v2.0
1.28k stars 138 forks source link

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

Open crosser opened 1 year ago

crosser commented 1 year ago

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.