|
|
|
@ -679,8 +679,13 @@ def find_package(import_name):
|
|
|
|
|
filename = sys.modules[import_name].__file__ |
|
|
|
|
package_path = os.path.abspath(os.path.dirname(filename)) |
|
|
|
|
# package_path ends with __init__.py for a package |
|
|
|
|
if loader.is_package(root_mod_name): |
|
|
|
|
package_path = os.path.dirname(package_path) |
|
|
|
|
if hasattr(loader, 'is_package'): |
|
|
|
|
if loader.is_package(root_mod_name): |
|
|
|
|
package_path = os.path.dirname(package_path) |
|
|
|
|
else: |
|
|
|
|
raise AttributeError( |
|
|
|
|
('%s.is_package() method is missing but is ' |
|
|
|
|
'required by Flask of PEP 302 import hooks') % loader.__class__.__name__) |
|
|
|
|
|
|
|
|
|
site_parent, site_folder = os.path.split(package_path) |
|
|
|
|
py_prefix = os.path.abspath(sys.prefix) |
|
|
|
|