zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
201 stars 62 forks source link

Handle PEP 440 Local version identifiers (with "+" sign) #220

Closed laulaz closed 7 years ago

laulaz commented 7 years ago

When you want to release a package with + in its version (example : z3c.form 3.2.11+mycompany), the + is automatically changed into -when releasing. Unfortunately + is the only way to add local version and stay compatible with buildout and setuptools requirements :

(Pdb) '3.2.11-mycompany' in Requirement.parse('z3c.form>=3.0.0a1')
False
(Pdb) '3.2.11.mycompany' in Requirement.parse('z3c.form>=3.0.0a1')
False
(Pdb) '3.2.11+mycompany' in Requirement.parse('z3c.form>=3.0.0a1')
True

See here for details : https://www.python.org/dev/peps/pep-0440/#id23

The console log of a release (changing + into -) is :

INFO: Doing a checkout...
Note: checking out '3.2.11+mycompany'.

HEAD is now at a98ebd1... Preparing release 3.2.11+mycompany
INFO: Tag checkout placed in /private/var/folders/vD/vDv5nbN4E281TopcFoq6CU+++TI/-Tmp-/z3c.form-3.2.11+mycompany-7QAocj/gitclone
INFO: Changing to sub directory in tag checkout: /private/var/folders/vD/vDv5nbN4E281TopcFoq6CU+++TI/-Tmp-/z3c.form-3.2.11+mycompany-7QAocj/gitclone
INFO: Making a source distribution of a fresh tag checkout (in /private/var/folders/vD/vDv5nbN4E281TopcFoq6CU+++TI/-Tmp-/z3c.form-3.2.11+mycompany-7QAocj/gitclone).
Showing first few lines...
running sdist
running egg_info
creating src/z3c.form.egg-info
writing requirements to src/z3c.form.egg-info/requires.txt
writing src/z3c.form.egg-info/PKG-INFO
...
Showing last few lines...
Writing z3c.form-3.2.11-mycompany/setup.cfg
creating dist
Creating tar archive
removing 'z3c.form-3.2.11-mycompany' (and everything under it)

Showing first few lines...
running sdist
running egg_info
creating src/z3c.form.egg-info
writing requirements to src/z3c.form.egg-info/requires.txt
writing src/z3c.form.egg-info/PKG-INFO
...
Showing last few lines...
Writing z3c.form-3.2.11-mycompany/setup.cfg
creating dist
Creating tar archive
removing 'z3c.form-3.2.11-mycompany' (and everything under it)
laulaz commented 7 years ago

I see that in documentation :

So: with any setuptools version you can specify a local version identifier (+something) in the setup.py, but you need setuptools 8.0+ to correctly handle it. In earlier versions, the plus sign is replaced by a dash. This may lead to problems while installing; we will see that below.

Indeed, upgrading it changed the behaviour.

reinout commented 7 years ago

Ok :-)