mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-25 09:48:36 +08:00
support for virtual envs, #36, fixes jedi-vim issue 31
This commit is contained in:
+13
-1
@@ -14,7 +14,19 @@ import parsing
|
|||||||
|
|
||||||
|
|
||||||
def get_sys_path():
|
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):
|
class CachedModule(object):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user