| |
@@ -1,12 +1,34 @@
|
| |
+ %if 0%{?rhel} && 0%{?rhel} >= 8
|
| |
+ # disable python2 by default
|
| |
+ %bcond_with python2
|
| |
+ %else
|
| |
+ # enable python2 by default
|
| |
+ %bcond_without python2
|
| |
+ %endif
|
| |
+
|
| |
%if 0%{?fedora} || 0%{?rhel} >= 8
|
| |
- %global with_python3 1
|
| |
+ # enable python3 by default
|
| |
+ %bcond_without python3
|
| |
+ %else
|
| |
+ # disable python3 by default
|
| |
+ %bcond_with python3
|
| |
+ %endif
|
| |
+
|
| |
+ %if %{with python3} && ( 0%{?fedora} >= 31 || %{without python2} )
|
| |
+ # link /usr/bin/alembic to /usr/bin/alembic-3
|
| |
+ # (https://fedoraproject.org/wiki/Changes/Python_means_Python3)
|
| |
+ %global python_version 3
|
| |
+ %else
|
| |
+ # link /usr/bin/alembic to /usr/bin/alembic-2
|
| |
+ %global python_version 2
|
| |
%endif
|
| |
|
| |
+
|
| |
%global modname alembic
|
| |
|
| |
Name: python-alembic
|
| |
Version: 1.0.11
|
| |
- Release: 1%{?dist}
|
| |
+ Release: 2%{?dist}
|
| |
Summary: Database migration tool for SQLAlchemy
|
| |
|
| |
License: MIT
|
| |
@@ -16,6 +38,8 @@
|
| |
BuildArch: noarch
|
| |
|
| |
BuildRequires: help2man
|
| |
+
|
| |
+ %if %{with python2}
|
| |
BuildRequires: python2-devel
|
| |
BuildRequires: python2-mako
|
| |
BuildRequires: python2-setuptools
|
| |
@@ -37,8 +61,9 @@
|
| |
# Just for the tests
|
| |
BuildRequires: python2-psycopg2
|
| |
BuildRequires: python2-mysql
|
| |
+ %endif
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
BuildRequires: python3-devel
|
| |
BuildRequires: python2-tools
|
| |
BuildRequires: python3-sqlalchemy >= 0.7.4
|
| |
@@ -68,6 +93,7 @@
|
| |
|
| |
%description %_description
|
| |
|
| |
+ %if %{with python2}
|
| |
%package -n python2-alembic
|
| |
Summary: %summary
|
| |
|
| |
@@ -86,8 +112,9 @@
|
| |
%{?python_provide:%python_provide python2-alembic}
|
| |
|
| |
%description -n python2-alembic %_description
|
| |
+ %endif
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
%package -n python3-alembic
|
| |
Summary: %summary
|
| |
|
| |
@@ -98,13 +125,18 @@
|
| |
Requires: python3-dateutil
|
| |
%{?python_provide:%python_provide python3-alembic}
|
| |
|
| |
+ %if %{python_version} == 3
|
| |
+ # /usr/bin/alembic moved from the python2 package to the python3 one
|
| |
+ Conflicts: python2-alembic < 1.0.11-2
|
| |
+ %endif
|
| |
+
|
| |
%description -n python3-alembic %_description
|
| |
%endif
|
| |
|
| |
%prep
|
| |
%autosetup -p1 -n %{modname}-%{version}
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
rm -rf %{py3dir}
|
| |
cp -a . %{py3dir}
|
| |
%endif
|
| |
@@ -116,14 +148,17 @@
|
| |
%endif
|
| |
|
| |
%build
|
| |
+ %if %{with python2}
|
| |
%{__python2} setup.py build
|
| |
+ %endif
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
pushd %{py3dir}
|
| |
%{__python3} setup.py build
|
| |
popd
|
| |
%endif
|
| |
|
| |
+ %if %{with python2}
|
| |
# Hack around setuptools so we can get access to help strings for help2man
|
| |
# Credit for this goes to Toshio Kuratomi
|
| |
%if 0%{?rhel} && 0%{?rhel} <= 6
|
| |
@@ -134,8 +169,9 @@
|
| |
help2man --version-string %{version} --no-info -s 1 bin/alembic > python2-alembic.1
|
| |
mv bin/alembic bin/python2-alembic
|
| |
%endif
|
| |
+ %endif
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
pushd %{py3dir}
|
| |
%{__mkdir_p} bin
|
| |
echo 'python3 -c "import alembic.config; alembic.config.main()" $*' > bin/alembic
|
| |
@@ -149,22 +185,26 @@
|
| |
|
| |
install -d -m 0755 %{buildroot}%{_mandir}/man1
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
pushd %{py3dir}
|
| |
%{__python3} setup.py install --skip-build --root=%{buildroot}
|
| |
mv %{buildroot}/%{_bindir}/%{modname} %{buildroot}/%{_bindir}/%{modname}-3
|
| |
- ln -s %{_bindir}/%{modname}-3 %{buildroot}/%{_bindir}/%{modname}-%{python3_version}
|
| |
+ ln -s %{modname}-3 %{buildroot}/%{_bindir}/%{modname}-%{python3_version}
|
| |
install -m 0644 alembic.1 %{buildroot}%{_mandir}/man1/alembic-3.1
|
| |
- ln -s %{_mandir}/man1/alembic-3.1 %{buildroot}%{_mandir}/man1/alembic-%{python3_version}.1
|
| |
+ ln -s alembic-3.1 %{buildroot}%{_mandir}/man1/alembic-%{python3_version}.1
|
| |
popd
|
| |
%endif
|
| |
|
| |
+ %if %{with python2}
|
| |
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
|
| |
- ln -s %{_bindir}/%{modname} %{buildroot}/%{_bindir}/%{modname}-2
|
| |
- ln -s %{_bindir}/%{modname} %{buildroot}/%{_bindir}/%{modname}-%{python2_version}
|
| |
- install -m 0644 python2-alembic.1 %{buildroot}%{_mandir}/man1/alembic.1
|
| |
- ln -s %{_mandir}/man1/alembic.1 %{buildroot}%{_mandir}/man1/alembic-2.1
|
| |
- ln -s %{_mandir}/man1/alembic.1 %{buildroot}%{_mandir}/man1/alembic-%{python2_version}.1
|
| |
+ mv %{buildroot}/%{_bindir}/%{modname} %{buildroot}/%{_bindir}/%{modname}-2
|
| |
+ ln -s %{modname}-2 %{buildroot}/%{_bindir}/%{modname}-%{python2_version}
|
| |
+ install -m 0644 python2-alembic.1 %{buildroot}%{_mandir}/man1/alembic-2.1
|
| |
+ ln -s alembic-2.1 %{buildroot}%{_mandir}/man1/alembic-%{python2_version}.1
|
| |
+ %endif
|
| |
+
|
| |
+ ln -s %{modname}-%{python_version} %{buildroot}/%{_bindir}/%{modname}
|
| |
+ ln -s alembic-%{python_version}.1 %{buildroot}%{_mandir}/man1/alembic.1
|
| |
|
| |
%if 0%{?rhel} && 0%{?rhel} <= 6
|
| |
# Modify /usr/bin/alembic to require SQLAlchemy>=0.6
|
| |
@@ -177,35 +217,47 @@
|
| |
%endif
|
| |
|
| |
%check
|
| |
+ %if %{with python2}
|
| |
%{__python2} setup.py test
|
| |
+ %endif
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
pushd %{py3dir}
|
| |
%{__python3} setup.py test
|
| |
popd
|
| |
%endif
|
| |
|
| |
|
| |
+ %if %{with python2}
|
| |
%files -n python2-alembic
|
| |
%doc README.rst LICENSE CHANGES docs
|
| |
%{python2_sitelib}/%{modname}/
|
| |
%{python2_sitelib}/%{modname}-%{version}*
|
| |
+ %if %{python_version} == 2
|
| |
%{_bindir}/%{modname}
|
| |
+ %endif
|
| |
%{_bindir}/%{modname}-2
|
| |
%{_bindir}/%{modname}-%{python2_version}
|
| |
|
| |
%if 0%{?rhel} && 0%{?rhel} <= 6
|
| |
%else
|
| |
+ %if %{python_version} == 2
|
| |
%{_mandir}/man1/alembic.1*
|
| |
+ %endif
|
| |
%{_mandir}/man1/alembic-2.1*
|
| |
%{_mandir}/man1/alembic-%{python2_version}.1*
|
| |
%endif
|
| |
+ %endif
|
| |
|
| |
- %if 0%{?with_python3}
|
| |
+ %if %{with python3}
|
| |
%files -n python3-%{modname}
|
| |
%doc LICENSE README.rst CHANGES docs
|
| |
%{python3_sitelib}/%{modname}/
|
| |
%{python3_sitelib}/%{modname}-%{version}-*
|
| |
+ %if %{python_version} == 3
|
| |
+ %{_bindir}/%{modname}
|
| |
+ %{_mandir}/man1/alembic.1*
|
| |
+ %endif
|
| |
%{_bindir}/%{modname}-3
|
| |
%{_bindir}/%{modname}-%{python3_version}
|
| |
%{_mandir}/man1/alembic-3.1*
|
| |
@@ -214,9 +266,19 @@
|
| |
|
| |
|
| |
%changelog
|
| |
+ * Mon Jul 22 2019 Petr Viktorin <pviktori@redhat.com> - 1.0.11-2
|
| |
+ - Make /usr/bin/alembic point to alembic-3 on Fedora 31+
|
| |
+ See https://fedoraproject.org/wiki/Changes/Python_means_Python3
|
| |
+ - Avoid absolute symlinks
|
| |
+ - Conditionalize the Python 2/Python 3 parts with bcond
|
| |
+
|
| |
* Sun Jun 30 2019 Kevin Fenzi <kevin@scrye.com> - 1.0.11-1
|
| |
- Update to 1.0.11. Fixes bug #1723981
|
| |
|
| |
+ * Wed Jun 19 2019 Troy Dawson <tdawson@redhat.com> - 1.0.10-1.1
|
| |
+ - Make python2 optional
|
| |
+ - Do not build python2 on RHEL8
|
| |
+
|
| |
* Wed Jun 05 2019 Randy Barlow <bowlofeggs@fedoraproject.org> - 1.0.10-1
|
| |
- Update to 1.0.10 (#1700050).
|
| |
- https://alembic.sqlalchemy.org/en/latest/changelog.html#change-1.0.10
|
| |
epel8
branch/usr/bin/alembic
point toalembic-3
on Fedora 31+, or if building without python2 (See https://fedoraproject.org/wiki/Changes/Python_means_Python3). Same for the unversioned man page.