2013-06-25 58 views
2

我有一些virtualenvwrapper掛鉤,我在~/.virtualenvs(我爲$WORKON_HOME變量定義的目錄)下創建。

我通常喜歡在版本控制下保存這樣的系統文件 - 例如,我有一個非常高度定製的bash配置文件~/Repos/dotfiles/bash_profile,它符號鏈接到~/.bash_profile

然而,當我試圖~/Repos/dotfiles/virtualenvwrapper_hooks/下移動virtualenvwrapper掛鉤,然後符號鏈接他們回到他們原來的文件名~/.virtualenvs/下,我得到了下面的錯誤,當我打開了一個新的終端窗口:

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' 

符號鏈接的整個目錄(rm -rf ~/.virtualenvs ; ln -sF ...)也不起作用,因爲當我試圖製表完整的命令,它給回:

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

短創造了01一個Git回購,我想知道在版本控制下保留這些鉤子有哪些其他選項?

回答

1

我發現了!

在我沮喪的時候,當我嘗試符號鏈接整個目錄時,我意外地指出了一個相對路徑而不是絕對路徑。符號鏈接絕對路徑(protip:$PWD/將tab-complete到OS X中的完整路徑)將工作:)