46 @return the resulting dictionary |
46 @return the resulting dictionary |
47 ''' |
47 ''' |
48 ext = os.path.splitext(module)[1].lower() |
48 ext = os.path.splitext(module)[1].lower() |
49 |
49 |
50 if ext in __extensions["IDL"]: |
50 if ext in __extensions["IDL"]: |
51 import idlclbr |
51 from . import idlclbr |
52 dict = idlclbr.readmodule_ex(module, path) |
52 dict = idlclbr.readmodule_ex(module, path) |
53 idlclbr._modules.clear() |
53 idlclbr._modules.clear() |
54 elif ext in __extensions["Ruby"]: |
54 elif ext in __extensions["Ruby"]: |
55 import rbclbr |
55 from . import rbclbr |
56 dict = rbclbr.readmodule_ex(module, path) |
56 dict = rbclbr.readmodule_ex(module, path) |
57 rbclbr._modules.clear() |
57 rbclbr._modules.clear() |
58 elif ext in Preferences.getPython("PythonExtensions") or \ |
58 elif ext in Preferences.getPython("PythonExtensions") or \ |
59 ext in Preferences.getPython("Python3Extensions") or \ |
59 ext in Preferences.getPython("Python3Extensions") or \ |
60 isPyFile: |
60 isPyFile: |
61 import pyclbr |
61 from . import pyclbr |
62 dict = pyclbr.readmodule_ex(module, path, isPyFile = isPyFile) |
62 dict = pyclbr.readmodule_ex(module, path, isPyFile = isPyFile) |
63 pyclbr._modules.clear() |
63 pyclbr._modules.clear() |
64 else: |
64 else: |
65 # try Python if it is without extension |
65 # try Python if it is without extension |
66 import pyclbr |
66 from . import pyclbr |
67 dict = pyclbr.readmodule_ex(module, path) |
67 dict = pyclbr.readmodule_ex(module, path) |
68 pyclbr._modules.clear() |
68 pyclbr._modules.clear() |
69 |
69 |
70 return dict |
70 return dict |
71 |
71 |
107 return (open(pathname), pathname, (ext, 'r', PTL_SOURCE)) |
107 return (open(pathname), pathname, (ext, 'r', PTL_SOURCE)) |
108 raise ImportError |
108 raise ImportError |
109 |
109 |
110 if name.lower().endswith('.py'): |
110 if name.lower().endswith('.py'): |
111 name = name[:-3] |
111 name = name[:-3] |
112 if type(name) == type(u""): |
112 ## if isinstance(name, type("")): |
113 name = name.encode('utf-8') |
113 ## name = name.encode('utf-8') |
114 |
114 |
115 try: |
115 try: |
116 return imp.find_module(name, path) |
116 return imp.find_module(name, path) |
117 except ImportError: |
117 except ImportError: |
118 if name.lower().endswith(tuple(Preferences.getPython("PythonExtensions") + \ |
118 if name.lower().endswith(tuple(Preferences.getPython("PythonExtensions") + \ |