[numpy/f19] Resolves: rhbz#1018783

Tomas Tomecek ttomecek at fedoraproject.org
Mon Oct 14 12:22:02 UTC 2013


commit db540473e98bf9f90ffbc050a95bde08660de236
Author: Tomas Tomecek <ttomecek at redhat.com>
Date:   Mon Oct 14 14:09:26 2013 +0200

    Resolves: rhbz#1018783
    
    Fix names of shared library extensions.

 fix-library-ext.patch |   75 +++++++++++++++++++++++++++++++++++++++++++++++++
 numpy.spec            |    7 ++++-
 2 files changed, 81 insertions(+), 1 deletions(-)
---
diff --git a/fix-library-ext.patch b/fix-library-ext.patch
new file mode 100644
index 0000000..c4a3502
--- /dev/null
+++ b/fix-library-ext.patch
@@ -0,0 +1,75 @@
+diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
+index 7a38bed..5bd3a90 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
+ 
+diff --git a/numpy/distutils/tests/test_misc_util.py b/numpy/distutils/tests/test_misc_util.py
+index 448800b..0f870d3 100644
+--- a/numpy/distutils/tests/test_misc_util.py
++++ b/numpy/distutils/tests/test_misc_util.py
+@@ -1,7 +1,8 @@
+ #!/usr/bin/env python
+ 
+ from numpy.testing import *
+-from numpy.distutils.misc_util import appendpath, minrelpath, gpaths, rel_path
++from numpy.distutils.misc_util import appendpath, minrelpath, \
++    gpaths, get_shared_lib_extension
+ from os.path import join, sep, dirname
+ 
+ ajoin = lambda *paths: join(*((sep,)+paths))
+@@ -53,6 +54,21 @@ class TestGpaths(TestCase):
+         f = gpaths('system_info.py', local_path)
+         assert_(join(local_path,'system_info.py')==f[0],`f`)
+ 
++class TestSharedExtension(TestCase):
++
++    def test_get_shared_lib_extension(self):
++        import sys
++        ext = get_shared_lib_extension(is_python_ext=False)
++        if sys.platform.startswith('linux'):
++            assert_equal(ext, '.so')
++        elif sys.platform.startswith('gnukfreebsd'):
++            assert_equal(ext, '.so')
++        elif sys.platform.startswith('darwin'):
++            assert_equal(ext, '.dylib')
++        elif sys.platform.startswith('win'):
++            assert_equal(ext, '.dll')
++        # just check for no crash
++        assert_(get_shared_lib_extension(is_python_ext=True))
+ 
+ if __name__ == "__main__":
+     run_module_suite()
diff --git a/numpy.spec b/numpy.spec
index f0979cf..274e236 100644
--- a/numpy.spec
+++ b/numpy.spec
@@ -9,7 +9,7 @@
 
 Name:           numpy
 Version:        1.7.1
-Release:        5%{?dist}
+Release:        6%{?dist}
 Epoch:          1
 Summary:        A fast multidimensional array facility for Python
 
@@ -19,6 +19,7 @@ License:        BSD and Python
 URL:            http://www.numpy.org/
 Source0:        http://downloads.sourceforge.net/numpy/%{name}-%{version}%{?relc}.tar.gz
 Patch1:         f2py-shebang.patch
+Patch2:         fix-library-ext.patch
 
 BuildRequires:  python2-devel lapack-devel python-setuptools gcc-gfortran atlas-devel python-nose
 Requires:       python-nose
@@ -85,6 +86,7 @@ This package includes a version of f2py that works properly with NumPy.
 %prep
 %setup -q -n %{name}-%{version}%{?relc}
 %patch1 -p1
+%patch2 -p1
 # workaround for rhbz#849713
 # http://mail.scipy.org/pipermail/numpy-discussion/2012-July/063530.html
 rm numpy/distutils/command/__init__.py && touch numpy/distutils/command/__init__.py
@@ -244,6 +246,9 @@ popd &> /dev/null
 
 
 %changelog
+* Mon Oct 14 2013 Tomas Tomecek <ttomecek at redhat.com> - 1:1.7.1-6
+- fix name of shared library extensions (rhbz#1018783)
+
 * Tue Aug 27 2013 Jon Ciesla <limburgher at gmail.com> - 1:1.7.1-5
 - URL Fix, BZ 1001337
 


More information about the scm-commits mailing list