1
0
forked from VimPlug/jedi

remove module_find_path, fixes #36

This commit is contained in:
David Halter
2012-11-18 01:17:12 +01:00
parent 5430d156ba
commit 95eab8e0d4
3 changed files with 8 additions and 6 deletions

View File

@@ -13,8 +13,8 @@ import debug
import parsing import parsing
module_find_path = sys.path[1:] def get_sys_path():
return sys.path[1:]
class CachedModule(object): class CachedModule(object):
""" """
@@ -84,7 +84,9 @@ class Parser(CachedModule):
module_cache = {} module_cache = {}
def __init__(self, path=None, name=None, sys_path=module_find_path): def __init__(self, path=None, name=None, sys_path=None):
if sys_path is None:
sys_path = get_sys_path()
if not name: if not name:
name = os.path.basename(path) name = os.path.basename(path)
name = name.rpartition('.')[0] # cut file type (normally .so) name = name.rpartition('.')[0] # cut file type (normally .so)

View File

@@ -211,7 +211,7 @@ class ImportPath(object):
sys_path_mod = list(self.sys_path_with_modifications()) sys_path_mod = list(self.sys_path_with_modifications())
sys_path_mod.insert(0, self.file_path) sys_path_mod.insert(0, self.file_path)
else: else:
sys_path_mod = list(builtin.module_find_path) sys_path_mod = list(builtin.get_sys_path())
current_namespace = None current_namespace = None
# now execute those paths # now execute those paths

View File

@@ -234,9 +234,9 @@ def sys_path_with_modifications(module):
try: try:
possible_stmts = module.used_names['path'] possible_stmts = module.used_names['path']
except KeyError: except KeyError:
return builtin.module_find_path return builtin.get_sys_path()
sys_path = list(builtin.module_find_path) # copy sys_path = list(builtin.get_sys_path()) # copy
for p in possible_stmts: for p in possible_stmts:
try: try:
call = p.get_assignment_calls().get_only_subelement() call = p.get_assignment_calls().get_only_subelement()