summaryrefslogtreecommitdiff
path: root/numpy/__init__.py
diff options
context:
space:
mode:
authorFernando Perez <fperez@fperez.org>2007-12-30 03:04:17 +0000
committerFernando Perez <fperez@fperez.org>2007-12-30 03:04:17 +0000
commit083ca64099268bc5967d25a15f9a4d26d750eb69 (patch)
treef30d625ff545b721477e77bcf5c03246f38511fe /numpy/__init__.py
parentb4a25a4ae23890d04b993698a7e82f769ee748a5 (diff)
downloadnumpy-083ca64099268bc5967d25a15f9a4d26d750eb69.tar.gz
Modify the setup routine to indicate that it is being run via a system
global. This allows the main __init__ to detect the setup and avoid attempting to load things that aren't built yet. This is hackish, but the previously used method would fail if there was an existing system-wide numpy already installed, for example (which users might have no control over). There were frequent reports of problems with the previous method: - http://projects.scipy.org/pipermail/scipy-user/2007-November/014511.html - Tickets #561 and #565
Diffstat (limited to 'numpy/__init__.py')
-rw-r--r--numpy/__init__.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index dbba4f88d..f07d862a5 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -16,16 +16,20 @@ Documentation is available in the docstrings and at
http://www.scipy.org.
"""
+# We first need to detect if we're being called as part of the numpy setup
+# procedure itself in a reliable manner.
try:
- from numpy.__config__ import show as show_config
-except ImportError:
- show_config = None
+ __NUMPY_SETUP__
+except NameError:
+ __NUMPY_SETUP__ = False
+
-if show_config is None:
+if __NUMPY_SETUP__:
import sys as _sys
print >> _sys.stderr, 'Running from numpy source directory.'
del _sys
else:
+ from numpy.__config__ import show as show_config
from version import version as __version__
from _import_tools import PackageLoader