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

RuntimeError: Cannot set version #216

Closed stevepiercy closed 7 years ago

stevepiercy commented 7 years ago

I am trying to move my project's release process from manual to zest.releaser. This is my first time using zest.releaser, so I might be using it incorrectly. I am trying to set a new release number, but it fails to set the new version number, going from 0.3.1 to 1.0. I have these relevant lines in my setup.py:

VERSION = '0.3.1'
#...
setup(name='pylons-sphinx-themes',
      version=VERSION,

See transcript and traceback below.

I searched through the issue tracker and source code, but didn't find an answer.

Any help appreciated.

Steves-iMac:pylons-sphinx-themes stevepiercy$ env35/bin/prerelease -v
DEBUG: Running command: '/Users/stevepiercy/projects/pylons-sphinx-themes/env35/bin/python setup.py egg_info'
DEBUG: Running command: '/Users/stevepiercy/projects/pylons-sphinx-themes/env35/bin/python setup.py --name'
Run pyroma on the package before tagging? (Y/n)? n
Do you want to run check-manifest? (Y/n)? n
DEBUG: Running command: 'git symbolic-ref --quiet HEAD'
DEBUG: Running command: 'git status --short --untracked-files=no'
This package is missing a MANIFEST.in file. This file is
recommended. See http://docs.python.org/distutils/sourcedist.html for
more info. Sample contents:

recursive-include main_directory *
recursive-include docs *
include *
global-exclude *.pyc

You may want to quit and fix this.
Do you want to continue with the release? (y/N)? y
This package is missing a MANIFEST.in file. This file is
recommended. See http://docs.python.org/distutils/sourcedist.html for
more info. Sample contents:

recursive-include main_directory *
recursive-include docs *
include *
global-exclude *.pyc

You may want to quit and fix this.
Do you want to continue with the release?
DEBUG: Running command: '/Users/stevepiercy/projects/pylons-sphinx-themes/env35/bin/python setup.py egg_info'
DEBUG: Running command: '/Users/stevepiercy/projects/pylons-sphinx-themes/env35/bin/python setup.py --version'
DEBUG: Extracted version: 0.3.1
DEBUG: Running command: 'git ls-tree -r HEAD --name-only'
DEBUG: Found CHANGES.txt
DEBUG: Checking CHANGES.txt
DEBUG: Detected encoding of CHANGES.txt with tokenize: utf-8
DEBUG: Found heading: {'version': '1.0', 'line': 3, 'date': 'unreleased'}
DEBUG: Found heading: {'version': '0.3.1', 'line': 10, 'date': '2015-04-15'}
DEBUG: Found heading: {'version': '0.3', 'line': 16, 'date': '2015-04-15'}
Changelog entries for version 0.3.1:

1.0 (unreleased)
----------------

- Use zest.releaser for releasing.
- Improve documentation.

0.3.1 (2015-04-15)
------------------
DEBUG: Running command: '/Users/stevepiercy/projects/pylons-sphinx-themes/env35/bin/python setup.py egg_info'
DEBUG: Running command: '/Users/stevepiercy/projects/pylons-sphinx-themes/env35/bin/python setup.py --version'
DEBUG: Extracted version: 0.3.1
Enter version [0.3.1]: 1.0
DEBUG: Set heading from '1.0 (unreleased)' to '1.0 (2017-04-16)'.
DEBUG: Set line below heading to '----------------'
DEBUG: Running command: 'git ls-tree -r HEAD --name-only'
DEBUG: Detected encoding of setup.py with tokenize: utf-8
ERROR: We could read a version from setup.py, but could not write it back. See http://zestreleaser.readthedocs.io/en/latest/versions.html for hints.
Traceback (most recent call last):
  File "env35/bin/prerelease", line 11, in <module>
    sys.exit(main())
  File "/Users/stevepiercy/projects/pylons-sphinx-themes/env35/lib/python3.5/site-packages/zest/releaser/prerelease.py", line 103, in main
    prereleaser.run()
  File "/Users/stevepiercy/projects/pylons-sphinx-themes/env35/lib/python3.5/site-packages/zest/releaser/baserelease.py", line 353, in run
    self.execute()
  File "/Users/stevepiercy/projects/pylons-sphinx-themes/env35/lib/python3.5/site-packages/zest/releaser/prerelease.py", line 67, in execute
    self._write_version()
  File "/Users/stevepiercy/projects/pylons-sphinx-themes/env35/lib/python3.5/site-packages/zest/releaser/baserelease.py", line 283, in _write_version
    self.vcs.version = self.data['new_version']
  File "/Users/stevepiercy/projects/pylons-sphinx-themes/env35/lib/python3.5/site-packages/zest/releaser/vcs.py", line 263, in _update_version
    raise RuntimeError("Cannot set version")
RuntimeError: Cannot set version
stevepiercy commented 7 years ago

The problem was that zest.releaser is case-sensitive for replacement of "version". Making the change by lowercasing VERSION in my setup.py resolves the issue:

version = '0.3.1'
#...
setup(name='pylons-sphinx-themes',
      version=version,

Should this issue be a docs update, a feature request, or a bug report? I'll submit a PR for whatever the maintainers think is most appropriate.

reinout commented 7 years ago

Nice corner case! Well found.

To me, it is a bug. Uppercase VERSION should be OK. I think I can fix it pretty quickly, I'll try that first.

reinout commented 7 years ago

See #217

stevepiercy commented 7 years ago

Yup, that works. Thank you! I made a comment on the PR to uppercase "version" in its comment.

reinout commented 7 years ago

Can you try 6.10, just to make sure?

stevepiercy commented 7 years ago

Confirmed! Thanks for the quick turnaround.