Blob Blame History Raw
%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.68
Release:          3%{?dist}
Summary:          Python tools for computational molecular biology
Source0:          http://biopython.org/DIST/biopython-%{version}.tar.gz
License:          MIT
URL:              http://www.biopython.org/
Group:            Development/Libraries

BuildRequires:    python2-devel
BuildRequires:    flex-devel
BuildRequires:    python-reportlab
BuildRequires:    numpy
BuildRequires:    python-psycopg2
BuildRequires:    python-rdflib
BuildRequires:    wise2
Requires:         python-reportlab
Requires:         numpy
Requires:         python-psycopg2
Requires:         wise2
Requires:         python-rdflib

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

%package -n python2-%{module}
Summary:  %{sum}
%{?python_provide:%python_provide python2-%{module}}

%description -n python2-%{module}
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
BuildRequires:    python3-rdflib
Requires:         python3-reportlab
Requires:         python3-numpy
Requires:         python3-mysql
Requires:         python3-psycopg2
Requires:         wise2
Requires:         python3-rdflib

%description -n python3-%{module}
A set of freely available Python3 tools for computational molecular
biology.
%endif

%package doc
Summary: PDF and HTML documentation of %{module}
BuildArch: noarch
%description doc
PDF/HTML documentation of %{module}.

%prep
%setup -qc

mv %{module}-%{version} python2
pushd python2

# 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 ';'
find Doc -type f -exec sed -i 's/\r//' {} 2>/dev/null ';'

# remove execute bits from Python modules
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 ';'
popd

%if 0%{?with_python3}
cp -a python2 python3
%endif # with_python3

%build
pushd python2
CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python2} setup.py build --executable="%{__python2} -s"
popd

%if 0%{?with_python3}
pushd python3
CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python3} setup.py build --executable="%{__python3} -s"
popd
%endif # with_python3

%install
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython
popd
%endif

pushd python2
%{__python2} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython
popd

##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 python2/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

# See https://github.com/biopython/biopython/issues/855
%if 0%{?with_python3}
pushd python3/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_NCBIXML | grep -v test_Phylo | grep -v test_SeqIO`; do
echo $LANG
%{__python3} run_tests.py --offline -v ${test}
done
popd
%endif
%endif

%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/*

%if 0%{?with_python3}
%files -n python3-%{module}
%{!?_licensedir:%global license %doc}
%doc python3/Scripts
%doc python3/CONTRIB python3/DEPRECATED python3/NEWS python3/README
%license python3/LICENSE
%{python3_sitearch}/*egg-info
%{python3_sitearch}/Bio/
%{python3_sitearch}/BioSQL/*
%endif

%files doc
%{!?_licensedir:%global license %doc}
%doc python2/Doc
%license python2/LICENSE

%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.68-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.68-2
- Rebuild for Python 3.6

* Sat Aug 27 2016 Antonio Trande <sagitter@fedoraproject.org> - 1.68-1
- Update to 1.68
- Drop old patch

* Wed Aug 17 2016 Antonio Trande <sagitter@fedoraproject.org> - 1.67-3
- Rebuild for Python 3.5.2

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.67-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Wed Jun 15 2016 Antonio Trande <sagitter@fedoraproject.org> - 1.67-1
- Update to 1.67

* Mon Feb 15 2016 Antonio Trande <sagitter@fedoraproject.org> - 1.66-6
- Typo fixed

* Mon Feb 15 2016 Antonio Trande <sagitter@fedoraproject.org> - 1.66-5
- Created a python2- package

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.66-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Dec 09 2015 Antonio Trande <sagitter@fedoraproject.org> - 1.66-3
- SPEC file adapted to recent guidelines for Python

* Wed Dec 09 2015 Antonio Trande <sagitter@fedoraproject.org> - 1.66-2
- Built with Python3
- Some cleanups
- Set --cflags
- Fixed MySQL dependencies in Fedora

* Tue Dec 08 2015 Luis Bazan <lbazan@fedoraproject.org> - 1.66-1
- new upstream version

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.65-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Thu Jan 08 2015 Luis Bazan <lbazan@fedoraproject.org> - 1.65-1
- New upstream version

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.64-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Jun 10 2014 Luis Bazan <lbazan@fedoraproject.org> - 1.64-1
- New Upstream Version

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.60-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.60-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.60-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Nov 17 2012 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.60-1
- Update to latest upstream (#835434)
- Drop flex-related patch, no longer needed

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.59-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Mar  9 2012 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.59-1
- Update to latest upstream (1.59) (#797872)

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.58-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Sep 20 2011 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.58-1
- Update to upstream 1.58

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.55-0.2.b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Aug 20 2010 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.55-0.1.b
- Update to 1.55 beta
- BuildRequires: flex-static, libraries are now split out

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 1.54-2
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Fri May 21 2010 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.54-1
- Update to upstream 1.54

* Tue Apr  6 2010 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.54-0.1.b
- Update to 1.54 beta

* Tue Dec 15 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.53-1
- Update to upstream 1.53

* Thu Oct 15 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.52-1
- Update to latest upstream (1.52)

* Tue Aug 18 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.51-1
- Update to upstream 1.51
- Drop mx {Build}Requires, no longer used upstream
- Remove Martel modules, no longer distributed upstream
- Add flex to BuildRequires, patch setup to build
  Bio.PDB.mmCIF.MMCIFlex as per upstream:
  http://bugzilla.open-bio.org/show_bug.cgi?id=2619

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.49-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

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

* Mon Dec  1 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.49-1
- Update to latest upstream (1.49) uses numpy and new API for psycopg2
- [Build]Requires python-numeric -> numpy 
- [Build]Requires python-psycopg -> python-psycopg2
- Remove interactive question hack, no longer needed

* Sun Nov 30 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.48-3
- Temporarily disable python-psycopg dependency until it is rebuilt
  for Python 2.6

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 1.48-2
- Rebuild for Python 2.6

* Mon Sep 29 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.48-1
- Update to latest upstream (1.48)

* Fri Jul  4 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.47-1
- Update to latest upstream (1.47)

* Sun Mar 23 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.45-1
- Update to latest upstream (1.45)

* Sat Feb  9 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.44-4
- rebuilt for GCC 4.3 as requested by Fedora Release Engineering

* Thu Dec 13 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.44-3
- Include eggs in file list for F9+

* Sun Oct 28 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.44-2
- Drop patch to setup.py, applied upstream

* Sun Oct 28 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.44-1
- Update to latest upstream (1.44).

* Mon Aug 27 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-5
- Used "MIT" as short license name as the "Biopython License
  Agreement" is the same as the CMU MIT variant.

* Wed Apr 25 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-4
- Add wise2 Requires since the Wise biopython module uses the
  command-line behind-the-scenes.

* Tue Apr 17 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-3
- Use python_sitearch macro to enable x86_64 builds work.

* Mon Apr 16 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-2
- Fix Source0 URL as per suggestion from Parag AN on #235989.

* Mon Apr 02 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-1
- Initial Fedora package.