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

Name:               python-flask-migrate
Version:            4.0.4
Release:            %autorelease
Summary:            SQLAlchemy database migrations for Flask applications using Alembic

License:            MIT
Source0:            %{url}/archive/v%{version}/Flask-Migrate-%{version}.tar.gz
BuildArch:          noarch

BuildRequires:      python3-devel

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

# Tests
# We do not use %%pyproject_buildrequires -t and %%tox because tox.ini
# explicitly runs “pip install.”
BuildRequires:      python3dist(pytest)

%global common_description %{expand:
SQLAlchemy database migrations for Flask applications using Alembic.}

%description %{common_description}

%package -n python3-flask-migrate
Summary:            %{summary}

%description -n python3-flask-migrate %{common_description}

%package doc
Summary:            Documentation for Flask-Migrate

%description doc
Documentation for Flask-Migrate.

%autosetup -n Flask-Migrate-%{version}
# Fix shebangs that use /bin/env and unversioned Python
%py3_shebang_fix tests/ tests/


%if %{with doc_pdf}
%make_build -C docs latex SPHINXOPTS='-j%{?_smp_build_ncpus}'
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'

%pyproject_save_files flask_migrate

# See tox.ini:
%pytest -p no:logging

%files -n python3-flask-migrate -f %{pyproject_files}

%files doc
%license LICENSE
%if %{with doc_pdf}
%doc docs/_build/latex/Flask-Migrate.pdf