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

bump2version installed in virtualenv - error #139

Closed
jonathan-s opened this issue May 3, 2020 · 7 comments · Fixed by #187
Closed

bump2version installed in virtualenv - error #139

jonathan-s opened this issue May 3, 2020 · 7 comments · Fixed by #187
Assignees
Labels

Comments

@jonathan-s
Copy link

I tried to get bump2version working. The command that I ran was bump2version --help

The traceback that I get is the following.

Traceback (most recent call last):
  File "/Users/jonathan/projects/foxflash-backend/django-sockpuppet/venv/bin/bump2version", line 8, in <module>
    sys.exit(main())
  File "/Users/jonathan/projects/foxflash-backend/django-sockpuppet/venv/lib/python3.6/site-packages/bumpversion/cli.py", line 71, in main
    vcs_info = _determine_vcs_usability()
  File "/Users/jonathan/projects/foxflash-backend/django-sockpuppet/venv/lib/python3.6/site-packages/bumpversion/cli.py", line 205, in _determine_vcs_usability
    if vcs.is_usable():
  File "/Users/jonathan/projects/foxflash-backend/django-sockpuppet/venv/lib/python3.6/site-packages/bumpversion/vcs.py", line 50, in is_usable
    stdout=subprocess.PIPE,
  File "/Users/jonathan/.pyenv/versions/3.6.1/lib/python3.6/subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Users/jonathan/.pyenv/versions/3.6.1/lib/python3.6/subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "/Users/jonathan/.pyenv/versions/3.6.1/lib/python3.6/subprocess.py", line 1326, in _execute_child
    raise child_exception_type(errno_num, err_msg)
NotADirectoryError: [Errno 20] Not a directory
@florisla
Copy link
Collaborator

It looks like the error occurs when bumpversion checks for the presence of git or hg.

These are the commands it calls:

git rev-parse --git-dir
hg root

Could you check if these commands are functional when the virtualenv is activated?

@florisla florisla added the bug label May 25, 2020
@florisla
Copy link
Collaborator

The code checks for errors ENOENT or EACCES, but not for ENOTDIR. Not sure which directory is assumed to be present though.

@jonathan-s
Copy link
Author

jonathan-s commented May 25, 2020

When running git rev-parse --git-dir I get the output .git. I don't use mercurial. I might add that I get the error even without virtualenv. Ie with or without virtualenv I get the error.

I'm using pyenv if that can be of assistance.

@florisla
Copy link
Collaborator

I don't have access to an OS X machine... Could you do the following as a test?

In File /Users/jonathan/projects/foxflash-backend/django-sockpuppet/venv/lib/python3.6/site-packages/bumpversion/vcs.py line 55, replace

            if e.errno in (errno.ENOENT, errno.EACCES):

with

            if e.errno in (errno.ENOENT, errno.EACCES, errno.ENOTDIR): 

And then check if bump2version behaves as it should.

@dmitriibeliakov
Copy link

I can confirm that the edit above works.
I had this error on my Mac:

Traceback (most recent call last):
  File "/Users/dima/miniconda3/envs/rules-spacy-model-new/bin/bumpversion", line 8, in <module>
    sys.exit(main())
  File "/Users/dima/miniconda3/envs/rules-spacy-model-new/lib/python3.7/site-packages/bumpversion/cli.py", line 71, in main
    vcs_info = _determine_vcs_usability()
  File "/Users/dima/miniconda3/envs/rules-spacy-model-new/lib/python3.7/site-packages/bumpversion/cli.py", line 205, in _determine_vcs_usability
    if vcs.is_usable():
  File "/Users/dima/miniconda3/envs/rules-spacy-model-new/lib/python3.7/site-packages/bumpversion/vcs.py", line 50, in is_usable
    stdout=subprocess.PIPE,
  File "/Users/dima/miniconda3/envs/rules-spacy-model-new/lib/python3.7/subprocess.py", line 339, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Users/dima/miniconda3/envs/rules-spacy-model-new/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/Users/dima/miniconda3/envs/rules-spacy-model-new/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: 'hg'

git rev-parse --git-dir returns .git as it should. I don't use mercurial.

Just to confirm that this actually helps.

@pohutukawa
Copy link

@florisla @ekohl When is the next release due? This bug's been more than a year old, and fixed more than a year ago. I also didn't see it tagged with the "next release". So it might be a nice idea to do a patch release (bumpversion patch) to help ease the pain for those using Macs ...

@ekohl
Copy link
Collaborator

ekohl commented Jun 24, 2021

I must admit that I've been really swamped with other work and in practice don't really use bumpversion anymore. Perhaps it's time to evaluate maintainership.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants