summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-04 17:37:00 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-04 17:37:00 +0000
commit3496a3cda8ea70253a76ed17c0af261f2d645fe2 (patch)
tree7efd3ed700501e2a10646632edc18eb5679538e4 /numpy/lib/utils.py
parent8057b2d910a5a6726a666a2c18ac495dbb9e6000 (diff)
downloadnumpy-3496a3cda8ea70253a76ed17c0af261f2d645fe2.tar.gz
Moving things..
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py
new file mode 100644
index 000000000..19fb18d4d
--- /dev/null
+++ b/numpy/lib/utils.py
@@ -0,0 +1,28 @@
+from numerictypes import obj2dtype
+
+__all__ = ['issubclass_', 'get_scipy_include', 'issubdtype']
+
+def issubclass_(arg1, arg2):
+ try:
+ return issubclass(arg1, arg2)
+ except TypeError:
+ return False
+
+def issubdtype(arg1, arg2):
+ return issubclass(obj2dtype(arg1), obj2dtype(arg2))
+
+def get_scipy_include():
+ """Return the directory in the package that contains the scipy/*.h header
+ files.
+
+ Extension modules that need to compile against scipy.base should use this
+ function to locate the appropriate include directory. Using distutils:
+
+ import scipy
+ Extension('extension_name', ...
+ include_dirs=[scipy.get_scipy_include()])
+ """
+ from scipy.distutils.misc_util import get_scipy_include_dirs
+ include_dirs = get_scipy_include_dirs()
+ assert len(include_dirs)==1,`include_dirs`
+ return include_dirs[0]