peritus / bumpversion

Version-bump your software with a single command
https://pypi.python.org/pypi/bumpversion
MIT License
1.5k stars 148 forks source link

bumpversion crash when mercurial (`hg`) is not installed #160

Open dankeder opened 7 years ago

dankeder commented 7 years ago

Description

Bumpversion crashes when Mercurial is not installed (there's no command hg in $PATH).

How to reproduce

» bumpversion                                                                                                                                                                                                                                                        
Traceback (most recent call last):
  File "/home/dan/programs/python36-env/bin/bumpversion", line 11, in <module>
    sys.exit(main())
  File "/home/dan/programs/python36-env/lib/python3.6/site-packages/bumpversion/__init__.py", line 658, in main
    if vcs.is_usable():
  File "/home/dan/programs/python36-env/lib/python3.6/site-packages/bumpversion/__init__.py", line 83, in is_usable
    stdout=subprocess.PIPE
  File "/usr/lib64/python3.6/subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib64/python3.6/subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1326, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied

Expected behaviour

Bumpversion should continue with the next VCS backend. If no VCS is detected it should report this fact to the user.

Update: It only happens with python3. In python2, it works.

lowell80 commented 5 years ago

I encountered and fixed the same issue on my local system. See #204 for a fix.

BTW. I experienced this issue on Python 2.7 on Linux.

lowell80 commented 5 years ago

Since this repo seems to be no longer maintained; I submitted the same fix to the bump2version team over at https://github.com/c4urself/bump2version/. Prior to this I didn't realize a fork had occurred. Note that both are available as bumpversion on the CLI, so it's a drop-in replacement.

Hopefully this note saves someone else some time.