Corrected prefix detection

This commit is contained in:
Armin Ronacher 2011-08-10 17:51:24 +02:00
parent 175d43b2f9
commit e328eba97c
2 changed files with 5 additions and 3 deletions

View file

@ -577,6 +577,8 @@ class Flask(_PackageBoundObject):
parent, folder = os.path.split(site_parent)
if folder.lower() == 'lib':
base_dir = parent
elif os.path.basename(parent).lower() == 'lib':
base_dir = os.path.dirname(parent)
else:
base_dir = site_parent
else:

View file

@ -1032,7 +1032,7 @@ class InstanceTestCase(unittest.TestCase):
import types
expected_prefix = os.path.abspath('foo')
mod = types.ModuleType('myapp')
mod.__file__ = os.path.join(expected_prefix, 'lib',
mod.__file__ = os.path.join(expected_prefix, 'lib', 'python2.5',
'site-packages', 'myapp.py')
sys.modules['myapp'] = mod
try:
@ -1046,7 +1046,7 @@ class InstanceTestCase(unittest.TestCase):
def test_installed_package_paths(self):
import types
expected_prefix = os.path.abspath('foo')
package_path = os.path.join(expected_prefix, 'lib',
package_path = os.path.join(expected_prefix, 'lib', 'python2.5',
'site-packages', 'myapp')
mod = types.ModuleType('myapp')
mod.__path__ = [package_path]
@ -1063,7 +1063,7 @@ class InstanceTestCase(unittest.TestCase):
def test_prefix_installed_paths(self):
import types
expected_prefix = os.path.abspath(sys.prefix)
package_path = os.path.join(expected_prefix, 'lib',
package_path = os.path.join(expected_prefix, 'lib', 'python2.5',
'site-packages', 'myapp')
mod = types.ModuleType('myapp')
mod.__path__ = [package_path]