diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 22:57:46 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-04 22:57:46 +0000 |
commit | 961f7f5348dce942991e98e48a966f458bb26273 (patch) | |
tree | d09589545aa7b3e5c3d8caa6ca4a59e740ce3504 /numpy/lib/utils.py | |
parent | 6d9c86cde543110e1b5937e2b217eb1374ee9adf (diff) | |
parent | 0f05f3848fddb57a5ae895d8ac0f9d728ab8a9ed (diff) | |
download | numpy-961f7f5348dce942991e98e48a966f458bb26273.tar.gz |
Merged r1773:1791 branch of numpy into main trunk
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 28 |
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..88a22ab21 --- /dev/null +++ b/numpy/lib/utils.py @@ -0,0 +1,28 @@ +from numpy.core.numerictypes import obj2dtype + +__all__ = ['issubclass_', 'get_numpy_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_numpy_include(): + """Return the directory in the package that contains the numpy/*.h header + files. + + Extension modules that need to compile against numpy.base should use this + function to locate the appropriate include directory. Using distutils: + + import numpy + Extension('extension_name', ... + include_dirs=[numpy.get_numpy_include()]) + """ + from numpy.distutils.misc_util import get_numpy_include_dirs + include_dirs = get_numpy_include_dirs() + assert len(include_dirs)==1,`include_dirs` + return include_dirs[0] |