[python-alembic/el6] Workaround setuptools to load the correct SQLAlchemy version for

Toshio くらとみ toshio at fedoraproject.org
Wed May 29 18:03:28 UTC 2013


commit befdccf7ad0f5e45726f30183f287e7ac5931418
Author: Toshio Kuratomi <toshio at fedoraproject.org>
Date:   Wed May 29 11:03:18 2013 -0700

    Workaround setuptools to load the correct SQLAlchemy version for
    
      the alembic script. https://bugzilla.redhat.com/show_bug.cgi?id=968404

 python-alembic.spec |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/python-alembic.spec b/python-alembic.spec
index 98a1206..11d3011 100644
--- a/python-alembic.spec
+++ b/python-alembic.spec
@@ -6,7 +6,7 @@
 
 Name:             python-alembic
 Version:          0.4.2
-Release:          1%{?dist}
+Release:          2%{?dist}
 Summary:          Database migration tool for SQLAlchemy
 
 Group:            Development/Libraries
@@ -138,7 +138,7 @@ install -d -m 0755 %{buildroot}%{_mandir}/man1
 
 %if 0%{?with_python3}
 pushd %{py3dir}
-%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
+%{__python3} setup.py install --skip-build --root=%{buildroot}
 mv %{buildroot}/%{_bindir}/%{modname} %{buildroot}/%{_bindir}/python3-%{modname}
 %if %{?rhel}%{!?rhel:0} <= 6
 %else
@@ -147,8 +147,15 @@ install -m 0644 python3-alembic.1 %{buildroot}%{_mandir}/man1/python3-alembic.1
 popd
 %endif
 
-%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
+%{__python} setup.py install --skip-build --root=%{buildroot}
 %if %{?rhel}%{!?rhel:0} <= 6
+# Modify /usr/bin/alembic to require SQLAlchemy>=0.6
+# Hacky but setuptools only creates this file after setup.py install is run :-(
+# Root cause is that setuptools doesn't recurse the requirements when it processes
+# the __requires__.  It waits until pkg_resources.require('MODULE') is called.
+# Since that isn't done in the entrypoints script, we need to specify the dependency
+# on a specific SQLAlchemy version explicitly.
+sed -i -e "s|__requires__ = 'alembic==0.4.2'|__requires__ = ['alembic==0.4.2', 'SQLAlchemy>=0.6']|" %{buildroot}%{_bindir}/%{modname}
 %else
 install -m 0644 alembic.1 %{buildroot}%{_mandir}/man1/alembic.1
 %endif
@@ -191,6 +198,10 @@ install -m 0644 alembic.1 %{buildroot}%{_mandir}/man1/alembic.1
 
 
 %changelog
+* Wed May 29 2013 Toshio Kuratomi <toshio at fedoraproject.org> - 0.4.2-2
+- Workaround setuptools to load the correct SQLAlchemy version for
+  the alembic script. https://bugzilla.redhat.com/show_bug.cgi?id=968404
+
 * Thu Mar 14 2013 Pádraig Brady <pbrady at redhat.com> - 0.4.2-1
 - Update to 0.4.2
 


More information about the scm-commits mailing list