befeleme / pyp2spec

Generate Fedora RPM spec files for Python packages
MIT License
11 stars 4 forks source link

Upstream version can contain `-`, considered illegal character by RPM #20

Closed befeleme closed 2 years ago

befeleme commented 2 years ago

And hence SRPM can't be built.

stderr: error: line 2: Illegal char '-' (0x2d) in: Version:        3.32.1.7-1
hroncok commented 2 years ago

See also https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/457WHHCNN5UZ3G2ITACLVTMN2AVRYPJS/

befeleme commented 2 years ago

Some of those versions are actually valid ones (according to PEP 440) and can be transformed to a correct RPM version scheme. There is a library for that: https://github.com/gordonmessmer/pyreq2rpm/blob/master/pyreq2rpm/pyreq2rpm.py - which is also used in pyproject-rpm-macros. The PyPI version shouldn't be used 1:1, the transformation to RPM version scheme should happen in pyp2spec as well.

hroncok commented 2 years ago

Note that pyreq2rpm also strips trailing .0s so you probably cannot reuse it as is.