Blob Blame History Raw
%bcond_without tests

# Sphinx-generated HTML documentation is not suitable for packaging; see
# for discussion.
# We can generate PDF documentation as a substitute.
%bcond_without doc_pdf

%global pypi_name meautility
%global pretty_name MEAutility

%global _description %{expand:
Python package for multi-electrode array (MEA) handling and stimulation.
Documentation is available at}

Name:           python-%{pypi_name}
Version:        1.5.1
Release:        %autorelease
Summary:        Package for multi-electrode array (MEA) handling and stimulation

License:        GPLv3
URL:  {pretty_name}/
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%description %_description

%package -n python3-%{pypi_name}
Summary:        %{summary}
BuildRequires:  python3-devel

%if %{with tests}
BuildRequires:  %{py3_dist pytest}

%description -n python3-%{pypi_name} %_description

%package        doc
Summary:        Documentation for %{pretty_name}

%if %{with doc_pdf}
BuildRequires:  make
BuildRequires:  %{py3_dist Sphinx}
BuildRequires:  python3-sphinx-latex
BuildRequires:  latexmk

%description doc %_description

%autosetup -n %{pretty_name}-%{version}



%if %{with doc_pdf}
PYTHONPATH="${PWD}:${PWD}/MEAutility" \
    %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'
%make_build -C docs/build/latex LATEXMKOPTS='-quiet'

%pyproject_save_files %{pretty_name}

%if %{with tests}

%files -n python3-%{pypi_name} -f %{pyproject_files}
%exclude %{python3_sitelib}/MEAutility/tests

%files doc
%license LICENSE
%doc notebooks
%if %{with doc_pdf}
%doc docs/build/latex/MEAutility.pdf