Blob Blame History Raw
%global commit 232ed17142da1c8bb6a39179018f8278b122aada
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global date 20160624


Name:           python-deap
Version:        1.0.1
Release:        2.%{date}git%{shortcommit}%{?dist}
Summary:        Distributed Evolutionary Algorithms in Python

License:        LGPLv3
URL:            https://www.github.com/deap
Source0:        https://github.com/DEAP/deap/archive/%{commit}.tar.gz#/deap-%{shortcommit}.tar.gz

BuildRequires:  python2-devel
BuildRequires:  python-setuptools
BuildRequires:  python2-pypandoc

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pypandoc

# documentation
%if 0%{?fedora} >= 24
BuildRequires:  python2-sphinx
%else
BuildRequires:  python-sphinx
%endif
BuildRequires:  texlive-scheme-basic
BuildRequires:  texlive-ucs
BuildRequires:  numpy
BuildRequires:  python2-matplotlib

%global _description \
DEAP is a novel evolutionary computation framework for rapid         \
prototyping and testing of ideas that implements a number of genetic \
optimization algorithms behind a common interface.

%description %_description

%package -n     python2-deap
Requires:       numpy
Summary:        %{summary}
%{?python_provide:%python_provide python2-deap}

%description -n python2-deap %_description

%package -n     python3-deap
Requires:       python3-numpy
Summary:        %{summary}
%{?python_provide:%python_provide python3-deap}

%description -n python3-deap %_description

%package -n python-deap-doc
Summary:        Documentation for deap
BuildArch:      noarch
%description -n python-deap-doc
%{summary}.

%prep
%autosetup -n deap-%{commit}
sed -i 's/\["git", "rev-parse", "HEAD"\]/["echo", "deap-%{version}-%{release}"]/' \
    doc/conf.py

# Work around for https://github.com/matplotlib/matplotlib/issues/7313
sed -i -r 's/arange\(([-0-9.]+), ([-0-9.]+), [-0-9.]+\)/linspace(\1, \2, 20)/' doc/code/benchmarks/*.py

%build
%py2_build
%py3_build
# generate html docs
%if 0%{?fedora} >= 24
PYTHONPATH=$(echo build/lib.linux-*-%{python_version}/) sphinx-build-2 doc build/html
%else
PYTHONPATH=$(echo build/lib.linux-*-%{python_version}/) sphinx-build doc build/html
%endif

# remove the sphinx-build leftovers
rm -rf build/html/.{doctrees,buildinfo}

%global _docdir_fmt %{name}

%install
%py2_install
%py3_install

%files -n python2-deap
%license LICENSE.txt
%doc README.md
%{python2_sitearch}/deap
%{python2_sitearch}/deap-*.egg-info

%files -n python3-deap
%license LICENSE.txt
%doc README.md
%{python3_sitearch}/deap
%{python3_sitearch}/deap-*.egg-info

%files -n python-deap-doc
%license LICENSE.txt
%doc build/html

%changelog
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.0.1-2.20160624git232ed17
- Rebuild for Python 3.6

* Tue Oct 18 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0.1-1.20160624git232ed17
- Update to latest git snapshot
- The version was wrong (upstream never released anything after
  1.0.1).  I forgot to actually create an update with the initial
  version of this package. Luckily, this package was only built in
  F22-24, and failed to build in rawhide, so it was never possible to
  install it from repositories. I think this means it is possible to
  lower the version without bumping the epoch.

* Thu Apr 07 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.10-0.20160402gita4dc752
- Initial package.