diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-03-29 16:40:31 +0100 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-04-28 15:08:59 +0200 |
commit | fb6cfd793671b37fcc5cf54c8bbeed1621fa14af (patch) | |
tree | e6565107de650ee5c9c3a2fc47f322564b9699f1 /numpy/distutils/misc_util.py | |
parent | a8805f65d25e7268a722da47d490167d99e1559f (diff) | |
download | numpy-fb6cfd793671b37fcc5cf54c8bbeed1621fa14af.tar.gz |
BUG: hardcode some known shared library extensions
the configuration variables are not a reliable mean to get the shared
library extension. darwin, windows and debug linux are wrong in these
variables.
SHLIB_SUFFIX is also wrong as of python 3.3.1
closes #3057
Diffstat (limited to 'numpy/distutils/misc_util.py')
-rw-r--r-- | numpy/distutils/misc_util.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 7a38bedc3..5bd3a9086 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -605,11 +605,29 @@ def get_shared_lib_extension(is_python_ext=False): Linux, but not on OS X. """ - so_ext = distutils.sysconfig.get_config_var('SO') or '' - # fix long extension for Python >=3.2, see PEP 3149. - if (not is_python_ext) and 'SOABI' in distutils.sysconfig.get_config_vars(): - # Does nothing unless SOABI config var exists - so_ext = so_ext.replace('.' + distutils.sysconfig.get_config_var('SOABI'), '', 1) + confvars = distutils.sysconfig.get_config_vars() + # SO is deprecated in 3.3.1, use EXT_SUFFIX instead + so_ext = confvars.get('EXT_SUFFIX', None) + if so_ext is None: + so_ext = confvars.get('SO', '') + + if not is_python_ext: + # hardcode known values, config vars (including SHLIB_SUFFIX) are + # unreliable (see #3182) + # darwin, windows and debug linux are wrong in 3.3.1 and older + if (sys.platform.startswith('linux') or + sys.platform.startswith('gnukfreebsd')): + so_ext = '.so' + elif sys.platform.startswith('darwin'): + so_ext = '.dylib' + elif sys.platform.startswith('win'): + so_ext = '.dll' + else: + # fall back to config vars for unknown platforms + # fix long extension for Python >=3.2, see PEP 3149. + if 'SOABI' in confvars: + # Does nothing unless SOABI config var exists + so_ext = so_ext.replace('.' + confvars.get('SOABI'), '', 1) return so_ext |