@@ -17,6 +17,7 @@ def _py_abspath(path):
17
17
that will leave paths from jython jars alone
18
18
"""
19
19
if path .startswith ('__pyclasspath__' ):
20
+
20
21
return path
21
22
else :
22
23
return os .path .abspath (path )
@@ -41,7 +42,7 @@ def initpkg(pkgname, exportdefs, attr=dict()):
41
42
if hasattr (oldmod , "__dict__" ):
42
43
oldmod .__dict__ .update (d )
43
44
mod = ApiModule (pkgname , exportdefs , implprefix = pkgname , attr = d )
44
- sys .modules [pkgname ] = mod
45
+ sys .modules [pkgname ] = mod
45
46
46
47
def importobj (modpath , attrname ):
47
48
module = __import__ (modpath , None , None , ['__doc__' ])
@@ -72,11 +73,11 @@ def __init__(self, name, importspec, implprefix=None, attr=None):
72
73
self .__implprefix__ = implprefix or name
73
74
if attr :
74
75
for name , val in attr .items ():
75
- #print "setting", self.__name__, name, val
76
+ # print "setting", self.__name__, name, val
76
77
setattr (self , name , val )
77
78
for name , importspec in importspec .items ():
78
79
if isinstance (importspec , dict ):
79
- subname = '%s.%s' % (self .__name__ , name )
80
+ subname = '%s.%s' % (self .__name__ , name )
80
81
apimod = ApiModule (subname , importspec , implprefix )
81
82
sys .modules [subname ] = apimod
82
83
setattr (self , name , apimod )
@@ -88,7 +89,7 @@ def __init__(self, name, importspec, implprefix=None, attr=None):
88
89
modpath = implprefix + modpath
89
90
90
91
if not attrname :
91
- subname = '%s.%s' % (self .__name__ , name )
92
+ subname = '%s.%s' % (self .__name__ , name )
92
93
apimod = AliasModule (subname , modpath )
93
94
sys .modules [subname ] = apimod
94
95
if '.' not in name :
@@ -108,7 +109,7 @@ def __repr__(self):
108
109
109
110
def __makeattr (self , name ):
110
111
"""lazily compute value for name or raise AttributeError if unknown."""
111
- #print "makeattr", self.__name__, name
112
+ # print "makeattr", self.__name__, name
112
113
target = None
113
114
if '__onfirstaccess__' in self .__map__ :
114
115
target = self .__map__ .pop ('__onfirstaccess__' )
@@ -126,7 +127,7 @@ def __makeattr(self, name):
126
127
try :
127
128
del self .__map__ [name ]
128
129
except KeyError :
129
- pass # in a recursive-import situation a double-del can happen
130
+ pass # in a recursive-import situation a double-del can happen
130
131
return result
131
132
132
133
__getattr__ = __makeattr
@@ -166,7 +167,10 @@ def __repr__(self):
166
167
return '<AliasModule %r for %r>' % (modname , x )
167
168
168
169
def __getattribute__ (self , name ):
169
- return getattr (getmod (), name )
170
+ try :
171
+ return getattr (getmod (), name )
172
+ except ImportError :
173
+ return None
170
174
171
175
def __setattr__ (self , name , value ):
172
176
setattr (getmod (), name , value )
0 commit comments