Question

I have a number of virtualenvwrapper hooks that I've created under ~/.virtualenvs (the directory I've defined for the $WORKON_HOME variable).

I usually like to keep system files like this under version control - for example, I have a pretty highly customized bash profile ~/Repos/dotfiles/bash_profile that is symlinked to ~/.bash_profile.

However, when I tried moving the virtualenvwrapper hooks under ~/Repos/dotfiles/virtualenvwrapper_hooks/ and then symlinking them back to their original filenames under ~/.virtualenvs/, I got the following error when I opened up a new Terminal window:

stevedore.extension error calling 'user_scripts': [Errno 62] Too many levels of symbolic links: '/Users/yiqing/.virtualenvs/postactivate'
stevedore.extension [Errno 62] Too many levels of symbolic links: '/Users/yiqing/.virtualenvs/postactivate'
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/stevedore/extension.py", line 137, in _invoke_one_plugin
    response_callback(func(e, *args, **kwds))
  File "/Library/Python/2.7/site-packages/virtualenvwrapper/hook_loader.py", line 185, in invoke
    ext.plugin(args)
  File "/Library/Python/2.7/site-packages/virtualenvwrapper/user_scripts.py", line 143, in initialize
    make_hook(get_path('$VIRTUALENVWRAPPER_HOOK_DIR', filename), comment)
  File "/Library/Python/2.7/site-packages/virtualenvwrapper/user_scripts.py", line 124, in make_hook
    f = open(filename, 'w')
IOError: [Errno 62] Too many levels of symbolic links: '/Users/yiqing/.virtualenvs/postactivate'

Symlinking the entire directory (rm -rf ~/.virtualenvs ; ln -sF ...) doesn't work either, because then when I attempt to tab-complete a command, it gives back:

NOTE: Virtual environments directory /Users/yiqing/.virtualenvs does not exist. Creating...
mkdir: /Users/yiqing/.virtualenvs: Input/output error

Short of creating a Git repo in ~/.virtualenvs, I'm wondering what other options I have for keeping these hooks under version control?

Était-ce utile?

La solution

I FIGURED IT OUT!

In my frustration, when I tried symlinking the entire directory, I accidentally indicated a relative path rather than an absolute path. Symlinking the absolute path (protip: $PWD/ will tab-complete to the full path in OS X) will work :)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top