1
0
forked from VimPlug/jedi
Files
jedi-fork/jedi/evaluate/project.py
Dave Halter 456ae20aac Start using the new virtualenv code
There used to be a lot of code to kind of understand virtualenvs. This can all be removed now, because this is done in a subprocess with the correct interpreter
2017-12-19 21:05:04 +01:00

34 lines
867 B
Python

from jedi.evaluate.sys_path import detect_additional_paths
from jedi.cache import memoize_method
class Project(object):
def __init__(self, sys_path=None):
self._script_path = None
self._base_sys_path = sys_path
def add_script_path(self, script_path):
self._script_path = script_path
def add_evaluator(self, evaluator):
self._evaluator = evaluator
@property
@memoize_method
def sys_path(self):
sys_path = self._base_sys_path
if sys_path is None:
sys_path = self._evaluator.environment.get_sys_path()
sys_path = list(sys_path)
try:
sys_path.remove('')
except ValueError:
pass
if self._script_path is None:
return sys_path
return sys_path + detect_additional_paths(self._evaluator, self._script_path)