[python-cvxopt] New upstream release. Build python3 subpackage.

Jerry James jjames at fedoraproject.org
Mon Apr 2 21:55:07 UTC 2012


commit 5a35d67e4b246cbba81f129409eb17c02b4ab651
Author: Jerry James <loganjerry at gmail.com>
Date:   Mon Apr 2 15:54:55 2012 -0600

    New upstream release.
    Build python3 subpackage.

 .gitignore                         |    2 +-
 python-cvxopt-fixglpkinclude.patch |    6 +-
 python-cvxopt-setup.patch          |  131 +++++++++++++++++++-----------------
 python-cvxopt.spec                 |   70 +++++++++++++------
 sources                            |    2 +-
 5 files changed, 123 insertions(+), 88 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9c6383c..7c19093 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-/cvxopt-1.1.4.tar.gz
+/cvxopt-1.1.5.tar.gz
diff --git a/python-cvxopt-fixglpkinclude.patch b/python-cvxopt-fixglpkinclude.patch
index d07f96a..c52612e 100644
--- a/python-cvxopt-fixglpkinclude.patch
+++ b/python-cvxopt-fixglpkinclude.patch
@@ -1,6 +1,6 @@
---- src/C/glpk.c.orig	2011-12-21 14:53:49.000000000 -0700
-+++ src/C/glpk.c	2012-01-02 12:42:13.458612192 -0700
-@@ -20,7 +20,7 @@
+--- src/C/glpk.c.orig	2012-03-27 14:20:54.000000000 -0600
++++ src/C/glpk.c	2012-04-02 14:52:29.469147189 -0600
+@@ -21,7 +21,7 @@
  
  #include "cvxopt.h"
  #include "misc.h"
diff --git a/python-cvxopt-setup.patch b/python-cvxopt-setup.patch
index 1d4e12b..dbbc643 100644
--- a/python-cvxopt-setup.patch
+++ b/python-cvxopt-setup.patch
@@ -1,51 +1,62 @@
---- src/setup.py.orig	2011-12-21 14:53:49.000000000 -0700
-+++ src/setup.py	2012-01-02 12:50:56.702717747 -0700
-@@ -46,14 +46,14 @@
- # optional modules
- 
- if BUILD_GSL:
--    gsl = Extension('gsl', libraries = ['m', 'gsl', 'blas'],
-+    gsl = Extension('gsl', libraries = ['gsl'],
-         include_dirs = [ GSL_INC_DIR ],
-         library_dirs = [ GSL_LIB_DIR ],
-         sources = ['C/gsl.c'] )
-     extmods += [gsl];
- 
- if BUILD_FFTW:
--    fftw = Extension('fftw', libraries = ['fftw3', 'blas'],
-+    fftw = Extension('fftw', libraries = ['fftw3', 'f77blas'],
-         include_dirs = [ FFTW_INC_DIR ],
-         library_dirs = [ FFTW_LIB_DIR, ATLAS_LIB_DIR ],
-         sources = ['C/fftw.c'] )
-@@ -67,7 +67,7 @@
-     extmods += [glpk];
- 
- if BUILD_DSDP:
--    dsdp = Extension('dsdp', libraries = ['dsdp', 'blas', 'lapack'],
-+    dsdp = Extension('dsdp', libraries = ['dsdp'],
-         include_dirs = [ DSDP_INC_DIR ],
-         library_dirs = [ DSDP_LIB_DIR, ATLAS_LIB_DIR ],
-         sources = ['C/dsdp.c'] )
-@@ -85,32 +85,27 @@
- else:    
-     MACROS = []
- 
--base = Extension('base', libraries = ['m','lapack','blas'],
-+base = Extension('base', libraries = ['lapack'],
-     library_dirs = [ ATLAS_LIB_DIR ],
-     define_macros = MACROS,
-     sources = ['C/base.c','C/dense.c','C/sparse.c']) 
+--- ./src/setup.py.orig	2012-03-27 14:05:13.000000000 -0600
++++ ./src/setup.py	2012-04-02 15:36:07.621568810 -0600
+@@ -2,10 +2,10 @@ from distutils.core import setup, Extens
+ from glob import glob
  
--blas = Extension('blas', libraries = ['blas'],
-+blas = Extension('blas', libraries = ['f77blas'],
-     library_dirs = [ ATLAS_LIB_DIR ],
-     define_macros = MACROS,
-     sources = ['C/blas.c'] )
+ # Modifiy this if BLAS and LAPACK libraries are not in /usr/lib.
+-BLAS_LIB_DIR = '/usr/lib'
++BLAS_LIB_DIR = '/usr/lib/atlas'
  
--lapack = Extension('lapack', libraries = ['lapack','blas'],
-+lapack = Extension('lapack', libraries = ['lapack'],
-     library_dirs = [ ATLAS_LIB_DIR ],
-     define_macros = MACROS,
+ # Default names of BLAS and LAPACK libraries
+-BLAS_LIB = ['blas']
++BLAS_LIB = ['f77blas']
+ LAPACK_LIB = ['lapack']
+ BLAS_EXTRA_LINK_ARGS = []
+ 
+@@ -15,7 +15,7 @@ BLAS_NOUNDERSCORES = False
+ 
+ # Set to 1 if you are using the random number generators in the GNU
+ # Scientific Library.
+-BUILD_GSL = 0
++BUILD_GSL = 1
+ 
+ # Directory containing libgsl (used only when BUILD_GSL = 1).
+ GSL_LIB_DIR = '/usr/lib'
+@@ -24,7 +24,7 @@ GSL_LIB_DIR = '/usr/lib'
+ GSL_INC_DIR = '/usr/include/gsl'
+ 
+ # Set to 1 if you are installing the fftw module.
+-BUILD_FFTW = 0 
++BUILD_FFTW = 1 
+ 
+ # Directory containing libfftw3 (used only when BUILD_FFTW = 1).
+ FFTW_LIB_DIR = '/usr/lib'
+@@ -33,7 +33,7 @@ FFTW_LIB_DIR = '/usr/lib'
+ FFTW_INC_DIR = '/usr/include'
+ 
+ # Set to 1 if you are installing the glpk module.
+-BUILD_GLPK = 0 
++BUILD_GLPK = 1 
+ 
+ # Directory containing libglpk (used only when BUILD_GLPK = 1).
+ GLPK_LIB_DIR = '/usr/lib'
+@@ -42,13 +42,13 @@ GLPK_LIB_DIR = '/usr/lib'
+ GLPK_INC_DIR = '/usr/include'
+ 
+ # Set to 1 if you are installing the DSDP module.
+-BUILD_DSDP = 0
++BUILD_DSDP = 1
+ 
+ # Directory containing libdsdp (used only when BUILD_DSDP = 1).
+ DSDP_LIB_DIR = '/usr/lib'
+  
+ # Directory containing dsdp5.h (used only when BUILD_DSDP = 1).
+-DSDP_INC_DIR = '/usr/include/dsdp'
++DSDP_INC_DIR = '/usr/include/DSDP'
+ 
+ # No modifications should be needed below this line.
+ 
+@@ -112,17 +112,12 @@ lapack = Extension('lapack', libraries =
      sources = ['C/lapack.c'] )
  
  umfpack = Extension('umfpack', 
@@ -53,29 +64,28 @@
 -        'C/SuiteSparse/AMD/Include', 'C/SuiteSparse/AMD/Source', 
 -        'C/SuiteSparse/UFconfig' ],
 +    include_dirs = [ '/usr/include/suitesparse' ],
-     library_dirs = [ ATLAS_LIB_DIR ],
+     library_dirs = [ BLAS_LIB_DIR ],
      define_macros = MACROS,
--    libraries = [ 'blas', 'lapack'],
+     libraries = LAPACK_LIB + BLAS_LIB,
+     extra_link_args = BLAS_EXTRA_LINK_ARGS,
 -    sources = [ 'C/umfpack.c',
 -        'C/SuiteSparse/UMFPACK/Source/umfpack_global.c',
 -        'C/SuiteSparse/UMFPACK/Source/umfpack_tictoc.c' ] +
 -        glob('C/SuiteSparse_cvxopt_extra/umfpack/*'))
-+    libraries = [ 'umfpack' ],
 +    sources = [ 'C/umfpack.c' ])
  
  # Build for int or long? 
  import sys
-@@ -118,28 +113,18 @@
- 
+@@ -131,26 +126,16 @@ if sys.maxsize > 2**31: MACROS += [('DLO
  cholmod = Extension('cholmod',
-     library_dirs = [ ATLAS_LIB_DIR ],
--    libraries = ['lapack', 'blas'],
+     library_dirs = [ BLAS_LIB_DIR ],
+     libraries = LAPACK_LIB + BLAS_LIB,
 -    include_dirs = [ 'C/SuiteSparse/CHOLMOD/Include', 
 -        'C/SuiteSparse/COLAMD', 'C/SuiteSparse/AMD/Include', 
 -        'C/SuiteSparse/UFconfig', 'C/SuiteSparse/COLAMD/Include' ],
-+    libraries = ['cholmod' ],
-+    include_dirs = [ '/usr/include/suitesparse' ], 
++    include_dirs = [ '/usr/include/suitesparse' ],
      define_macros = MACROS + [('NPARTITION', '1')],
+     extra_link_args = BLAS_EXTRA_LINK_ARGS,
 -    sources = [ 'C/cholmod.c' ] + 
 -        ['C/SuiteSparse/AMD/Source/' + s for s in ['amd_global.c',
 -            'amd_postorder.c', 'amd_post_tree.c', 'amd_2.c']] +
@@ -90,14 +100,11 @@
  amd = Extension('amd', 
 -    include_dirs = [ 'C/SuiteSparse/AMD/Include', 
 -        'C/SuiteSparse/UFconfig' ],
-+    include_dirs = [ '/usr/include/suitesparse' ], 
++    include_dirs = [ '/usr/include/suitesparse' ],
++    libraries = [ 'amd' ],
      define_macros = MACROS,
 -    sources = [ 'C/amd.c' ] + glob('C/SuiteSparse/AMD/Source/*.c') )
-+    libraries = [ 'amd' ],
 +    sources = [ 'C/amd.c' ])
  
--misc_solvers = Extension('misc_solvers', libraries = ['lapack', 'blas'],
-+misc_solvers = Extension('misc_solvers', libraries = ['lapack'],
-     library_dirs = [ ATLAS_LIB_DIR ],
-     define_macros = MACROS,
-     sources = ['C/misc_solvers.c'] )
+ misc_solvers = Extension('misc_solvers',
+     libraries = LAPACK_LIB + BLAS_LIB,
diff --git a/python-cvxopt.spec b/python-cvxopt.spec
index 918a730..86c93e0 100644
--- a/python-cvxopt.spec
+++ b/python-cvxopt.spec
@@ -1,6 +1,6 @@
 Name:           python-cvxopt
-Version:        1.1.4
-Release:        2%{?dist}
+Version:        1.1.5
+Release:        1%{?dist}
 Summary:        A Python Package for Convex Optimization
 Group:          Development/Languages
 License:        GPLv3+
@@ -8,9 +8,8 @@ URL:            http://abel.ee.ucla.edu/cvxopt/
 Source0:        http://abel.ee.ucla.edu/src/cvxopt-%{version}.tar.gz
 # Will submit patch0 to upstream ASAP
 Patch0:         python-cvxopt-fixglpkinclude.patch
-# Use the system suitesparse instead of building one, ensure the ATLAS BLAS
-# library is used instead of the system BLAS, and eliminate some unnecessary
-# linkage.
+# Use the system suitesparse instead of building one, and ensure the ATLAS BLAS
+# library is used instead of the system BLAS.
 Patch1:         python-cvxopt-setup.patch
 
 BuildRequires:  atlas-devel
@@ -18,13 +17,13 @@ BuildRequires:  DSDP-devel
 BuildRequires:  fftw-devel
 BuildRequires:  glpk-devel
 BuildRequires:  gsl-devel
-BuildRequires:  python-devel
-BuildRequires:  python-setuptools-devel
+BuildRequires:  python2-devel python3-devel
+BuildRequires:  python-setuptools python3-setuptools
 BuildRequires:  python-sphinx
 BuildRequires:  suitesparse-devel
 BuildRequires:  tex4ht
 
-%global __provides_exclude_from ^%{python_sitearch}/.*\\.so$
+%global __provides_exclude_from ^\\\((%{python2_sitearch})|(%{python3_sitearch})\\\)/.*\\.so$
 
 
 %description
@@ -47,23 +46,28 @@ BuildArch:      noarch
 Example use of %{name}.
 
 
+%package -n     python3-cvxopt
+Summary:        A Python3 Package for Convex Optimization
+Group:          Development/Languages
+
+
+%description -n python3-cvxopt
+CVXOPT is a free software package for convex optimization based on
+the Python programming language. Its main purpose is to make the
+development of software for convex optimization applications
+straightforward by building on Python's extensive standard library and
+on the strengths of Python as a high-level programming language.
+
+
 %prep
 %setup -q -n cvxopt-%{version}
 %patch0
 %patch1
 
-# Configure all optional modules
-sed -e "s#^ATLAS_LIB_DIR =.*#ATLAS_LIB_DIR = '%{_libdir}/atlas'#" \
-    -e "s#^BUILD_GSL =.*#BUILD_GSL = 1#" \
-    -e "s#^GSL_LIB_DIR =.*#GSL_LIB_DIR = '%{_libdir}'#" \
-    -e "s#^BUILD_FFTW =.*#BUILD_FFTW = 1#" \
-    -e "s#^FFTW_LIB_DIR =.*#FFTW_LIB_DIR = '%{_libdir}'#" \
-    -e "s#^BUILD_GLPK =.*#BUILD_GLPK = 1#" \
-    -e "s#^GLPK_LIB_DIR =.*#GLPK_LIB_DIR = '%{_libdir}'#" \
-    -e "s#^BUILD_DSDP =.*#BUILD_DSDP = 1#" \
-    -e "s#^DSDP_LIB_DIR =.*#DSDP_LIB_DIR = '%{_libdir}'#" \
-    -e "s#^DSDP_INC_DIR =.*#DSDP_INC_DIR = '%{_includedir}/DSDP'#" \
-    -i src/setup.py
+# Fix library path
+if [ %{__isa_bits} = "64" ]; then
+  sed -i "s|/usr/lib|%{_libdir}|" src/setup.py
+fi
 
 # Remove internal copy of system library
 rm -rf src/C/SuiteSparse*/
@@ -71,10 +75,18 @@ rm -rf src/C/SuiteSparse*/
 # Remove useless executable bits
 find examples -name \*.py -perm /0111 | xargs chmod a-x
 
+# Make a copy so we can build for python3 as well
+cp -a src src3
 
 %build
+# Build for python 2
 pushd src
-  CC="gcc" LDSHARED="gcc -shared" %{__python} setup.py build
+  CC="gcc" LDSHARED="gcc -shared -Wl,--as-needed" %{__python} setup.py build
+popd
+
+# Build for python 3
+pushd src3
+  CC="gcc" LDSHARED="gcc -shared -Wl,--as-needed" %{__python3} setup.py build
 popd
 
 # Rebuild the documentation
@@ -84,10 +96,17 @@ rm -f doc/build/html/.buildinfo
 
 
 %install
+# Install for python 2
 pushd src
   %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
 popd
 
+# Install for python 3
+pushd src3
+  %{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
+popd
+
+# Install the examples
 mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
 cp -a examples $RPM_BUILD_ROOT%{_datadir}/%{name}/
 
@@ -100,8 +119,17 @@ cp -a examples $RPM_BUILD_ROOT%{_datadir}/%{name}/
 %files examples
 %{_datadir}/%{name}
 
+%files -n python3-cvxopt
+%doc LICENSE doc/build/html/
+%{python3_sitearch}/*egg-info
+%{python3_sitearch}/cvxopt
+
 
 %changelog
+* Mon Apr  2 2012 Jerry James <loganjerry at gmail.com> - 1.1.5-1
+- New upstream release
+- Build python3 subpackage
+
 * Tue Jan 10 2012 Jerry James <loganjerry at gmail.com> - 1.1.4-2
 - Mass rebuild for Fedora 17
 - Fix insufficiently escaped filter expression
diff --git a/sources b/sources
index f812d57..df32358 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-e8b201142085d6ec9ea506381929f8eb  cvxopt-1.1.4.tar.gz
+f71e6e3e1c2e2264deb0887441783b05  cvxopt-1.1.5.tar.gz


More information about the scm-commits mailing list