2f85304
%if 0%{?fedora} > 12
dc8f213
%global with_python3 1
dc8f213
%endif
dc8f213
dc8f213
%global modname alembic
dc8f213
dc8f213
Name:             python-alembic
a8eecc5
Version:          0.6.2
c146b27
Release:          2%{?dist}
dc8f213
Summary:          Database migration tool for SQLAlchemy
dc8f213
dc8f213
Group:            Development/Libraries
dc8f213
License:          MIT
dc8f213
URL:              http://pypi.python.org/pypi/alembic
dc8f213
Source0:          http://pypi.python.org/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
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
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
dc8f213
`SQLAlchemy <http://www.sqlalchemy.org>`_.  A migrations tool offers the
dc8f213
following functionality:
dc8f213
dc8f213
* Can emit ALTER statements to a database in order to change the structure
dc8f213
of tables and other constructs.
dc8f213
* Provides a system whereby "migration scripts" may be constructed; each script
dc8f213
indicates a particular series of steps that can "upgrade" a target database to
dc8f213
a new version, and optionally a series of steps that can "downgrade"
dc8f213
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
dc8f213
dc8f213
%description -n python3-alembic
dc8f213
Alembic is a new database migrations tool, written by the author of
dc8f213
`SQLAlchemy <http://www.sqlalchemy.org>`_.  A migrations tool offers the
dc8f213
following functionality:
dc8f213
dc8f213
* Can emit ALTER statements to a database in order to change the structure
dc8f213
of tables and other constructs.
dc8f213
* Provides a system whereby "migration scripts" may be constructed; each script
dc8f213
indicates a particular series of steps that can "upgrade" a target database to
dc8f213
a new version, and optionally a series of steps that can "downgrade"
dc8f213
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
dc8f213
%{__python} setup.py build
dc8f213
dc8f213
%if 0%{?with_python3}
dc8f213
/usr/bin/2to3 -w -n %{py3dir}
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}
dc8f213
%{__python3} setup.py install -O1 --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
dc8f213
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
c146b27
%if 0%{?rhel} && 0%{?rhel} <= 6
a43a9a2
%else
dc8f213
install -m 0644 alembic.1 %{buildroot}%{_mandir}/man1/alembic.1
a43a9a2
%endif
dc8f213
dc8f213
%check
dc8f213
%{__python} setup.py test
dc8f213
00f774d
# Disable python3 tests for now.
00f774d
#%if 0%{?with_python3}
00f774d
#pushd %{py3dir}
00f774d
#%{__python3} setup.py test
00f774d
#popd
00f774d
#%endif
dc8f213
dc8f213
dc8f213
%files
dc8f213
%doc README.rst LICENSE CHANGES docs
dc8f213
%{python_sitelib}/%{modname}/
dc8f213
%{python_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
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
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
d7d9eac
* Fri Feb 22 2013 Ralph Bean <rbean@redhat.com> - 0.3.4-10
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