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
46a5fb3
Version:          0.9.0
46a5fb3
Release:          1%{?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
dc8f213
dc8f213
Requires:         python-mako
e160057
Requires:         python-setuptools
214ae92
Requires:         python-editor
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
3e18ecd
Requires:         python-sqlalchemy0.7 >= 0.7.4
dc8f213
Requires:         python-argparse
dc8f213
%else
dc8f213
BuildRequires:    python-nose
3e18ecd
BuildRequires:    python-sqlalchemy >= 0.7.4
3e18ecd
Requires:         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
dc8f213
%endif
dc8f213
dc8f213
dc8f213
%description
dc8f213
Alembic is a new database migrations tool, written by the author of
582595e
SQLAlchemy.  A migrations tool offers the following functionality:
dc8f213
dc8f213
* Can emit ALTER statements to a database in order to change the structure
582595e
  of tables and other constructs.
dc8f213
* Provides a system whereby "migration scripts" may be constructed; each script
582595e
  indicates a particular series of steps that can "upgrade" a target database
582595e
  to a new version, and optionally a series of steps that can "downgrade"
582595e
  similarly, doing the same steps in reverse.
dc8f213
* Allows the scripts to execute in some sequential manner.
dc8f213
dc8f213
Documentation and status of Alembic is at http://readthedocs.org/docs/alembic/
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
%package -n python3-alembic
dc8f213
Summary:        A database migration tool for SQLAlchemy
dc8f213
Group:          Development/Libraries
dc8f213
3e18ecd
Requires:         python3-sqlalchemy >= 0.7.4
dc8f213
Requires:         python3-mako
e160057
Requires:         python3-setuptools
214ae92
Requires:         python3-editor
dc8f213
dc8f213
%description -n python3-alembic
dc8f213
Alembic is a new database migrations tool, written by the author of
582595e
SQLAlchemy.  A migrations tool offers the following functionality:
dc8f213
dc8f213
* Can emit ALTER statements to a database in order to change the structure
582595e
  of tables and other constructs.
dc8f213
* Provides a system whereby "migration scripts" may be constructed; each script
582595e
  indicates a particular series of steps that can "upgrade" a target database
582595e
  to a new version, and optionally a series of steps that can "downgrade"
582595e
  similarly, doing the same steps in reverse.
dc8f213
* Allows the scripts to execute in some sequential manner.
dc8f213
dc8f213
Documentation and status of Alembic is at http://readthedocs.org/docs/alembic/
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
dc8f213
# Credit for this goes to Toshio Kuratomi 
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
b9bfc9a
%else
dc8f213
%{__mkdir_p} bin
dc8f213
echo 'python -c "import alembic.config; alembic.config.main()" $*' > bin/alembic
dc8f213
chmod 0755 bin/alembic
b9bfc9a
help2man --version-string %{version} --no-info -s 1 bin/alembic > alembic.1
c146b27
%endif
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
pushd %{py3dir}
dc8f213
%{__mkdir_p} bin
dc8f213
echo 'python3 -c "import alembic.config; alembic.config.main()" $*' > bin/python3-alembic
dc8f213
chmod 0755 bin/python3-alembic
b9bfc9a
help2man --version-string %{version} --no-info -s 1 bin/python3-alembic > python3-alembic.1
dc8f213
popd
dc8f213
%endif
dc8f213
dc8f213
dc8f213
%install
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
b9bfc9a
%else
dc8f213
install -d -m 0755 %{buildroot}%{_mandir}/man1
b9bfc9a
%endif
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
pushd %{py3dir}
befdccf
%{__python3} setup.py install --skip-build --root=%{buildroot}
dc8f213
mv %{buildroot}/%{_bindir}/%{modname} %{buildroot}/%{_bindir}/python3-%{modname}
dc8f213
install -m 0644 python3-alembic.1 %{buildroot}%{_mandir}/man1/python3-alembic.1
dc8f213
popd
dc8f213
%endif
dc8f213
582595e
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
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.
befdccf
sed -i -e "s|__requires__ = 'alembic==0.4.2'|__requires__ = ['alembic==0.4.2', 'SQLAlchemy>=0.6']|" %{buildroot}%{_bindir}/%{modname}
a43a9a2
%else
dc8f213
install -m 0644 alembic.1 %{buildroot}%{_mandir}/man1/alembic.1
a43a9a2
%endif
dc8f213
8cacb65
# Disable tests until sqlalchemy-1.1 is out
8cacb65
#%check
8cacb65
#%{__python2} setup.py test
8cacb65
#
8cacb65
#%if 0%{?with_python3}
8cacb65
#pushd %{py3dir}
8cacb65
#%{__python3} setup.py test
8cacb65
#popd
8cacb65
#%endif
dc8f213
dc8f213
dc8f213
%files
dc8f213
%doc README.rst LICENSE CHANGES docs
582595e
%{python2_sitelib}/%{modname}/
582595e
%{python2_sitelib}/%{modname}-%{version}*
dc8f213
%{_bindir}/%{modname}
b9bfc9a
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
b9bfc9a
%else
f3d1230
%{_mandir}/man1/alembic.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}-*
dc8f213
%{_bindir}/python3-%{modname}
f3d1230
%{_mandir}/man1/python3-alembic.1*
dc8f213
%endif
dc8f213
dc8f213
dc8f213
%changelog
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