Blob Blame History Raw
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

Name:           python-cvxopt
Version:        1.1
Release:        6%{?dist}
Summary:        A Python Package for Convex Optimization
Group:          Development/Languages
License:        GPLv3+
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
Patch1:         python-cvxopt-1.1-use-system-suitesparse.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  atlas-devel
BuildRequires:  blas-devel
BuildRequires:  fftw-devel
BuildRequires:  glpk-devel
BuildRequires:  gsl-devel
BuildRequires:  python-devel
BuildRequires:  python-setuptools-devel
BuildRequires:  suitesparse-devel
BuildRequires:  tetex-tex4ht


%description
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.


%package        examples
Summary:        Examples of using %{name}
Group:          Development/Languages
Requires:       %{name} = %{version}-%{release}
Requires:       python-matplotlib
BuildArch:      noarch


%description    examples
Example use of %{name}.


%prep
%setup -q -n cvxopt-%{version}
%patch0

# Configure all optional modules (except for DSDP which isn't in Fedora)
sed -i -e "s#^ATLAS_LIB_DIR =.*#ATLAS_LIB_DIR = '%{_libdir}/atlas'#" src/setup.py
sed -i -e "s#^BUILD_GSL =.*#BUILD_GSL = 1#" src/setup.py
sed -i -e "s#^GSL_LIB_DIR =.*#GSL_LIB_DIR = '%{_libdir}'#" src/setup.py
sed -i -e "s#^BUILD_FFTW =.*#BUILD_FFTW = 1#" src/setup.py
sed -i -e "s#^FFTW_LIB_DIR =.*#FFTW_LIB_DIR = '%{_libdir}'#" src/setup.py
sed -i -e "s#^BUILD_GLPK =.*#BUILD_GLPK = 1#" src/setup.py
sed -i -e "s#^GLPK_LIB_DIR =.*#GLPK_LIB_DIR = '%{_libdir}'#" src/setup.py
sed -i -e "s#^DSDP_LIB_DIR =.*#DSDP_LIB_DIR = '%{_libdir}'#" src/setup.py

pushd doc
  make clean
  make -B html
popd

# Remove internal copy of system library
rm -rf src/C/SuiteSparse*/

cp src/setup.py{,.orig}
%patch1


%build
cd src
CFLAGS="$RPM_OPT_FLAGS" %{__python} -c 'import setuptools; execfile("setup.py")' build


%install
rm -rf $RPM_BUILD_ROOT
pushd src
  %{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root $RPM_BUILD_ROOT
popd

mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -R examples $RPM_BUILD_ROOT%{_datadir}/%{name}/

 
%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc LICENSE doc/html/
%{python_sitearch}/*egg-info
%{python_sitearch}/cvxopt

%files examples
%defattr(-,root,root,-)
%{_datadir}/%{name}


%changelog
* Thu Feb 26 2009 Conrad Meyer <konrad@tylerc.org> - 1.1-6
- Make examples subpackage noarch.

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Dec 8 2008 Conrad Meyer <konrad@tylerc.org> - 1.1-4
- Add BR on suitesparse-devel.
- Migrate examples to subpackage.

* Mon Dec 8 2008 Conrad Meyer <konrad@tylerc.org> - 1.1-3
- Remove SuiteSparse (copy of system library).

* Mon Dec 8 2008 Conrad Meyer <konrad@tylerc.org> - 1.1-2
- Move examples to datadir/name.
- Include html documentation.
- Package as a proper python egg.

* Mon Dec 8 2008 Conrad Meyer <konrad@tylerc.org> - 1.1-1
- Bump to 1.1.

* Mon Oct 13 2008 Conrad Meyer <konrad@tylerc.org> - 1.0-1
- Initial package.