]> git.phdru.name Git - dotfiles.git/blobdiff - .vim/python/virtualenv.py
.vim/rc: Adapt python code to both python and python3
[dotfiles.git] / .vim / python / virtualenv.py
diff --git a/.vim/python/virtualenv.py b/.vim/python/virtualenv.py
new file mode 100644 (file)
index 0000000..3b76fcd
--- /dev/null
@@ -0,0 +1,10 @@
+import sys, os
+
+virtualenv_dir = os.environ.get('VIRTUAL_ENV')
+if virtualenv_dir:
+    sys.path.insert(0, virtualenv_dir)
+    activate_this = os.path.join(virtualenv_dir, 'bin', 'activate_this.py')
+    if sys.version_info[0] == 2:
+        execfile(activate_this, dict(__file__=activate_this))
+    else:
+        exec(open(activate_this, 'rU').read(), dict(__file__=activate_this))