zestsoftware / zest.releaser

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

postrelease fails with AttributeError: 'NoneType' object has no attribute 'find' in empty git repository #262

Closed mgedmin closed 6 years ago

mgedmin commented 6 years ago

I accidentally ran postrelease in the wrong directory and got this error:

Traceback (most recent call last):
  File "/home/mg/.venv/bin/postrelease", line 11, in <module>
    sys.exit(main())
  File "/home/mg/.venv/local/lib/python2.7/site-packages/zest/releaser/postrelease.py", line 102, in main
    postreleaser.run()
  File "/home/mg/.venv/local/lib/python2.7/site-packages/zest/releaser/baserelease.py", line 351, in run
    self.prepare()
  File "/home/mg/.venv/local/lib/python2.7/site-packages/zest/releaser/postrelease.py", line 50, in prepare
    self._ask_for_new_dev_version()
  File "/home/mg/.venv/local/lib/python2.7/site-packages/zest/releaser/postrelease.py", line 65, in _ask_for_new_dev_version
    current = utils.cleanup_version(current)
  File "/home/mg/.venv/local/lib/python2.7/site-packages/zest/releaser/utils.py", line 174, in cleanup_version
    if version.find(w) != -1:
AttributeError: 'NoneType' object has no attribute 'find'

Steps to reproduce:

mgedmin commented 6 years ago

(Edited the original description to accurately describe what the problem is. The original email notification was quite misleading, because I got confused. Sorry about that!)

mauritsvanrees commented 6 years ago

In prerelease we test for this and exit with a critical error. We should do the same here in postrelease. I will make a PR shortly.

mauritsvanrees commented 6 years ago

Thanks for the report. Fixed in 6.13.5.

mgedmin commented 6 years ago

Thank you!