diff --git a/python-biopython.spec b/python-biopython.spec index 7f35631..94bdeff 100644 --- a/python-biopython.spec +++ b/python-biopython.spec @@ -1,31 +1,86 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%if 0%{?fedora} +%global with_python3 1 +%endif + +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%global with_python3 0 +%global python2_version 2.6 +%endif + +%if 0%{?rhel} && 0%{?rhel} > 6 +%global with_python3 0 +%endif + +%global with_check 1 + +%global module biopython Name: python-biopython Version: 1.66 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Python tools for computational molecular biology Source0: http://biopython.org/DIST/biopython-%{version}.tar.gz License: MIT -Url: http://www.biopython.org/ +URL: http://www.biopython.org/ Group: Development/Libraries -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: python-devel -BuildRequires: flex-static + +%{?python_provide:%python_provide python2-%{module}} + +BuildRequires: python2-devel +BuildRequires: flex-devel BuildRequires: python-reportlab BuildRequires: numpy -BuildRequires: MySQL-python BuildRequires: python-psycopg2 +BuildRequires: wise2 Requires: python-reportlab Requires: numpy -Requires: MySQL-python Requires: python-psycopg2 Requires: wise2 +%if 0%{?fedora} +BuildRequires: python-mysql +Requires: python-mysql +%else +BuildRequires: MySQL-python +Requires: MySQL-python +%endif + %description A set of freely available Python tools for computational molecular biology. +%if 0%{?with_python3} +%package -n python3-%{module} +Summary: Python3 tools for computational molecular biology + +%{?python_provide:%python_provide python3-%{module}} + +BuildRequires: python3-devel +BuildRequires: flex-devel +BuildRequires: python3-reportlab +BuildRequires: python3-numpy +BuildRequires: python3-mysql +BuildRequires: python3-psycopg2 +Requires: python3-reportlab +Requires: python3-numpy +Requires: python3-mysql +Requires: python3-psycopg2 +Requires: wise2 + +%description -n python3-%{module} +A set of freely available Python3 tools for computational molecular +biology. +%endif + +%package doc +Summary: PDF documentation +BuildArch: noarch +%description doc +PDF documentation of %{module}. + %prep %setup -q -n biopython-%{version} @@ -39,38 +94,89 @@ find Bio -type f -exec chmod -x {} 2>/dev/null ';' # remove she-bang lines in .py files to keep rpmlint happy find Bio -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/.*$/ d' {} 2>/dev/null ';' +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif # with_python3 + %build -env CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build +CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python2} setup.py build + +%if 0%{?with_python3} +pushd %{py3dir} +CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python3} setup.py build +popd +%endif # with_python3 %install -rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython +popd +%endif -## disable tests for the moment -%check -%{?_with_check:%{__python} setup.py test --no-gui || :} +%{__python2} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython -%clean -rm -rf $RPM_BUILD_ROOT +##DocTest cannot be executed +##https://github.com/biopython/biopython/issues/669 +##http://lists.open-bio.org/pipermail/biopython-dev/2014-May/020541.html +%if 0%{?with_check} +%check +pushd Tests +find . -name 'run_tests.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python2}|' +for test in `ls test_*.py | grep -v Tutorial`; do +%{__python2} run_tests.py --offline -v ${test} +done +popd + +##Not all tests are ready for Python3 +%if 0%{?with_python3} +pushd %{py3dir} +pushd Tests +find . -name 'run_tests.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python3}|' +for test in `ls test_*.py | grep -v test_Tutorial | grep -v test_SeqIO | grep -v test_NCBIXML | grep -v test_Phylo`; do +%{__python3} run_tests.py --offline -v ${test} +done +%endif +%endif %files -%defattr(-,root,root,-) +%{!?_licensedir:%global license %doc} +%doc Scripts +%doc CONTRIB DEPRECATED NEWS README +%license LICENSE +%{python2_sitearch}/*egg-info +%{python2_sitearch}/Bio/ +%{python2_sitearch}/BioSQL/* + +%if 0%{?with_python3} +%files -n python3-%{module} +%{!?_licensedir:%global license %doc} %doc Doc Scripts -%doc CONTRIB DEPRECATED LICENSE NEWS README -%if 0%{?fedora} >= 9 -%{python_sitearch}/*egg-info +%doc CONTRIB DEPRECATED NEWS README +%license LICENSE +%{python3_sitearch}/*egg-info +%{python3_sitearch}/Bio/ +%{python3_sitearch}/BioSQL/* %endif -%dir %{python_sitearch}/Bio -%{python_sitearch}/Bio/* -%dir %{python_sitearch}/BioSQL -%{python_sitearch}/BioSQL/* + +%files doc +%{!?_licensedir:%global license %doc} +%doc Doc/*.pdf +%license LICENSE %changelog -* Tue Dec 08 2015 Luis Bazan - 1.66-1 -- new upstream version +* Wed Dec 09 2015 Antonio Trande - 1.66-2 +- Built with Python3 +- Some cleanups +- Set --cflags +- Fixed MySQL dependencies in Fedora + +* Tue Dec 08 2015 Luis Bazan +- 1.66-1 - new upstream version -* Thu Jun 18 2015 Fedora Release Engineering - 1.65-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild +* Thu Jun 18 2015 Fedora Release Engineering +- 1.65-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Thu Jan 08 2015 Luis Bazan - 1.65-1 - New upstream version @@ -180,11 +286,11 @@ rm -rf $RPM_BUILD_ROOT - Used "MIT" as short license name as the "Biopython License Agreement" is the same as the CMU MIT variant. -* Mon Apr 25 2007 Alex Lancaster 1.43-4 +* Wed Apr 25 2007 Alex Lancaster 1.43-4 - Add wise2 Requires since the Wise biopython module uses the command-line behind-the-scenes. -* Mon Apr 17 2007 Alex Lancaster 1.43-3 +* Tue Apr 17 2007 Alex Lancaster 1.43-3 - Use python_sitearch macro to enable x86_64 builds work. * Mon Apr 16 2007 Alex Lancaster 1.43-2 diff --git a/sources b/sources index 963f54c..b7a0248 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -2f09afb0a7740a70f64b6d10dfc2582b biopython-1.66.tar.gz +d3f4c14e5cba3dfd354d0e0013bc350f biopython-1.66.tar.gz