File python-Pyevolve.spec of Package python-Pyevolve
#
# spec file for package python-Pyevolve
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define modname Pyevolve
%define pyname pyevolve
Name: python-%{modname}
Version: 0.6rc1
Release: 0
Summary: Genetic Algorithms in Python
License: Python-2.0
Group: Development/Libraries/Python
Url: http://pyevolve.sourceforge.net/
Source: %{modname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: fdupes
BuildRequires: graphviz
BuildRequires: python-Pygments
BuildRequires: python-Sphinx
BuildRequires: python-devel
BuildRequires: python-matplotlib
BuildRequires: python-numpy-devel
BuildRequires: python-setuptools
Requires: python-numpy
Recommends: python-matplotlib
%if 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%else
BuildArch: noarch
%{py_requires}
%endif
%description
Pyevolve is a complete genetic algorithm framework written in pure python.
%package doc
Summary: Documentation for %{name}
Group: Development/Libraries/Python
Recommends: %{name} = %{version}
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
%description doc
Documentation and help files for %{name}
%prep
%setup -q -n %{modname}-%{version}
%build
export CFLAGS="%{optflags}"
python setup.py build
cd docs
chmod +x ./build_docs.sh
./build_docs.sh
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# make some clean up to silent rpmlint
cd docs
mv build html
rm -rf html/.buildinfo html/.doctrees
# fix line end encoding
find html/ -type f -exec sed -i 's/\r//' {} \;
sed -i 's/\r//' %{buildroot}/%{_bindir}/pyevolve_graph.py
# Add missing shebang
sed -i -e '1i#!/usr/bin/python' $RPM_BUILD_ROOT/%{_bindir}/pyevolve_graph.py
# remove unncessary .py extension on executable
mv %{buildroot}%{_bindir}/pyevolve_graph.py %{buildroot}%{_bindir}/pyevolve_graph
%fdupes -s html/
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%{_bindir}/pyevolve_graph
%{python_sitelib}/%{pyname}/
%{python_sitelib}/%{modname}-%{version}-py%{py_ver}.egg-info/
%files doc
%defattr(-,root,root)
%doc docs/html
%changelog