Commit 6cfd781c authored by Stefan Behnel's avatar Stefan Behnel

fix Py3k compiler crash due to new importlib

parent 63e4d374
...@@ -50,16 +50,18 @@ def path_exists(path): ...@@ -50,16 +50,18 @@ def path_exists(path):
# figure out if a PEP 302 loader is around # figure out if a PEP 302 loader is around
try: try:
loader = __loader__ loader = __loader__
# XXX the code below assumes as 'zipimport.zipimporter' instance # XXX the code below assumes a 'zipimport.zipimporter' instance
# XXX should be easy to generalize, but too lazy right now to write it # XXX should be easy to generalize, but too lazy right now to write it
if path.startswith(loader.archive): archive_path = getattr(loader, 'archive', None)
nrmpath = os.path.normpath(path) if archive_path:
arcname = nrmpath[len(loader.archive)+1:] normpath = os.path.normpath(path)
try: if normpath.startswith(archive_path):
loader.get_data(arcname) arcname = normpath[len(archive_path)+1:]
return True try:
except IOError: loader.get_data(arcname)
return False return True
except IOError:
return False
except NameError: except NameError:
pass pass
return False return False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment