dc8f213
Name:             python-alembic
67eaa37
Version:          1.13.1
efbde4a
Release:          %autorelease
dc8f213
Summary:          Database migration tool for SQLAlchemy
dc8f213
8143bff
# SPDX
dc8f213
License:          MIT
9e1dd60
URL:              https://pypi.io/project/alembic
923682e
Source0:          %{pypi_source alembic}
896b32f
dc8f213
BuildArch:        noarch
dc8f213
dc8f213
BuildRequires:    help2man
ff2ff58
dc8f213
BuildRequires:    python3-devel
85eb2d0
BuildRequires:    python3-pytest
85eb2d0
%if %{undefined rhel}
85eb2d0
BuildRequires:    python3-pytest-xdist
85eb2d0
%endif
dc8f213
923682e
%global _description %{expand:
12b434c
Alembic is a database migrations tool written by the author of SQLAlchemy. A
12b434c
migrations tool offers the following functionality:
923682e
12b434c
• Can emit ALTER statements to a database in order to change the structure of
12b434c
  tables and other constructs
12b434c
• Provides a system whereby "migration scripts" may be constructed; each script
923682e
  indicates a particular series of steps that can "upgrade" a target database
923682e
  to a new version, and optionally a series of steps that can "downgrade"
923682e
  similarly, doing the same steps in reverse.
12b434c
• Allows the scripts to execute in some sequential manner.
923682e
12b434c
Documentation and status of Alembic is at https://alembic.sqlalchemy.org/}
dc8f213
cd6b849
%description %_description
dc8f213
cd6b849
dc8f213
%package -n python3-alembic
cd6b849
Summary:          %summary
dc8f213
cd6b849
%description -n python3-alembic %_description
dc8f213
f6c7f97
0afd0f2
%pyproject_extras_subpkg -n python3-alembic tz
f6c7f97
f6c7f97
dc8f213
%prep
75a63cc
%autosetup -p1 -n alembic-%{version}
40a965e
# HTML documentation has bundled and pre-compiled/pre-minified JavaScript; see
40a965e
# https://docs.fedoraproject.org/en-US/packaging-guidelines/JavaScript/.
40a965e
rm -rvf docs/_static
0afd0f2
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
0afd0f2
sed -r -i 's/^([[:blank:]]*(black|zimports))\b/# &/' tox.ini
64b0c65
# Don't treat DeprecationWarnings as errros in tests
64b0c65
sed -i '/"error", category=DeprecationWarning/d' alembic/testing/warnings.py
0afd0f2
0afd0f2
0afd0f2
%generate_buildrequires
85eb2d0
%pyproject_buildrequires -x tz
dc8f213
dc8f213
dc8f213
%build
0afd0f2
%pyproject_wheel
dc8f213
923682e
mkdir -p bin
923682e
echo '%{python3} -c "import alembic.config; alembic.config.main()" $*' > bin/alembic
24a7c65
chmod 0755 bin/alembic
24a7c65
help2man --version-string %{version} --no-info -s 1 bin/alembic > alembic.1
dc8f213
dc8f213
dc8f213
%install
dc8f213
install -d -m 0755 %{buildroot}%{_mandir}/man1
24a7c65
0afd0f2
%pyproject_install
0afd0f2
%pyproject_save_files alembic
75a63cc
mv %{buildroot}/%{_bindir}/alembic %{buildroot}/%{_bindir}/alembic-3
75a63cc
ln -s alembic-3 %{buildroot}/%{_bindir}/alembic-%{python3_version}
392dc63
install -m 0644 alembic.1 %{buildroot}%{_mandir}/man1/alembic-3.1
941b664
ln -s alembic-3.1 %{buildroot}%{_mandir}/man1/alembic-%{python3_version}.1
392dc63
75a63cc
ln -s alembic-%{python3_version} %{buildroot}/%{_bindir}/alembic
f7f8044
ln -s alembic-%{python3_version}.1 %{buildroot}%{_mandir}/man1/alembic.1
941b664
dc8f213
24a7c65
%check
85eb2d0
%pytest %{?!rhel:-n auto}
dc8f213
dc8f213
75a63cc
%files -n python3-alembic -f %{pyproject_files}
0afd0f2
# pyproject_files handles LICENSE; verify with rpm -qL -p ...
0afd0f2
%doc README.rst CHANGES
75a63cc
%{_bindir}/alembic
6cbe80c
%{_mandir}/man1/alembic.1{,.*}
75a63cc
%{_bindir}/alembic-3
6cbe80c
%{_mandir}/man1/alembic-3.1{,.*}
75a63cc
%{_bindir}/alembic-%{python3_version}
6cbe80c
%{_mandir}/man1/alembic-%{python3_version}.1{,.*}
dc8f213
dc8f213
dc8f213
%changelog
efbde4a
%autochangelog