Blob Blame History Raw
%global forgeurl https://www.github.com/deap/deap

Name:           python-deap
Version:        1.3.3

Release:        %autorelease
Summary:        Distributed Evolutionary Algorithms in Python
%forgemeta
%global ref %version

License:        LGPLv3
URL:            https://www.github.com/deap
Source0:        %{forgesource}

BuildRequires:  gcc
BuildRequires:  gcc-c++

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pypandoc
BuildRequires:  python3-pytest
BuildRequires:  python3-nose
BuildRequires:  python3-numpy

# documentation
BuildRequires:  python3-sphinx
BuildRequires:  texlive-scheme-basic
BuildRequires:  tex(ucs.sty)
BuildRequires:  tex(anyfontsize.sty)
BuildRequires:  python3-numpy
BuildRequires:  python3-matplotlib

%global _description %{expand:
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     python3-deap
Requires:       python3-numpy
BuildRequires:  python3-nose
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 %{extractdir} -p1
sed -i 's/\["git", "rev-parse", "HEAD"\]/["echo", "deap-%{version}-%{release}"]/' \
    doc/conf.py

# https://bugzilla.redhat.com/show_bug.cgi?id=1644771
sed -i -r "s|'matplotlib.sphinxext.only_directives',||" doc/conf.py

%build
%py3_build

# generate html docs
PYTHONPATH=build/lib.%{python3_platform}-%{python3_version} sphinx-build-3 doc build/html

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

%global _docdir_fmt %{name}

%install
%py3_install

%check
%ifarch s390x
# Fails with: AssertionError: CMA algorithm did not converged properly.
%global test_options -k 'not test_cma'
%endif

PYTHONPATH=%{buildroot}%{python3_sitearch} pytest -v \
  %{buildroot}%{python3_sitearch}/deap/tests \
  %{?test_options}

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