3c87f0a
# We shouldn’t *add* ExcludeArch in a stable release, so we must skip the tests
3c87f0a
# instead. We can remove this after F39 goes end-of-life, or when the spec
3c87f0a
# files for older branches diverge from those in F40+.
3c87f0a
%ifarch s390x
3c87f0a
%if 0%{?fc38} || 0%{?fc39}
3c87f0a
%global tests_default_off 1
3c87f0a
%endif
3c87f0a
%endif
3c87f0a
3c87f0a
%bcond tests 0%{?!tests_default_off:1}
a3db995
# Run examples as additional tests?
a3db995
%bcond test_examples 1
650aa40
8ef045b
# Sphinx-generated HTML documentation is not suitable for packaging; see
8ef045b
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
8ef045b
#
8ef045b
# We can generate PDF documentation as a substitute.
8ef045b
%bcond doc_pdf 1
8ef045b
650aa40
%global _description %{expand:
650aa40
The new python parameter exploration toolkit: pypet manages exploration of the
650aa40
parameter space of any numerical simulation in python, thereby storing your
650aa40
data into HDF5 files for you. Moreover, pypet offers a new data container which
650aa40
lets you access all your parameters and results from a single source. Data I/O
650aa40
of your simulations and analyses becomes a piece of cake!}
650aa40
f6c3622
Name:           python-pypet
7e06592
Version:        0.6.1
f466bb0
Release:        %autorelease
650aa40
Summary:        Parameter exploration toolbox
650aa40
caaf308
License:        BSD-3-Clause
e70457a
URL:            https://github.com/SmokinCaterpillar/pypet
e70457a
Source:         %{url}/archive/%{version}/pypet-%{version}.tar.gz
650aa40
4a38921
# Replace ConfigParser.readfp() with ConfigParser.read_file()
4a38921
# https://github.com/SmokinCaterpillar/pypet/pull/69
4a38921
Patch:          %{url}/pull/69.patch
4a38921
37b0635
# Replace deprecated/removed unittest.TestCase method aliases
37b0635
# https://github.com/SmokinCaterpillar/pypet/pull/70
37b0635
Patch:          %{url}/pull/70.patch
37b0635
a3db995
# In examples, don’t pass keywords to Figure.gca()
a3db995
# https://github.com/SmokinCaterpillar/pypet/pull/71
a3db995
Patch:          %{url}/pull/71.patch
a3db995
92d7dfe
# We have an arched base package and noarch binary RPMs to ensure that the
92d7dfe
# tests always run on all architectures, since this package has a history of
92d7dfe
# architecture-dependent failures. However, there is no compiled code in the
92d7dfe
# package.
92d7dfe
%global debug_package %{nil}
3c87f0a
# ==== Exclude i686 ====
3c87f0a
#
61bec3b
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
61bec3b
#
61bec3b
# Also, mandatory dependency python-tables dropped i686 support in F39 because
61bec3b
# python-blosc2 does not support it:
61bec3b
# https://src.fedoraproject.org/rpms/python-tables/c/ee27ac0dd4352ee415ad5089aee76c50f4bd2028
3c87f0a
#
3c87f0a
# ==== Exclude s390x ====
3c87f0a
#
3c87f0a
# Many python-pypet tests fail on s390x due to apparent endian issues in
3c87f0a
# pandas.HDFStore
3c87f0a
# https://bugzilla.redhat.com/show_bug.cgi?id=2244500
61bec3b
ExcludeArch:    %{ix86}
3c87f0a
# We shouldn’t *add* ExcludeArch in a stable release. We can remove the
3c87f0a
# conditional after F39 goes end-of-life, or when the spec files for older
3c87f0a
# branches diverge from those in F40+.
3c87f0a
%if !0%{?fc38} && !0%{?fc39}
3c87f0a
ExcludeArch:    s390x
61bec3b
%endif
650aa40
650aa40
%description %_description
650aa40
f6c3622
%package -n python3-pypet
650aa40
Summary:        %{summary}
92d7dfe
92d7dfe
BuildArch:      noarch
92d7dfe
650aa40
BuildRequires:  python3-devel
5b478e8
60a8fb9
# The setup.py file has an optional dependency on m2r; if present, the long
60a8fb9
# description is loaded from README.md. Since this isn’t the case for the
60a8fb9
# actual wheel on PyPI, we omit the m2r dependency for consistency.
60a8fb9
35a15bf
# Needed to “smoke test” importing pypet.brian2 and for many tests and
35a15bf
# examples. Not a hard runtime dependency.
650aa40
BuildRequires:  %{py3_dist brian2}
35a15bf
35a15bf
%if %{with tests}
650aa40
BuildRequires:  hdf5
35a15bf
# Needed in several examples.
35a15bf
BuildRequires:  %{py3_dist deap}
35a15bf
# Needed in several tests and examples
650aa40
BuildRequires:  %{py3_dist matplotlib}
650aa40
%endif
650aa40
8ef045b
%if %{with doc_pdf}
8ef045b
BuildRequires:  make
8ef045b
BuildRequires:  python3dist(sphinx)
650aa40
BuildRequires:  %{py3_dist sphinx}
8ef045b
BuildRequires:  python3-sphinx-latex
8ef045b
BuildRequires:  latexmk
8ef045b
%endif
650aa40
f6c3622
%description -n python3-pypet %_description
650aa40
650aa40
%package doc
650aa40
Summary:        %{summary}
650aa40
92d7dfe
BuildArch:      noarch
92d7dfe
650aa40
%description doc
650aa40
Documentation for %{name}.
650aa40
650aa40
%prep
c3526e4
%autosetup -n pypet-%{version} -p1
f6c3622
rm -rf pypet.egg-info
8805a05
find . -type f -name .gitignore -print -delete
a3db995
# If we run the examples as tests, it will spew output into the examples/ tree.
a3db995
# Not only do we not want to package that output, but it is non-reproducible,
a3db995
# which causes build failures when the noarch -doc subpackage has different
a3db995
# contents on different architectures. To work around that, we have two
a3db995
# options: manually install all documentation in %%build and list it with
a3db995
# absolute paths in the appropriate %%files section, or install the examples
a3db995
# via a relative path referencing a clean copy. That’s the simpler options, so
a3db995
# here’s the clean copy:
a3db995
mkdir -p _clean
a3db995
cp -rp examples _clean/examples
650aa40
35a15bf
%generate_buildrequires
35a15bf
%pyproject_buildrequires
35a15bf
650aa40
%build
35a15bf
%pyproject_wheel
650aa40
8ef045b
%if %{with doc_pdf}
8ef045b
PYTHONPATH="${PWD}" %make_build -C doc latex \
8ef045b
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
8ef045b
%make_build -C doc/build/latex LATEXMKOPTS='-quiet'
8ef045b
%endif
650aa40
650aa40
%install
35a15bf
%pyproject_install
35a15bf
%pyproject_save_files pypet
650aa40
650aa40
%check
35a15bf
%pyproject_check_import -e '*tests*'
650aa40
# https://github.com/SmokinCaterpillar/pypet/blob/develop/ciscripts/travis/runtests.sh
650aa40
# Scoop is unmaintained. I've asked upstream to drop support for it:
650aa40
# https://github.com/SmokinCaterpillar/pypet/issues/56
650aa40
%if %{with tests}
f8c81d8
%{py3_test_envvars} %{python3} pypet/tests/all_tests.py
a3db995
%if %{with test_examples}
a3db995
pushd pypet/tests
a3db995
%{py3_test_envvars} %{python3} all_examples.py
a3db995
popd
a3db995
%endif
650aa40
%endif
650aa40
35a15bf
%files -n python3-pypet -f %{pyproject_files}
650aa40
%doc README.md
650aa40
650aa40
%files doc
70db7ac
%license LICENSE
70db7ac
%doc CHANGES.txt
a3db995
%doc _clean/examples/
8ef045b
%if %{with doc_pdf}
8ef045b
%doc doc/build/latex/pypet.pdf
8ef045b
%endif
650aa40
650aa40
%changelog
f466bb0
%autochangelog