f8883a6
%if 0%{?fedora}
f8883a6
%global with_python3 1
f8883a6
%endif
f8883a6
f8883a6
%if 0%{?rhel} && 0%{?rhel} <= 6
f8883a6
%{!?__python2: %global __python2 /usr/bin/python2}
f8883a6
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
f8883a6
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
f8883a6
%global with_python3 0
f8883a6
%global python2_version 2.6
f8883a6
%endif
f8883a6
f8883a6
%if 0%{?rhel} && 0%{?rhel} > 6
f8883a6
%global with_python3 0
f8883a6
%endif
f8883a6
f8883a6
%global with_check 1
f8883a6
f8883a6
%global module biopython
01fc1b7
01fc1b7
Name:             python-biopython
71c81d4
Version:          1.66
f8883a6
Release:          2%{?dist}
01fc1b7
Summary:          Python tools for computational molecular biology
Alex Lancaster 848af80
Source0:          http://biopython.org/DIST/biopython-%{version}.tar.gz
4fe6601
License:          MIT
f8883a6
URL:              http://www.biopython.org/
01fc1b7
Group:            Development/Libraries
f8883a6
f8883a6
%{?python_provide:%python_provide python2-%{module}}
f8883a6
f8883a6
BuildRequires:    python2-devel
f8883a6
BuildRequires:    flex-devel
01fc1b7
BuildRequires:    python-reportlab
0eb813a
BuildRequires:    numpy
0eb813a
BuildRequires:    python-psycopg2
f8883a6
BuildRequires:    wise2
01fc1b7
Requires:         python-reportlab
0eb813a
Requires:         numpy
0eb813a
Requires:         python-psycopg2
3e49d58
Requires:         wise2
01fc1b7
f8883a6
%if 0%{?fedora}
f8883a6
BuildRequires:    python-mysql
f8883a6
Requires:         python-mysql
f8883a6
%else
f8883a6
BuildRequires:    MySQL-python
f8883a6
Requires:         MySQL-python
f8883a6
%endif
f8883a6
01fc1b7
%description
01fc1b7
A set of freely available Python tools for computational molecular
01fc1b7
biology.
01fc1b7
f8883a6
%if 0%{?with_python3}
f8883a6
%package -n python3-%{module}
f8883a6
Summary: Python3 tools for computational molecular biology
f8883a6
f8883a6
%{?python_provide:%python_provide python3-%{module}}
f8883a6
f8883a6
BuildRequires:    python3-devel
f8883a6
BuildRequires:    flex-devel
f8883a6
BuildRequires:    python3-reportlab
f8883a6
BuildRequires:    python3-numpy
f8883a6
BuildRequires:    python3-mysql
f8883a6
BuildRequires:    python3-psycopg2
f8883a6
Requires:         python3-reportlab
f8883a6
Requires:         python3-numpy
f8883a6
Requires:         python3-mysql
f8883a6
Requires:         python3-psycopg2
f8883a6
Requires:         wise2
f8883a6
f8883a6
%description -n python3-%{module}
f8883a6
A set of freely available Python3 tools for computational molecular
f8883a6
biology.
f8883a6
%endif
f8883a6
f8883a6
%package doc
f8883a6
Summary: PDF documentation
f8883a6
BuildArch: noarch
f8883a6
%description doc
f8883a6
PDF documentation of %{module}.
f8883a6
01fc1b7
%prep
Alex Lancaster 848af80
%setup -q -n biopython-%{version}
01fc1b7
01fc1b7
# remove all execute bits from documentation and fix line endings
01fc1b7
find Scripts -type f -exec chmod -x {} 2>/dev/null ';'
01fc1b7
find Doc -type f -exec chmod -x {} 2>/dev/null ';'
01fc1b7
find Doc -type f -exec sed -i 's/\r//' {} 2>/dev/null ';'
01fc1b7
01fc1b7
# remove execute bits from Python modules
01fc1b7
find Bio -type f -exec chmod -x {} 2>/dev/null ';'
01fc1b7
# remove she-bang lines in .py files to keep rpmlint happy
01fc1b7
find Bio -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/.*$/ d' {} 2>/dev/null ';'
01fc1b7
f8883a6
%if 0%{?with_python3}
f8883a6
rm -rf %{py3dir}
f8883a6
cp -a . %{py3dir}
f8883a6
%endif # with_python3
f8883a6
01fc1b7
%build
f8883a6
CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python2} setup.py build
f8883a6
f8883a6
%if 0%{?with_python3}
f8883a6
pushd %{py3dir}
f8883a6
CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro -Wl,-z,now" %{__python3} setup.py build
f8883a6
popd
f8883a6
%endif # with_python3
01fc1b7
01fc1b7
%install
f8883a6
%if 0%{?with_python3}
f8883a6
pushd %{py3dir}
f8883a6
%{__python3} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython
f8883a6
popd
f8883a6
%endif
01fc1b7
f8883a6
%{__python2} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT --install-data=%{_datadir}/python-biopython
01fc1b7
f8883a6
##DocTest cannot be executed
f8883a6
##https://github.com/biopython/biopython/issues/669
f8883a6
##http://lists.open-bio.org/pipermail/biopython-dev/2014-May/020541.html
f8883a6
%if 0%{?with_check}
f8883a6
%check
f8883a6
pushd Tests
f8883a6
find . -name 'run_tests.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python2}|'
f8883a6
for test in `ls test_*.py | grep -v Tutorial`; do
f8883a6
%{__python2} run_tests.py --offline -v ${test}
f8883a6
done
f8883a6
popd
f8883a6
f8883a6
##Not all tests are ready for Python3
f8883a6
%if 0%{?with_python3}
f8883a6
pushd %{py3dir}
f8883a6
pushd Tests
f8883a6
find . -name 'run_tests.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python3}|'
f8883a6
for test in `ls test_*.py | grep -v test_Tutorial | grep -v test_SeqIO | grep -v test_NCBIXML | grep -v test_Phylo`; do
f8883a6
%{__python3} run_tests.py --offline -v ${test}
f8883a6
done
f8883a6
%endif
f8883a6
%endif
01fc1b7
01fc1b7
%files
f8883a6
%{!?_licensedir:%global license %doc}
f8883a6
%doc Scripts
f8883a6
%doc CONTRIB DEPRECATED NEWS README
f8883a6
%license LICENSE
f8883a6
%{python2_sitearch}/*egg-info
f8883a6
%{python2_sitearch}/Bio/
f8883a6
%{python2_sitearch}/BioSQL/*
f8883a6
f8883a6
%if 0%{?with_python3}
f8883a6
%files -n python3-%{module}
f8883a6
%{!?_licensedir:%global license %doc}
01fc1b7
%doc Doc Scripts
f8883a6
%doc CONTRIB DEPRECATED NEWS README
f8883a6
%license LICENSE
f8883a6
%{python3_sitearch}/*egg-info
f8883a6
%{python3_sitearch}/Bio/
f8883a6
%{python3_sitearch}/BioSQL/*
1ee5433
%endif
f8883a6
f8883a6
%files doc
f8883a6
%{!?_licensedir:%global license %doc}
f8883a6
%doc Doc/*.pdf
f8883a6
%license LICENSE
01fc1b7
01fc1b7
%changelog
f8883a6
* Wed Dec 09 2015 Antonio Trande <sagitter@fedoraproject.org> - 1.66-2
f8883a6
- Built with Python3
f8883a6
- Some cleanups
f8883a6
- Set --cflags
f8883a6
- Fixed MySQL dependencies in Fedora
f8883a6
f8883a6
* Tue Dec 08 2015 Luis Bazan <lbazan@fedoraproject.org>
f8883a6
- 1.66-1 - new upstream version
71c81d4
f8883a6
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org>
f8883a6
- 1.65-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 
5e9bf6a
4d799ca
* Thu Jan 08 2015 Luis Bazan <lbazan@fedoraproject.org> - 1.65-1
4d799ca
- New upstream version
4d799ca
ae73b24
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.64-2
ae73b24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
ae73b24
f8dac09
* Tue Jun 10 2014 Luis Bazan <lbazan@fedoraproject.org> - 1.64-1
f8dac09
- New Upstream Version
f8dac09
5bb03f6
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.60-4
5bb03f6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
5bb03f6
cc1465b
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.60-3
cc1465b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
cc1465b
1ea445b
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.60-2
1ea445b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
1ea445b
Alex Lancaster 0ed6c30
* Sat Nov 17 2012 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.60-1
Alex Lancaster 0ed6c30
- Update to latest upstream (#835434)
Alex Lancaster 0ed6c30
- Drop flex-related patch, no longer needed
Alex Lancaster 0ed6c30
28bf9eb
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.59-2
28bf9eb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
28bf9eb
Alex Lancaster 830a085
* Fri Mar  9 2012 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.59-1
Alex Lancaster 830a085
- Update to latest upstream (1.59) (#797872)
Alex Lancaster 830a085
6cf1e32
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.58-2
6cf1e32
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
6cf1e32
Alex Lancaster 848af80
* Tue Sep 20 2011 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.58-1
Alex Lancaster 848af80
- Update to upstream 1.58
Alex Lancaster 848af80
dbf7008
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.55-0.2.b
dbf7008
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
dbf7008
0657b1b
* Fri Aug 20 2010 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.55-0.1.b
0657b1b
- Update to 1.55 beta
0657b1b
- BuildRequires: flex-static, libraries are now split out
0657b1b
bbf5874
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 1.54-2
bbf5874
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
bbf5874
247ecf5
* Fri May 21 2010 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.54-1
247ecf5
- Update to upstream 1.54
247ecf5
e4ad51a
* Tue Apr  6 2010 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.54-0.1.b
e4ad51a
- Update to 1.54 beta
e4ad51a
63e33f6
* Tue Dec 15 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.53-1
63e33f6
- Update to upstream 1.53
63e33f6
32835cf
* Thu Oct 15 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.52-1
32835cf
- Update to latest upstream (1.52)
32835cf
81148ac
* Tue Aug 18 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.51-1
81148ac
- Update to upstream 1.51
81148ac
- Drop mx {Build}Requires, no longer used upstream
81148ac
- Remove Martel modules, no longer distributed upstream
81148ac
- Add flex to BuildRequires, patch setup to build
81148ac
  Bio.PDB.mmCIF.MMCIFlex as per upstream:
81148ac
  http://bugzilla.open-bio.org/show_bug.cgi?id=2619
81148ac
9be8571
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.49-3
9be8571
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
9be8571
6f9b02e
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.49-2
6f9b02e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
6f9b02e
0eb813a
* Mon Dec  1 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.49-1
0eb813a
- Update to latest upstream (1.49) uses numpy and new API for psycopg2
0eb813a
- [Build]Requires python-numeric -> numpy 
0eb813a
- [Build]Requires python-psycopg -> python-psycopg2
0eb813a
- Remove interactive question hack, no longer needed
0eb813a
72d1d93
* Sun Nov 30 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.48-3
72d1d93
- Temporarily disable python-psycopg dependency until it is rebuilt
72d1d93
  for Python 2.6
72d1d93
bfa6725
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 1.48-2
bfa6725
- Rebuild for Python 2.6
bfa6725
c6c3d03
* Mon Sep 29 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.48-1
c6c3d03
- Update to latest upstream (1.48)
c6c3d03
dd62f71
* Fri Jul  4 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.47-1
dd62f71
- Update to latest upstream (1.47)
dd62f71
9f01ebf
* Sun Mar 23 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.45-1
9f01ebf
- Update to latest upstream (1.45)
9f01ebf
fe75157
* Sat Feb  9 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.44-4
fe75157
- rebuilt for GCC 4.3 as requested by Fedora Release Engineering
fe75157
1ee5433
* Thu Dec 13 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.44-3
1ee5433
- Include eggs in file list for F9+
1ee5433
1ee5433
* Sun Oct 28 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.44-2
89847d0
- Drop patch to setup.py, applied upstream
89847d0
1ee5433
* Sun Oct 28 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.44-1
3757f16
- Update to latest upstream (1.44).
3757f16
1ee5433
* Mon Aug 27 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-5
4fe6601
- Used "MIT" as short license name as the "Biopython License
4fe6601
  Agreement" is the same as the CMU MIT variant.
4fe6601
f8883a6
* Wed Apr 25 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-4
3e49d58
- Add wise2 Requires since the Wise biopython module uses the
3e49d58
  command-line behind-the-scenes.
3e49d58
f8883a6
* Tue Apr 17 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-3
5ec6566
- Use python_sitearch macro to enable x86_64 builds work.
5ec6566
1ee5433
* Mon Apr 16 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-2
01fc1b7
- Fix Source0 URL as per suggestion from Parag AN on #235989.
01fc1b7
1ee5433
* Mon Apr 02 2007 Alex Lancaster <alexlan[AT]fedoraproject.org> 1.43-1
01fc1b7
- Initial Fedora package.
01fc1b7
01fc1b7