diff --git a/python-biopython.spec b/python-biopython.spec index 757bd0c..2fdf8c6 100644 --- a/python-biopython.spec +++ b/python-biopython.spec @@ -1,9 +1,11 @@ -%if 0%{?fedora} || 0%{?rhel} > 7 +%if 0%{?rhel} && 0%{?rhel} > 7 %global with_python3 1 +%global with_python2 0 %endif %if 0%{?rhel} && 0%{?rhel} == 7 %global with_python3 0 +%global with_python2 1 %endif %if 0%{?rhel} @@ -12,13 +14,23 @@ %global py2_prefix python2 %endif +%if 0%{?fedora} && 0%{?fedora} < 30 +%global with_python3 1 +%global with_python2 1 +%endif + +%if 0%{?fedora} && 0%{?fedora} >= 30 +%global with_python3 1 +%global with_python2 0 +%endif + %global with_check 1 %global module biopython Name: python-biopython Version: 1.72 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Python tools for computational molecular biology Source0: https://files.pythonhosted.org/packages/source/b/%{module}/%{module}-%{version}.tar.gz @@ -29,10 +41,15 @@ License: MIT and BSD URL: http://www.biopython.org/ BuildRequires: gcc +%if 0%{?with_python3_other} +BuildRequires: python%{python3_other_pkgversion}-devel +%endif + %description A set of freely available Python tools for computational molecular biology. +%if 0%{?with_python2} %package -n python2-%{module} Summary: Python tools for computational molecular biology %{?python_provide:%python_provide python2-%{module}} @@ -72,46 +89,69 @@ Requires: python2-mysql BuildRequires: MySQL-python Requires: MySQL-python %endif - -%if 0%{?fedora} && 0%{?fedora} < 28 -Requires: mysql-connector-python -%endif -%if 0%{?fedora} && 0%{?fedora} >= 28 Requires: %{py2_prefix}-mysql-connector -%endif %description -n python2-%{module} A set of freely available Python tools for computational molecular biology. +%endif %if 0%{?with_python3} -%package -n python3-%{module} +%package -n python%{python3_pkgversion}-%{module} Summary: Python3 tools for computational molecular biology -%{?python_provide:%python_provide python3-%{module}} +%{?python_provide:%python_provide python%{python3_pkgversion}-%{module}} -BuildRequires: python3-devel +BuildRequires: python%{python3_pkgversion}-devel BuildRequires: flex-devel -BuildRequires: python3-reportlab -BuildRequires: python3-numpy -BuildRequires: python3-mysql -BuildRequires: python3-psycopg2 -BuildRequires: python3-rdflib -Requires: python3-networkx -Requires: python3-pygraphviz -Requires: mysql-connector-python3 -Requires: python3-reportlab -Requires: python3-numpy -Requires: python3-mysql -Requires: python3-psycopg2 +BuildRequires: python%{python3_pkgversion}-reportlab +BuildRequires: python%{python3_pkgversion}-numpy +BuildRequires: python%{python3_pkgversion}-mysql +BuildRequires: python%{python3_pkgversion}-psycopg2 +BuildRequires: python%{python3_pkgversion}-rdflib +Requires: python%{python3_pkgversion}-networkx +Requires: python%{python3_pkgversion}-pygraphviz +Requires: mysql-connector-python%{python3_pkgversion} +Requires: python%{python3_pkgversion}-reportlab +Requires: python%{python3_pkgversion}-numpy +Requires: python%{python3_pkgversion}-mysql +Requires: python%{python3_pkgversion}-psycopg2 Requires: wise2 -Requires: python3-rdflib +Requires: python%{python3_pkgversion}-rdflib -%description -n python3-%{module} +%description -n python%{python3_pkgversion}-%{module} A set of freely available Python3 tools for computational molecular biology. %endif +%if 0%{?with_python3_other} +%package -n python%{python3_other_pkgversion}-%{module} +Summary: Python3 tools for computational molecular biology + +%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{module}} + +BuildRequires: python%{python3_other_pkgversion}-devel +BuildRequires: flex-devel +BuildRequires: python%{python3_other_pkgversion}-reportlab +BuildRequires: python%{python3_other_pkgversion}-numpy +BuildRequires: python%{python3_other_pkgversion}-mysql +BuildRequires: python%{python3_other_pkgversion}-psycopg2 +BuildRequires: python%{python3_other_pkgversion}-rdflib +Requires: python%{python3_other_pkgversion}-networkx +Requires: python%{python3_other_pkgversion}-pygraphviz +Requires: mysql-connector-python%{python3_other_pkgversion} +Requires: python%{python3_other_pkgversion}-reportlab +Requires: python%{python3_other_pkgversion}-numpy +Requires: python%{python3_other_pkgversion}-mysql +Requires: python%{python3_other_pkgversion}-psycopg2 +Requires: wise2 +Requires: python%{python3_other_pkgversion}-rdflib + +%description -n python%{python3_other_pkgversion}-%{module} +A set of freely available Python3 tools for computational molecular +biology. +%endif # with_python3_other + %package doc Summary: PDF and HTML documentation of %{module} BuildArch: noarch @@ -121,9 +161,7 @@ PDF/HTML documentation of %{module}. %prep %setup -qc -mv %{module}-1.72 python2 -pushd python2 - +pushd %{module}-1.72 # remove all execute bits from documentation and fix line endings find Scripts -type f -exec chmod -x {} 2>/dev/null ';' find Doc -type f -exec chmod -x {} 2>/dev/null ';' @@ -135,21 +173,37 @@ find Bio -type f -exec chmod -x {} 2>/dev/null ';' find Bio -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/.*$/ d' {} 2>/dev/null ';' popd +%if 0%{?with_python2} +cp -a %{module}-%{version} python2 +%endif + %if 0%{?with_python3} -cp -a python2 python3 +cp -a %{module}-%{version} python3 %endif # with_python3 +%if 0%{?with_python3_other} +cp -a %{module}-%{version} python%{python3_other_pkgversion} +%endif # with_python3_other + %build +%if 0%{?with_python2} pushd python2 -CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python2} setup.py build --executable="%{__python2} -s" +%py2_build popd +%endif %if 0%{?with_python3} pushd python3 -CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python3} setup.py build --executable="%{__python3} -s" +%py3_build popd %endif # with_python3 +%if 0%{?with_python3_other} +pushd python%{python3_other_pkgversion} +%py3_other_build +popd +%endif # with_python3_other + %install %if 0%{?with_python3} pushd python3 @@ -157,15 +211,24 @@ pushd python3 popd %endif +%if 0%{?with_python3_other} +pushd python%{python3_other_pkgversion} +%{__python3_other} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython +popd +%endif + +%if 0%{?with_python2} pushd python2 %{__python2} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython popd +%endif ##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 +%if 0%{?with_python2} pushd python2 export PYTHONPATH=$RPM_BUILD_ROOT%{python2_sitearch} find . -name 'run_tests.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python2}|' @@ -173,6 +236,7 @@ for test in `ls test_*.py | grep -v Tutorial`; do %{__python2} run_tests.py --offline -v ${test} done popd +%endif # See https://github.com/biopython/biopython/issues/855 %if 0%{?with_python3} @@ -185,20 +249,32 @@ export PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitearch} done popd %endif -%endif +# See https://github.com/biopython/biopython/issues/855 +%if 0%{?with_python3_other} +pushd python%{python3_other_pkgversion}/Tests +find . -name 'run_tests.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python3_other}|' +for test in `ls test_*.py | grep -v Nexus | grep -v Phylo | grep -v Tutorial | grep -v bgzf`; do +echo $LANG +export PYTHONPATH=$RPM_BUILD_ROOT%{python3_other_sitearch} +%{__python3_other} run_tests.py --offline -v ${test} +done +popd +%endif # with_python3_other +%endif # with_check + +%if 0%{?with_python2} %files -n python2-%{module} -%{!?_licensedir:%global license %doc} %doc python2/Scripts %doc python2/CONTRIB python2/DEPRECATED python2/NEWS python2/README %license python2/LICENSE %{python2_sitearch}/*egg-info %{python2_sitearch}/Bio/ %{python2_sitearch}/BioSQL/ +%endif %if 0%{?with_python3} -%files -n python3-%{module} -%{!?_licensedir:%global license %doc} +%files -n python%{python3_pkgversion}-%{module} %doc python3/Scripts %doc python3/CONTRIB python3/DEPRECATED python3/NEWS python3/README %license python3/LICENSE @@ -207,12 +283,25 @@ popd %{python3_sitearch}/BioSQL/ %endif +%if 0%{?with_python3_other} +%files -n python%{python3_other_pkgversion}-%{module} +%doc python%{python3_other_pkgversion}/Scripts +%doc python%{python3_other_pkgversion}/CONTRIB python%{python3_other_pkgversion}/DEPRECATED python%{python3_other_pkgversion}/NEWS python%{python3_other_pkgversion}/README +%license python%{python3_other_pkgversion}/LICENSE +%{python3_other_sitearch}/*egg-info +%{python3_other_sitearch}/Bio/ +%{python3_other_sitearch}/BioSQL/ +%endif + %files doc -%{!?_licensedir:%global license %doc} -%doc python2/Doc -%license python2/LICENSE +%doc %{module}-1.72/Doc +%license %{module}-1.72/LICENSE %changelog +* Wed Aug 22 2018 Antonio Trande - 1.72-3 +- Deprecate Python2 on fedora 30+ +- Prepare SPEC file for Python3-modules packaging on epel7 + * Fri Jul 13 2018 Fedora Release Engineering - 1.72-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild