1
0
forked from VimPlug/jedi

Better handling of smart sys path

This commit is contained in:
Dave Halter
2018-02-16 11:57:58 +01:00
parent 30cfdee325
commit 863fbb3702
2 changed files with 13 additions and 9 deletions

View File

@@ -93,16 +93,20 @@ class Project(object):
Keep this method private for all users of jedi. However internally this
one is used like a public method.
"""
sys_path = list(self._get_base_sys_path(environment))
if evaluator.script_path is None or not self._smart_sys_path:
return sys_path
suffixed = []
prefixed = []
sys_path = list(self._get_base_sys_path(environment))
if self._smart_sys_path:
if evaluator.script_path is not None:
suffixed += detect_additional_paths(evaluator, evaluator.script_path)
suffixed.append(self._path)
if self._django:
prefixed.append(self._path)
added_paths = detect_additional_paths(evaluator, evaluator.script_path)
return _force_unicode_list(prefixed) + sys_path + _force_unicode_list(added_paths)
return _force_unicode_list(prefixed) + sys_path + _force_unicode_list(suffixed)
def save(self):
data = dict(self.__dict__)

View File

@@ -140,7 +140,7 @@ def detect_additional_paths(evaluator, script_path):
for path in _get_paths_from_buildout_script(evaluator, buildout_script_path):
buildout_script_paths.add(path)
return list(buildout_script_paths)
return buildout_script_paths
def _get_paths_from_buildout_script(evaluator, buildout_script_path):