py2deb icon indicating copy to clipboard operation
py2deb copied to clipboard

Problem with PEP 440 pre-release versions

Open teskje opened this issue 8 years ago • 3 comments

The versioning scheme defined in PEP 440 (https://www.python.org/dev/peps/pep-0440/) includes pre-release versions. For example, version 1.0a2 is the second alpha version of the 1.0 release. Thus, version 1.0a2 comes before version 1.0 (1.0a2 < 1.0). However, the Debian versioning works differently (https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version). Here, it holds that 1.0 < 1.0a2.

py2deb doesn't handle this inconsistency in any way, which leads to problems. For example, let's take the PyPI package pyramid 1.7 (https://pypi.python.org/pypi/pyramid/1.7), which requires venusian (>=1.0a3). There is already a version 1.0 of venusian. Thus, when we invoke py2deb on pyramid 1.7, it creates (among others) a .deb for pyramid 1.7 and one for venusian 1.0. The pyramid .deb specifies a dependency on venusian (>= 1.0a3). When we now try to install those .debs with dpkg, this dependency is checked. dpkg looks for a venusian .deb with version >= 1.0a3, but finds only one with version 1.0, which (according to Debian versioning) is less than 1.0a3. Thus the install fails.

I think the quickest fix would be to replace to simply insert a ~ before every pre-release part (e.g. 1.0a2 becomes 1.0~a2). According to Debians versioning, ~ is smaller than the empty string, so this would fix the problem. There might be other problematic inconsistencies between PEP 440 and Debian versioning, though.

teskje avatar Jan 09 '17 20:01 teskje

I also bumped into this...

2017-05-22 07:51:21 v2g-dev pip.download[17131] INFO File was already downloaded /var/cache/pip-accel/sources/uModbus-0.8.2.tar.gz
2017-05-22 07:51:21 v2g-dev pip.req.req_set[17131] INFO Collecting pyserial~=3.2.1 (from uModbus)
2017-05-22 07:51:21 v2g-dev pip.download[17131] INFO File was already downloaded /var/cache/pip-accel/sources/pyserial-3.2.1.tar.gz
2017-05-22 07:51:22 v2g-dev pip.commands.install[17131] INFO Successfully downloaded uModbus pyserial
2017-05-22 07:51:22 v2g-dev pip_accel[17131] INFO Finished unpacking 2 distributions in 0.6 seconds.
2017-05-22 07:51:22 v2g-dev py2deb.converter[17131] INFO Package pyserial (3.2.1) already converted: /tmp/python3-pyserial_3.2.1_all.deb
2017-05-22 07:51:22 v2g-dev py2deb.cli[17131] ERROR Caught an unhandled exception!
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/py2deb/cli.py", line 192, in main
    archives, relationships = converter.convert(arguments)
  File "/usr/local/lib/python3.5/dist-packages/py2deb/converter.py", line 524, in convert
    archive = package.convert()
  File "/usr/local/lib/python3.5/dist-packages/py2deb/package.py", line 383, in convert
    dependencies = [python_version()] + self.debian_dependencies
  File "/usr/local/lib/python3.5/dist-packages/cached_property.py", line 26, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/lib/python3.5/dist-packages/py2deb/package.py", line 318, in debian_dependencies
    raise Exception(msg % (constraint, self.python_name))
Exception: Conversion specifier not supported! ('~=' used by Python package uModbus)

oz123 avatar May 22 '17 07:05 oz123

Hi Jan and thanks for the feedback!

I've just released py2deb version 1.0 which contains the quick fix you suggested.

Since the previous release (0.25) I've only made bug fixes (i.e. no features were added) however the change you suggested is backwards incompatible, this is why I've decided to bump the major version number.


With regards to the Conversion specifier not supported error reported by Oz:

I just took a look at PEP 440 and I guess implementing support for ~= would require more detailed manipulation of version numbers than py2deb currently does. I suppose that expressions like name ~= 1.5 would have to be translated to name (>= 1.5), name (<< 1.6) which requires parsing the version number to increment the last digit. This becomes a lot more complicated with release identifiers such as 'a', 'b', 'c', 'rc' and 'post'. Suggestions are welcome.

xolox avatar Aug 07 '17 22:08 xolox

How can I disable this? I appended by git commit hash to my version, and it happened to contain an rc substring. So, now this adds a ~ into my .deb:

Version: 0.1.0.d9c2fc8 Artifact created: client_0.1.0-d9**~rc**2fc8_all.deb

swarkentin avatar May 24 '19 04:05 swarkentin