%if 0%{?fedora} > 12 %global with_python3 1 %endif Name: python-openopt Version: 0.5092 Release: 1%{?dist} Summary: A python module for numerical optimization License: BSD URL: http://openopt.org/ Source0: https://pypi.python.org/packages/source/o/openopt/openopt-%{version}.tar.gz Requires: numpy BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setproctitle BuildRequires: numpy %if 0%{?with_python3} BuildRequires: python-tools BuildRequires: python3-devel BuildRequires: python3-setproctitle BuildRequires: python3-numpy BuildRequires: python3-setuptools %endif %description Universal numerical optimization package with several own solvers (e.g. ralg) and connections to tens of other, graphical output of convergence and many other goodies. %if 0%{?with_python3} %package -n python3-openopt Summary: A python module for numerical optimization Requires: python3-numpy %description -n python3-openopt Universal numerical optimization package with several own solvers (e.g. ralg) and connections to tens of other, graphical output of convergence and many other goodies. %endif %prep %setup -q -n openopt-%{version} # Remove some shebangs for lib in openopt/solvers/Standalone/tsp.py openopt/__init__.py openopt/kernel/mfa.py ; do sed '1{\@^#!.*@d}' $lib > $lib.new && touch -r $lib $lib.new && mv $lib.new $lib done # Remove some executable bits on documentation examples. chmod 0644 openopt/examples/snle_1.py openopt/examples/tsp_1.py %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif # with_python3 %build %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} 2to3 --write --nobackups . %{__python3} setup.py build popd %endif %install rm -rf %{buildroot} %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} rm -rf %{buildroot}%{python3_sitelib}/openopt/examples popd %endif %{__python} setup.py install --skip-build --root %{buildroot} rm -rf %{buildroot}%{python_sitelib}/openopt/examples %check %{__python} setup.py test %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py test popd %endif %files %doc PKG-INFO openopt/examples # For noarch packages: sitelib %{python_sitelib}/openopt %{python_sitelib}/openopt-%{version}-py%{python_version}.egg-info %if 0%{?with_python3} %files -n python3-openopt %doc PKG-INFO openopt/examples %{python3_sitelib}/openopt %{python3_sitelib}/openopt-%{version}-py%{python3_version}.egg-info %endif %changelog * Mon Aug 26 2013 Steve Traylen - 0.5092-1 - Initial package