582595e
%if 0%{?rhel} && 0%{?rhel} <= 6
582595e
%{!?__python2:        %global __python2 /usr/bin/python2}
582595e
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
582595e
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
582595e
%endif
582595e
582595e
%if 0%{?fedora}
dc8f213
%global with_python3 1
dc8f213
%endif
dc8f213
dc8f213
%global modname alembic
dc8f213
dc8f213
Name:             python-alembic
e2b1806
Version:          0.9.7
392dc63
Release:          3%{?dist}
dc8f213
Summary:          Database migration tool for SQLAlchemy
dc8f213
dc8f213
Group:            Development/Libraries
dc8f213
License:          MIT
9e1dd60
URL:              https://pypi.io/project/alembic
9e1dd60
Source0:          https://pypi.io/packages/source/a/%{modname}/%{modname}-%{version}.tar.gz
dc8f213
dc8f213
BuildArch:        noarch
dc8f213
dc8f213
dc8f213
BuildRequires:    help2man
dc8f213
BuildRequires:    python2-devel
dc8f213
BuildRequires:    python-mako
e160057
BuildRequires:    python-setuptools
c146b27
BuildRequires:    python-mock
e2b1806
BuildRequires:    python-dateutil
24a7c65
BuildRequires:    python-editor
24a7c65
BuildRequires:    python2-pytest
dc8f213
dc8f213
# See if we're building for python earlier than 2.7
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
3e18ecd
BuildRequires:    python-sqlalchemy0.7 >= 0.7.4
dc8f213
BuildRequires:    python-argparse
dc8f213
BuildRequires:    python-nose1.1
dc8f213
%else
dc8f213
BuildRequires:    python-nose
3e18ecd
BuildRequires:    python-sqlalchemy >= 0.7.4
dc8f213
%endif
dc8f213
8b3ce78
# Just for the tests
8b3ce78
BuildRequires:    python-psycopg2
8b3ce78
BuildRequires:    MySQL-python
8b3ce78
dc8f213
%if 0%{?with_python3}
dc8f213
BuildRequires:    python3-devel
dc8f213
BuildRequires:    python-tools
3e18ecd
BuildRequires:    python3-sqlalchemy >= 0.7.4
dc8f213
BuildRequires:    python3-mako
dc8f213
BuildRequires:    python3-nose
e160057
BuildRequires:    python3-setuptools
c146b27
BuildRequires:    python3-mock
e2b1806
BuildRequires:    python3-dateutil
24a7c65
BuildRequires:    python3-editor
24a7c65
BuildRequires:    python3-pytest
dc8f213
%endif
dc8f213
dc8f213
cd6b849
%global _description\
cd6b849
Alembic is a new database migrations tool, written by the author of\
cd6b849
SQLAlchemy.  A migrations tool offers the following functionality:\
cd6b849
\
cd6b849
* Can emit ALTER statements to a database in order to change the structure\
cd6b849
  of tables and other constructs.\
cd6b849
* Provides a system whereby "migration scripts" may be constructed; each script\
cd6b849
  indicates a particular series of steps that can "upgrade" a target database\
cd6b849
  to a new version, and optionally a series of steps that can "downgrade"\
cd6b849
  similarly, doing the same steps in reverse.\
cd6b849
* Allows the scripts to execute in some sequential manner.\
cd6b849
\
cd6b849
Documentation and status of Alembic is at http://readthedocs.org/docs/alembic/
dc8f213
cd6b849
%description %_description
dc8f213
cd6b849
%package -n python2-alembic
cd6b849
Summary:          %summary
cd6b849
cd6b849
# See if we're building for python earlier than 2.7
cd6b849
%if 0%{?rhel} && 0%{?rhel} <= 6
cd6b849
Requires:         python-sqlalchemy0.7 >= 0.7.4
cd6b849
Requires:         python-argparse
cd6b849
%else
cd6b849
Requires:         python-sqlalchemy >= 0.7.4
cd6b849
%endif
cd6b849
cd6b849
Requires:         python-editor
e2b1806
Requires:         python-dateutil
cd6b849
Requires:         python-setuptools
cd6b849
Requires:         python-mako
cd6b849
%{?python_provide:%python_provide python2-alembic}
cd6b849
cd6b849
%description -n python2-alembic %_description
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
%package -n python3-alembic
cd6b849
Summary:          %summary
dc8f213
3e18ecd
Requires:         python3-sqlalchemy >= 0.7.4
dc8f213
Requires:         python3-mako
e160057
Requires:         python3-setuptools
214ae92
Requires:         python3-editor
e2b1806
Requires:         python3-dateutil
cd6b849
%{?python_provide:%python_provide python3-alembic}
dc8f213
cd6b849
%description -n python3-alembic %_description
dc8f213
%endif
dc8f213
dc8f213
%prep
dc8f213
%setup -q -n %{modname}-%{version}
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
rm -rf %{py3dir}
dc8f213
cp -a . %{py3dir}
dc8f213
%endif
dc8f213
dc8f213
# Make sure that epel/rhel picks up the correct version of sqlalchemy
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
dc8f213
awk 'NR==1{print "import __main__; __main__.__requires__ = __requires__ = [\"sqlalchemy>=0.6\", \"nose>=0.11\"]; import pkg_resources"}1' setup.py > setup.py.tmp
dc8f213
mv setup.py.tmp setup.py
dc8f213
%endif
dc8f213
dc8f213
%build
582595e
%{__python2} setup.py build
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
pushd %{py3dir}
dc8f213
%{__python3} setup.py build
dc8f213
popd
dc8f213
%endif
dc8f213
dc8f213
# Hack around setuptools so we can get access to help strings for help2man
e2b1806
# Credit for this goes to Toshio Kuratomi
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
b9bfc9a
%else
dc8f213
%{__mkdir_p} bin
392dc63
echo 'python2 -c "import alembic.config; alembic.config.main()" $*' > bin/alembic
392dc63
chmod 0755 bin/alembic
392dc63
help2man --version-string %{version} --no-info -s 1 bin/alembic > python2-alembic.1
392dc63
mv bin/alembic bin/python2-alembic
c146b27
%endif
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
pushd %{py3dir}
dc8f213
%{__mkdir_p} bin
24a7c65
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
popd
dc8f213
%endif
dc8f213
dc8f213
dc8f213
%install
24a7c65
dc8f213
install -d -m 0755 %{buildroot}%{_mandir}/man1
24a7c65
dc8f213
%if 0%{?with_python3}
dc8f213
pushd %{py3dir}
befdccf
%{__python3} setup.py install --skip-build --root=%{buildroot}
392dc63
mv %{buildroot}/%{_bindir}/%{modname} %{buildroot}/%{_bindir}/%{modname}-3
392dc63
ln -s %{_bindir}/%{modname}-3 %{buildroot}/%{_bindir}/%{modname}-%{python3_version}
392dc63
install -m 0644 alembic.1 %{buildroot}%{_mandir}/man1/alembic-3.1
392dc63
ln -s %{_mandir}/man1/alembic-3.1 %{buildroot}%{_mandir}/man1/alembic-%{python3_version}.1
dc8f213
popd
dc8f213
%endif
dc8f213
392dc63
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
392dc63
ln -s %{_bindir}/%{modname} %{buildroot}/%{_bindir}/%{modname}-2
392dc63
ln -s %{_bindir}/%{modname} %{buildroot}/%{_bindir}/%{modname}-%{python2_version}
392dc63
install -m 0644 python2-alembic.1 %{buildroot}%{_mandir}/man1/alembic.1
392dc63
ln -s %{_mandir}/man1/alembic.1 %{buildroot}%{_mandir}/man1/alembic-2.1
392dc63
ln -s %{_mandir}/man1/alembic.1 %{buildroot}%{_mandir}/man1/alembic-%{python2_version}.1
392dc63
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
befdccf
# Modify /usr/bin/alembic to require SQLAlchemy>=0.6
befdccf
# Hacky but setuptools only creates this file after setup.py install is run :-(
befdccf
# Root cause is that setuptools doesn't recurse the requirements when it processes
befdccf
# the __requires__.  It waits until pkg_resources.require('MODULE') is called.
befdccf
# Since that isn't done in the entrypoints script, we need to specify the dependency
befdccf
# on a specific SQLAlchemy version explicitly.
24a7c65
sed -i -e "s|__requires__ = 'alembic==0.4.2'|__requires__ = ['alembic==0.4.2', 'SQLAlchemy>=0.6']|" %{buildroot}%{_bindir}/python2-%{modname}
a43a9a2
%endif
dc8f213
24a7c65
%check
24a7c65
%{__python2} setup.py test
24a7c65
24a7c65
%if 0%{?with_python3}
24a7c65
pushd %{py3dir}
24a7c65
%{__python3} setup.py test
24a7c65
popd
24a7c65
%endif
dc8f213
dc8f213
cd6b849
%files -n python2-alembic
dc8f213
%doc README.rst LICENSE CHANGES docs
582595e
%{python2_sitelib}/%{modname}/
582595e
%{python2_sitelib}/%{modname}-%{version}*
392dc63
%{_bindir}/%{modname}
392dc63
%{_bindir}/%{modname}-2
392dc63
%{_bindir}/%{modname}-%{python2_version}
b9bfc9a
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
b9bfc9a
%else
392dc63
%{_mandir}/man1/alembic.1*
392dc63
%{_mandir}/man1/alembic-2.1*
392dc63
%{_mandir}/man1/alembic-%{python2_version}.1*
b9bfc9a
%endif
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
%files -n python3-%{modname}
dc8f213
%doc LICENSE README.rst CHANGES docs
dc8f213
%{python3_sitelib}/%{modname}/
dc8f213
%{python3_sitelib}/%{modname}-%{version}-*
392dc63
%{_bindir}/%{modname}-3
392dc63
%{_bindir}/%{modname}-%{python3_version}
392dc63
%{_mandir}/man1/alembic-3.1*
392dc63
%{_mandir}/man1/alembic-%{python3_version}.1*
dc8f213
%endif
dc8f213
dc8f213
dc8f213
%changelog
392dc63
* Thu Feb 08 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 0.9.7-3
392dc63
- The python3-alembic package now provides only alembic-3 and alembic-3.y.
392dc63
- The python2-alembic package now provides alembic, alembic-2, and alembic-2.y.
392dc63
24a7c65
* Sat Jan 27 2018 Ralph Bean <rbean@redhat.com> - 0.9.7-2
24a7c65
- The python3-alembic package now provides the alembic executable.
24a7c65
e2b1806
* Thu Jan 18 2018 Ralph Bean <rbean@redhat.com> - 0.9.7-1
e2b1806
- new version
e2b1806
- New dependency on python-dateutil.
e2b1806
cd6b849
* Tue Aug 08 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.9.1-3
cd6b849
- Python 2 binary package renamed to python2-alembic
cd6b849
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
cd6b849
593ca4a
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.1-2
593ca4a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
593ca4a
616d3af
* Thu Mar 02 2017 Ralph Bean <rbean@redhat.com> - 0.9.1-1
616d3af
- new version
616d3af
46a5fb3
* Wed Mar 01 2017 Ralph Bean <rbean@redhat.com> - 0.9.0-1
46a5fb3
- new version
46a5fb3
fee3c98
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.10-2
fee3c98
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
fee3c98
6335dc3
* Tue Jan 17 2017 Ralph Bean <rbean@redhat.com> - 0.8.10-1
6335dc3
- new version
6335dc3
78f3e7c
* Tue Dec 27 2016 Kevin Fenzi <kevin@scrye.com> - 0.8.9-1
78f3e7c
- Update to 0.8.9. Fixes bug #1400111
78f3e7c
f8ef4db
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.8.8-2
f8ef4db
- Rebuild for Python 3.6
f8ef4db
47a73ec
* Sat Sep 17 2016 Kevin Fenzi <kevin@scrye.com> - 0.8.8-1
47a73ec
- Update to 0.8.8. Fixes bug #1376235
47a73ec
9e1dd60
* Wed Jul 27 2016 Ralph Bean <rbean@redhat.com> - 0.8.7-1
9e1dd60
- new version
9e1dd60
9e207f5
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.6-2
9e207f5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
9e207f5
5a69b6a
* Fri Apr 15 2016 Ralph Bean <rbean@redhat.com> - 0.8.6-1
5a69b6a
- new version
5a69b6a
9f38d90
* Tue Mar 29 2016 Ralph Bean <rbean@redhat.com> - 0.8.5-1
9f38d90
- new version
9f38d90
0087e85
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.3-4
0087e85
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
0087e85
214ae92
* Tue Nov 24 2015 Ralph Bean <rbean@redhat.com> - 0.8.3-3
214ae92
- Add requirement on python-editor.
214ae92
b500e22
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.3-2
b500e22
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
b500e22
6d6ce83
* Sat Oct 17 2015 Ralph Bean <rbean@redhat.com> - 0.8.3-1
6d6ce83
- new version
6d6ce83
a1ca5a8
* Wed Aug 26 2015 Ralph Bean <rbean@redhat.com> - 0.8.2-1
a1ca5a8
- new version
a1ca5a8
d294a2f
* Fri Jul 10 2015 Ralph Bean <rbean@redhat.com> - 0.7.6-3
8cacb65
- Disable tests until sqlalchemy-1.1 is out.  There's a bug against
8cacb65
  MS sql DBs (likely won't affect us).
8cacb65
b2c4c7c
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.6-2
b2c4c7c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
b2c4c7c
5e6cc4a
* Wed May 06 2015 Ralph Bean <rbean@redhat.com> - 0.7.6-1
5e6cc4a
- new version
5e6cc4a
f0d69a4
* Mon Mar 16 2015 Ralph Bean <rbean@redhat.com> - 0.7.4-2
f0d69a4
- Merge in epel7 compat changes to the spec file.
f0d69a4
- Drop patch for epel7, no longer needed with modern upstream.
179f7a5
179f7a5
* Sat Feb 21 2015 Ralph Bean <rbean@redhat.com> - 0.7.4-1
179f7a5
- new version
179f7a5
- No longer using 2to3.
179f7a5
582595e
* Wed Aug 20 2014 Ralph Bean <rbean@redhat.com> - 0.6.6-1
582595e
- Latest upstream.
582595e
- Modernized python macros.
582595e
- Re-enabled python3 tests.
582595e
- Cleaned up the description formatting.
582595e
b46779d
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.5-3
b46779d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
b46779d
c0d21c9
* Tue May 27 2014 Kalev Lember <kalevlember@gmail.com> - 0.6.5-2
c0d21c9
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
c0d21c9
8b3ce78
* Tue May 06 2014 Ralph Bean <rbean@redhat.com> - 0.6.5-1
8b3ce78
- Latest upstream.
8b3ce78
bb012a0
* Tue Feb 04 2014 Ralph Bean <rbean@redhat.com> - 0.6.3-1
bb012a0
- Latest upstream.
bb012a0
c146b27
* Tue Jan 28 2014 Ralph Bean <rbean@redhat.com> - 0.6.2-2
c146b27
- Simplify some nested conditionals.
c146b27
- Attempt a better rhel conditional.
c146b27
- Added buildtime dep on python-mock for the test suite.
c146b27
a8eecc5
* Tue Jan 28 2014 Ralph Bean <rbean@redhat.com> - 0.6.2-1
a8eecc5
- Latest upstream.
a8eecc5
e160057
* Mon Jul 29 2013 Ralph Bean <rbean@redhat.com> - 0.5.0-2
e160057
- Add forgotten dependency on python-setuptools.
e160057
  https://bugzilla.redhat.com/show_bug.cgi?id=989016
e160057
befdccf
* Wed May 29 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 0.4.2-2
befdccf
- Workaround setuptools to load the correct SQLAlchemy version for
befdccf
  the alembic script. https://bugzilla.redhat.com/show_bug.cgi?id=968404
befdccf
728454e
* Wed Apr 10 2013 Ralph Bean <rbean@redhat.com> - 0.5.0-1
728454e
- Update to 0.5.0
728454e
6e19efc
* Thu Mar 14 2013 Pádraig Brady <pbrady@redhat.com> - 0.4.2-1
6e19efc
- Update to 0.4.2
6e19efc
7713b3d
* Fri Feb 22 2013 Ralph Bean <rbean@redhat.com> - 0.3.4-11
d7d9eac
- Rebuilt again for good measure.
00f774d
- Disabled python3 tests.. they started failing in rawhide.
d7d9eac
c8f0f7b
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-10
c8f0f7b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
c8f0f7b
3e18ecd
* Wed Sep 12 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-9
3e18ecd
- Require at least sqlalchemy 0.7.4.
3e18ecd
a43a9a2
* Wed Sep 12 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-8
a43a9a2
- Don't install manpages if they don't exist.
a43a9a2
b9bfc9a
* Wed Sep 12 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-7
b9bfc9a
- Stop trying to build man pages for el6.
b9bfc9a
ffb5e9f
* Wed Sep 12 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-6
ffb5e9f
- Typofix.
ffb5e9f
e8060e3
* Wed Sep 12 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-5
e8060e3
- Accomodate older help2man on epel.
e8060e3
f3d1230
* Fri Aug 31 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-4
f3d1230
- Correct %%files entries for the man pages.
f3d1230
dc8f213
* Fri Aug 31 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-3
dc8f213
- Include docs folder in %%doc section.
dc8f213
- Use help2man to build man pages for executables.
dc8f213
- Remove article from summary (cosmetic).
dc8f213
- Add trailing slash to directories in %%files (cosmetic).
dc8f213
dc8f213
* Thu Jul 05 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-2
dc8f213
- Require python-argparse if running on py2.6 or earlier.
dc8f213
- Require the forward-compat python-sqlalchemy on epel.
dc8f213
- Require the forward-compat python-nose on epel.
dc8f213
dc8f213
* Thu Jul 05 2012 Ralph Bean <rbean@redhat.com> - 0.3.4-1
dc8f213
- initial package for Fedora