5d179b6
%bcond_without tests
5d179b6
5cb8ef9
# Sphinx-generated HTML documentation is not suitable for packaging; see
5cb8ef9
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
5cb8ef9
#
5cb8ef9
# We can generate PDF documentation as a substitute.
5cb8ef9
5cb8ef9
# We do not generate docs, due to the missing dependencies
5cb8ef9
%bcond_without doc_pdf
5cb8ef9
5d179b6
%global pypi_name pyunicorn
9ae9ee4
%global forgeurl https://github.com/pik-copan/pyunicorn
9ae9ee4
%global commit master
229e99d
%global upstream_version 0.7.0a1
5d179b6
5d179b6
%global _description %{expand:
7b81325
pyunicorn (Unified Complex Network and RecurreNce analysis toolbox)
7b81325
is a fully object-oriented Python package for the advanced
5d179b6
analysis and modeling of complex networks. Above the standard measures
5d179b6
of complex network theory such as degree, betweenness and clustering 
5d179b6
coefficient it provides some uncommon but interesting statistics like 
5d179b6
Newman's random walk betweenness. pyunicorn features novel node-weighted
5d179b6
(node splitting invariant) network statistics as well as measures 
5d179b6
designed for analyzing networks of interacting/interdependent networks.}
5d179b6
5d179b6
Name:           python-%{pypi_name}
9ae9ee4
9ae9ee4
%forgemeta
9ae9ee4
9ae9ee4
# Set version to preliminary version defined in setup.cfg
d63cb50
Version:        0.7.0~a1
9ae9ee4
Release:        %{autorelease}
5d179b6
Summary:        Unified complex network and recurrence analysis toolbox
5d179b6
5d179b6
# The entire source code is BSD except the following files:
5d179b6
#pyunicorn-0.6.1/pyunicorn/utils/progressbar/__init__.py
5d179b6
#pyunicorn-0.6.1/pyunicorn/utils/progressbar/compat.py
5d179b6
#pyunicorn-0.6.1/pyunicorn/utils/progressbar/progressbar.py
5d179b6
#pyunicorn-0.6.1/pyunicorn/utils/progressbar/widgets.py
5d179b6
License:        BSD and LGPLv2+
5d179b6
URL:            http://www.pik-potsdam.de/~donges/pyunicorn/
9ae9ee4
Source0:        %{forgesource}
601cd08
601cd08
# patch intended for skipping two tests due to the failed attempts on i686
9ae9ee4
#Patch0:         0001-Skip-test.patch
601cd08
601cd08
# patch removes two badges that are in svg format
601cd08
# it resolves problems with building docs
9ae9ee4
#Patch1:         0002-Remove-badges-in-README.patch
5d179b6
5d179b6
BuildRequires:  python3-devel
5d179b6
BuildRequires:  python3dist(setuptools)
5d179b6
5cb8ef9
%if %{with doc_pdf}
5cb8ef9
BuildRequires:  make
9ae9ee4
BuildRequires:  python3-sphinx
5cb8ef9
BuildRequires:  python3-sphinx-latex
5cb8ef9
BuildRequires:  latexmk
5cb8ef9
%endif
5cb8ef9
5d179b6
BuildRequires:  make
5d179b6
BuildRequires:  gcc-c++
9991928
BuildRequires:  Cython
5d179b6
5d179b6
BuildRequires:  python3-igraph
5d179b6
BuildRequires:  numpy
5d179b6
BuildRequires:  python3-networkx
5d179b6
BuildRequires:  python3-basemap
5d179b6
BuildRequires:  python3-scipy
5d179b6
5d179b6
Requires:  matplotlib
5d179b6
5d179b6
%if %{with tests}
5d179b6
BuildRequires:  python3-pytest
9ae9ee4
BuildRequires:  python3-cartopy
5d179b6
%endif
5d179b6
5d179b6
%description %_description
5d179b6
5d179b6
%package -n     python3-%{pypi_name}
5d179b6
Summary:        %{summary}
5d179b6
5d179b6
%description -n python3-%{pypi_name} %_description
5d179b6
5cb8ef9
%package doc
5cb8ef9
Summary:        Documentation and examples for %{name}
5cb8ef9
5cb8ef9
%description doc
5cb8ef9
%{summary}.
5cb8ef9
5d179b6
%prep
9ae9ee4
%autosetup -p1 -n %{pypi_name}-%{commit}
5d179b6
for lib in $(find . -name "*.py"); do
5d179b6
 sed '1{\@^#!/usr/bin/python@d}' $lib > $lib.new &&
5d179b6
 touch -r $lib $lib.new &&
5d179b6
 mv $lib.new $lib
5d179b6
done
9ae9ee4
# Disable coverage and fix pytest command (has no option '-n')
9ae9ee4
sed -i -e 's/-n auto //' setup.cfg
5d179b6
5d179b6
%build
5d179b6
%py3_build
5d179b6
5cb8ef9
5d179b6
%install
5d179b6
%py3_install
5d179b6
9ae9ee4
# We run this in %%install, since Sphinx imports __version__ from pyunicorn.
9ae9ee4
# So, that needs to be installed first.
9ae9ee4
%if %{with doc_pdf}
9ae9ee4
%{py3_test_envvars} %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'
9ae9ee4
%{py3_test_envvars} %make_build -C docs/build/latex LATEXMKOPTS='-quiet'
9ae9ee4
%endif
9ae9ee4
9ae9ee4
5d179b6
%check
5d179b6
%if %{with tests}
9ae9ee4
%pytest
5d179b6
%endif
5d179b6
5d179b6
%files -n python3-%{pypi_name}
12781db
%doc README.rst examples/
5d179b6
%license LICENSE.txt
5d179b6
%{python3_sitearch}/%{pypi_name}
229e99d
%{python3_sitearch}/%{pypi_name}-%{upstream_version}-py%{python3_version}.egg-info
5d179b6
5cb8ef9
%files doc
5cb8ef9
%doc README.rst
5cb8ef9
%license LICENSE.txt
5cb8ef9
%if %{with doc_pdf}
07bc3fc
%doc docs/build/latex/%{pypi_name}.pdf
5cb8ef9
%endif
5cb8ef9
5d179b6
%changelog
25d883c
%autochangelog