Permalink
Browse files

support for virtual envs, #36, fixes jedi-vim issue 31

  • Loading branch information...
davidhalter committed Nov 18, 2012
1 parent ed7c004 commit 580a4f4ab019a09fed6975f0a26065d16f767b98
Showing with 13 additions and 1 deletion.
  1. +13 −1 jedi/builtin.py
View
@@ -14,7 +14,19 @@
def get_sys_path():
- return sys.path[1:]
+ def check_virtual_env(sys_path):
+ """ Add virtualenv's site-packages to the `sys.path`."""
+ venv = os.getenv('VIRTUAL_ENV')
+ if not venv:
+ return
+ venv = os.path.abspath(venv)
+ p = os.path.join(
+ venv, 'lib', 'python%d.%d' % sys.version_info[:2], 'site-packages')
+ sys_path.insert(0, p)
+
+ p = sys.path[1:]
+ check_virtual_env(p)
+ return p
class CachedModule(object):
"""

0 comments on commit 580a4f4

Please sign in to comment.