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

Problem with PEP 440 pre-release versions #8

Open
teskje opened this issue Jan 9, 2017 · 3 comments
Open

Problem with PEP 440 pre-release versions #8

teskje opened this issue Jan 9, 2017 · 3 comments

Comments

@teskje
Copy link
Contributor

teskje commented Jan 9, 2017

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.

@oz123
Copy link

oz123 commented May 22, 2017

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)

xolox added a commit that referenced this issue Aug 7, 2017
…ible!)

Since the previous release (0.25) I've only made bug fixes
(i.e. no features were added) however the change related
to #8 is backwards incompatible, which is why I've decided
to bump the major version number.
@xolox
Copy link
Member

xolox commented Aug 7, 2017

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.

@swarkentin
Copy link

swarkentin commented May 24, 2019

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

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

No branches or pull requests

4 participants