Blob Blame History Raw
# Multiple tests currently failing.
# Temporarily disabling tests
# https://github.com/SmokinCaterpillar/pypet/issues/63
%bcond tests 0

# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond doc_pdf 1

%global _description %{expand:
The new python parameter exploration toolkit: pypet manages exploration of the
parameter space of any numerical simulation in python, thereby storing your
data into HDF5 files for you. Moreover, pypet offers a new data container which
lets you access all your parameters and results from a single source. Data I/O
of your simulations and analyses becomes a piece of cake!}

Name:           python-pypet
Version:        0.5.2
Release:        %autorelease
Summary:        Parameter exploration toolbox

# The entire source is BSD-3-Clause, except:
#
# CC0-1.0:
#    - ciscripts/appveyor/install.ps1
#
# While the CI script is clearly code, and CC0-1.0 is allowed only for content
# in Fedora, the file is covered by the exception for pre-existing code files
# in
# https://gitlab.com/fedora/legal/fedora-license-data/-/issues/91#note_1151947383.
# Furthermore, we remove the file in %%prep to show that it does not contribute
# to the license of the binary RPMs.
License:        BSD-3-Clause
URL:            https://github.com/SmokinCaterpillar/pypet
Source:         %{url}/archive/%{version}/pypet-%{version}.tar.gz

# We have an arched base package and noarch binary RPMs to ensure that the
# tests always run on all architectures, since this package has a history of
# architecture-dependent failures. However, there is no compiled code in the
# package.
%global debug_package %{nil}

%description %_description

%package -n python3-pypet
Summary:        %{summary}

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  %{py3_dist setuptools}

# The setup.py file has an optional dependency on m2r; if present, the long
# description is loaded from README.md. Since this isn’t the case for the
# actual wheel on PyPI, we omit the m2r dependency for consistency.

%if %{with tests}
BuildRequires:  %{py3_dist brian2}
BuildRequires:  %{py3_dist deap}
BuildRequires:  hdf5
BuildRequires:  %{py3_dist matplotlib}
BuildRequires:  %{py3_dist numpy}
BuildRequires:  %{py3_dist pandas}
BuildRequires:  %{py3_dist scipy}
BuildRequires:  %{py3_dist tables}
%endif

%if %{with doc_pdf}
BuildRequires:  make
BuildRequires:  python3dist(sphinx)
BuildRequires:  %{py3_dist sphinx}
BuildRequires:  python3-sphinx-latex
BuildRequires:  latexmk
%endif

%description -n python3-pypet %_description

%package doc
Summary:        %{summary}

BuildArch:      noarch

%description doc
Documentation for %{name}.

%prep
%autosetup -n pypet-%{version}
rm -rf pypet.egg-info
find . -type f -name .gitignore -print -delete
# This file is CC0-1.0. Remove it to show it doesn’t contribute to the build.
rm -v ciscripts/appveyor/install.ps1

%build
%py3_build

%if %{with doc_pdf}
PYTHONPATH="${PWD}" %make_build -C doc latex \
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
%make_build -C doc/build/latex LATEXMKOPTS='-quiet'
%endif

%install
%py3_install

%check
# https://github.com/SmokinCaterpillar/pypet/blob/develop/ciscripts/travis/runtests.sh
# Scoop is unmaintained. I've asked upstream to drop support for it:
# https://github.com/SmokinCaterpillar/pypet/issues/56
%if %{with tests}
export HDF5_DISABLE_VERSION_CHECK=1
%ifarch s390x
# Memory issues on s390x: OverflowError: Python int too large to convert to C int
echo "Skip tests on s390x"
%else
%{py3_test_envvars} %{python3} pypet/tests/all_single_core_tests.py
%endif
%endif

%files -n python3-pypet
%license LICENSE
%doc README.md
%{python3_sitelib}/pypet-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/pypet

%files doc
%license LICENSE CHANGES.txt
%doc examples/
%if %{with doc_pdf}
%doc doc/build/latex/pypet.pdf
%endif

%changelog
%autochangelog