forked from VimPlug/jedi
A small buildout script refactoring.
This commit is contained in:
@@ -203,8 +203,8 @@ def sys_path_with_modifications(evaluator, module_context):
|
|||||||
|
|
||||||
result = _check_module(module_context)
|
result = _check_module(module_context)
|
||||||
result += _detect_django_path(path)
|
result += _detect_django_path(path)
|
||||||
for buildout_script in _get_buildout_scripts(path):
|
for buildout_script_path in _get_buildout_script_paths(path):
|
||||||
for path in _get_paths_from_buildout_script(evaluator, buildout_script):
|
for path in _get_paths_from_buildout_script(evaluator, buildout_script_path):
|
||||||
buildout_script_paths.add(path)
|
buildout_script_paths.add(path)
|
||||||
# cleanup, back to old directory
|
# cleanup, back to old directory
|
||||||
os.chdir(curdir)
|
os.chdir(curdir)
|
||||||
@@ -262,7 +262,7 @@ def _detect_django_path(module_path):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def _get_buildout_scripts(module_path):
|
def _get_buildout_script_paths(module_path):
|
||||||
"""
|
"""
|
||||||
if there is a 'buildout.cfg' file in one of the parent directories of the
|
if there is a 'buildout.cfg' file in one of the parent directories of the
|
||||||
given module it will return a list of all files in the buildout bin
|
given module it will return a list of all files in the buildout bin
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from textwrap import dedent
|
|||||||
|
|
||||||
from jedi._compatibility import u
|
from jedi._compatibility import u
|
||||||
from jedi.evaluate.sys_path import (_get_parent_dir_with_file,
|
from jedi.evaluate.sys_path import (_get_parent_dir_with_file,
|
||||||
_get_buildout_scripts,
|
_get_buildout_script_paths,
|
||||||
sys_path_with_modifications,
|
sys_path_with_modifications,
|
||||||
_check_module)
|
_check_module)
|
||||||
from jedi.evaluate import Evaluator
|
from jedi.evaluate import Evaluator
|
||||||
@@ -30,7 +30,7 @@ def test_parent_dir_with_file():
|
|||||||
|
|
||||||
@cwd_at('test/test_evaluate/buildout_project/src/proj_name')
|
@cwd_at('test/test_evaluate/buildout_project/src/proj_name')
|
||||||
def test_buildout_detection():
|
def test_buildout_detection():
|
||||||
scripts = _get_buildout_scripts(os.path.abspath('./module_name.py'))
|
scripts = _get_buildout_script_paths(os.path.abspath('./module_name.py'))
|
||||||
assert len(scripts) == 1
|
assert len(scripts) == 1
|
||||||
curdir = os.path.abspath(os.curdir)
|
curdir = os.path.abspath(os.curdir)
|
||||||
appdir_path = os.path.normpath(os.path.join(curdir, '../../bin/app'))
|
appdir_path = os.path.normpath(os.path.join(curdir, '../../bin/app'))
|
||||||
|
|||||||
Reference in New Issue
Block a user