%if 0%{?fedora} %global with_python3 1 %endif %global pname assimulo Name: python-%{pname} Version: 2.9 Release: 6%{?dist} Summary: Ordinary differential and differential algebraic equations solver License: LGPLv3+ and LGPLv2+ and BSD and GPLv3 URL: http://www.jmodelica.org/assimulo Source0: https://pypi.python.org/packages/source/A/Assimulo/Assimulo-%{version}.zip ##http://www.gnu.org/licenses/gpl-3.0.txt ##http://www.gnu.org/licenses/lgpl-3.0.txt ##http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt Source1: %{pname}-licenses.tar.gz BuildRequires: python2-devel, python-setuptools, python-nose BuildRequires: numpy, pytest, Cython, python-matplotlib BuildRequires: sundials-devel, lapack-devel, blas-devel, gcc-gfortran BuildRequires: blas-static, numpy-f2py, scipy, dos2unix, xorg-x11-server-Xvfb BuildRequires: qhull-devel #BuildRequires: SuperLU-devel Requires: python-matplotlib, numpy, scipy ##This patch changes the tolerance in the mechanical systems test ##on PPC architecture ##Test failed on PPC, like this one: ##https://trac.jmodelica.org/assimulo/ticket/239 Patch0: %{pname}-mech_system_pendulum.patch Patch1: python-%{pname}-set_superlu_dir.patch %description Assimulo is a Cython/Python based simulation package that allows for simulation of both ordinary differential equations (ODEs), f(t,y), and differential algebraic equations (DAEs), f(t,y,yd). It combines a variety of different solvers written in C, FORTRAN and Python via a common high-level interface. %package -n python2-%{pname} Summary: %{sum} %{?python_provide:%python_provide python2-%{pname}} %description -n python2-%{pname} Assimulo is a Cython/Python based simulation package that allows for simulation of both ordinary differential equations (ODEs), f(t,y), and differential algebraic equations (DAEs), f(t,y,yd). It combines a variety of different solvers written in C, FORTRAN and Python via a common high-level interface. %if 0%{?with_python3} %package -n python3-%{pname} Summary: Ordinary differential and differential algebraic equations solver %{?python_provide:%python_provide python3-%{pname}} BuildRequires: python3-devel, python3-setuptools, python3-nose BuildRequires: python3-numpy, python3-pytest, python3-Cython, python3-matplotlib BuildRequires: sundials-devel, lapack-devel, blas-devel, gcc-gfortran, dos2unix BuildRequires: blas-static, python3-numpy-f2py, python3-ipython-console, python3-scipy Requires: python3-matplotlib, python3-numpy, python3-scipy %description -n python3-%{pname} %{summary}. %endif # with_python3 %prep %setup -qc mv Assimulo-%{version} python2 pushd python2 ##Copy license files tar -xf %{SOURCE1} dos2unix */* %ifarch %{power64} aarch64 s390x %patch0 -p0 %endif %patch1 -p0 sed -i 's|/usr/local/include|%{_includedir}|g' setup.py sed -i 's|/usr/local/lib|%{_libdir}|g' setup.py ##sed -i 's|@@lib@@|%%{_libdir}|g' setup.py ##sed -i 's|@@inc@@|%%{_includedir}/SuperLU|g' setup.py popd %if 0%{?with_python3} cp -a python2 python3 %endif # with_python3 %build pushd python2 sed -i 's|1s|^#!python|#!%{__python2}|g' setup.py CFLAGS="%{optflags} -Wl,-z,relro -fPIC -Wl,-z,now -Wno-cpp" \ LDFLAGS="%{__global_ldflags} -shared -Wl,--as-needed -Wl,-z,now" \ FFLAGS="%{optflags} -Wl,-z,relro -fPIC -Wl,-z,now -Wno-cpp" \ %{__python2} setup.py build --executable="%{__python2} -s" \ --blas-home=%{_libdir} --sundials-home=%{_prefix} --lapack-home=%{_libdir} \ --superlu-home=%{_libdir} --sundials-with-superlu=false \ --extra-c-flags="%{optflags} -Wl,-z,relro -fPIC -Wl,-z,now -Wno-cpp" popd %if 0%{?with_python3} pushd python3 sed -i 's|1s|^#!python|#!%{__python3}|g' setup.py CFLAGS="%{optflags} -Wl,-z,relro -fPIC -Wl,-z,now -Wno-cpp" \ LDFLAGS="%{__global_ldflags} -shared -Wl,--as-needed -Wl,-z,now" \ FFLAGS="%{optflags} -Wl,-z,relro -fPIC -Wl,-z,now -Wno-cpp" \ %{__python3} setup.py build --executable="%{__python3} -s" \ --blas-home=%{_libdir} --sundials-home=%{_prefix} --lapack-home=%{_libdir} \ --superlu-home=%{_prefix} --sundials-with-superlu=false \ --extra-c-flags="%{optflags} -Wl,-z,relro -fPIC -Wl,-z,now -Wno-cpp" popd %endif # with_python3 %install pushd python2 %{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT --blas-home=%{_libdir} --sundials-home=%{_prefix} --lapack-home=%{_libdir} popd %if 0%{?with_python3} pushd python3 %{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT --blas-home=%{_libdir} --sundials-home=%{_prefix} --lapack-home=%{_libdir} popd %endif ##Fix -x permissions ##Fix wrong-script-end-of-line-encoding errors for i in `find $RPM_BUILD_ROOT%{python2_sitearch}/%{pname} -type f \( -name "*.py" \)`; do chmod a+x $i dos2unix $i done for i in `find $RPM_BUILD_ROOT%{python2_sitearch}/%{pname} -type f \( -name "*.so" \)`; do chmod 0755 $i done %if 0%{?with_python3} for i in `find $RPM_BUILD_ROOT%{python3_sitearch}/%{pname} -type f \( -name "*.py" \)`; do chmod a+x $i dos2unix $i done for i in `find $RPM_BUILD_ROOT%{python3_sitearch}/%{pname} -type f \( -name "*.so" \)`; do chmod 0755 $i done %endif %check # test_dasp3_basic disabled # See http://www.jmodelica.org/27779 pushd python2/%{pname}/tests rm -f __init__.py find . -name '*.pyc' -delete LD_PRELOAD=%{_libdir}/lapack.so LD_PRELOAD=%{_libdir}/lablas.so LD_PRELOAD=%{_libdir}/libsundials_idas.so LD_PRELOAD=%{_libdir}/libsundials_cvodes.so export PYTHONPATH=$RPM_BUILD_ROOT%{python2_sitearch} %if 0%{?rhel} || 0%{?fedora} < 24 xvfb-run -a nosetests -v %else nosetests -v %endif popd %if 0%{?with_python3} pushd python3/%{pname}/tests rm -f __init__.py find . -name '*.pyc' -delete LD_PRELOAD=%{_libdir}/lapack.so LD_PRELOAD=%{_libdir}/lablas.so LD_PRELOAD=%{_libdir}/libsundials_idas.so LD_PRELOAD=%{_libdir}/libsundials_cvodes.so export PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitearch} %if 0%{?rhel} || 0%{?fedora} < 24 xvfb-run -a nosetests-%{python3_version} -v %else nosetests-%{python3_version} -v %endif popd %endif %files -n python2-%{pname} %doc python2/README python2/CHANGELOG %license python2/assimulo/thirdparty/*/LICENSE_* python2/*.txt %{python2_sitearch}/*.egg-info %{python2_sitearch}/assimulo/ %if 0%{?with_python3} %files -n python3-%{pname} %doc python3/README python3/CHANGELOG %license python3/assimulo/thirdparty/*/LICENSE_* python3/*.txt %{python3_sitearch}/*.egg-info %{python3_sitearch}/assimulo/ %endif %changelog * Thu Nov 10 2016 Antonio Trande - 2.9-6 - Fix s390 builds * Thu Oct 06 2016 Antonio Trande - 2.9-5 - Rebuild for new Numpy version * Thu Sep 29 2016 Antonio Trande - 2.9-4 - Rebuild for Sundials 2.7.0 - Patched for detecting Numpy 'rc' release * Tue Aug 16 2016 Antonio Trande - 2.9-3 - Rebuild for Python 3.5.2 * Tue Jul 19 2016 Fedora Release Engineering - 2.9-2 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages * Sat Apr 30 2016 Antonio Trande - 2.9-1 - Update to 2.9 - Built without SuperLU support yet * Thu Feb 04 2016 Fedora Release Engineering - 2.8-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Sun Jan 10 2016 Antonio Trande - 2.8-8 - Fixed python2 package * Thu Dec 10 2015 Antonio Trande - 2.8-7 - SPEC file adapted to recent guidelines for Python * Tue Dec 08 2015 Antonio Trande - 2.8-6 - test_dasp3_basic skipped on > F23 * Sat Nov 14 2015 Antonio Trande - 2.8-5 - Package's name changed to python-assimulo * Tue Nov 10 2015 Antonio Trande - 2.8-4 - Removed pname custom macro * Tue Nov 10 2015 Antonio Trande - 2.8-3 - Fixed flags for hardened builds * Fri Oct 02 2015 Antonio Trande - 2.8-2 - Fixed numpy's version detection - Fixed test error on AARCH64 - Set Fortran compiler flags * Sat Jul 11 2015 Antonio Trande - 2.8-1 - Update to 2.8 - Packaged only in EPEL7 and Fedora * Sun Apr 26 2015 Antonio Trande - 2.7b1-2.20150420rev751 - Packaged license files - Fixed library permissions * Sat Apr 25 2015 Antonio Trande - 2.7b1-1.20150420rev751 - initial build