Browse Source

Corrected prefix detection

pull/302/head
Armin Ronacher 14 years ago
parent
commit
e328eba97c
  1. 2
      flask/app.py
  2. 6
      tests/flask_tests.py

2
flask/app.py

@ -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:

6
tests/flask_tests.py

@ -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]

Loading…
Cancel
Save