Finally make it possible to use auto_import_modules for packages
This means that you can now write 'from gi.repository import Gtk' and Gtk completions work. It also means that other libraries could be used like that for speed or other reasons. Fixes #531
This commit is contained in:
1 parent
5b7984c4d4
commit
f4aad8bbfe
5 files changed
+33
-6
No files matched your search
@@ -150,7 +150,7 @@ def load_module(evaluator, path=None, name=None, sys_path=None):
|
||||
__import__(dotted_path)
|
||||
except ImportError:
|
||||
# If a module is "corrupt" or not really a Python module or whatever.
|
||||
debug.warning('Module %s not importable in path %s.', dotted_path, path)
|
||||
print_to_stderr('Module %s not importable in path %s.' % (dotted_path, path))
|
||||
return None
|
||||
except Exception:
|
||||
# Since __import__ pretty much makes code execution possible, just
|
||||
@@ -262,6 +262,9 @@ class DirectObjectAccess(object):
|
||||
def py__bases__(self):
|
||||
return [self._create_access_path(base) for base in self._obj.__bases__]
|
||||
|
||||
def py__path__(self):
|
||||
return self._obj.__path__
|
||||
|
||||
@_force_unicode_decorator
|
||||
def get_repr(self):
|
||||
builtins = 'builtins', '__builtin__'
|
||||
|
||||
@@ -81,6 +81,10 @@ class CompiledObject(Context):
|
||||
for access in self.access_handle.py__bases__()
|
||||
)
|
||||
|
||||
@CheckAttribute
|
||||
def py__path__(self):
|
||||
return self.access_handle.py__path__()
|
||||
|
||||
def py__bool__(self):
|
||||
return self.access_handle.py__bool__()
|
||||
|
||||
|
||||
Reference in new issue
Block a user