[python-migrate/el6] Revert "update to version 0.7.1"
Pádraig Brady
pbrady at fedoraproject.org
Tue Jan 22 20:21:57 UTC 2013
commit 9c182782a40fdfc5f9c467c235e085f64e187473
Author: Pádraig Brady <P at draigBrady.com>
Date: Tue Jan 22 20:18:05 2013 +0000
Revert "update to version 0.7.1"
This reverts commit 8dea6fc88a57c2455ab4724201c7beb9e2c07ec2.
contrary to the docs,
0.7.1 is not in fact compat with sqlalchemy 0.5 as the build
% check fails with lots of instances of:
File ".../migrate/versioning/schemadiff.py", line 72, in __init__
self.affinity_A = self.type_A._type_affinity
AttributeError: 'Text' object has no attribute '_type_affinity'
I presume _type_affinity was introduced to sqlalchemy sometime
after the version currently in RHEL.
.gitignore | 1 -
migrate-0.7-compat.patch | 78 ++++++++++++++++++++++++++++
migrate-fix-deprecation-warning.patch | 35 +++++++++++++
migrate-py27.patch | 21 ++++++--
migrate-test-whitespace.patch | 34 ------------
python-migrate-sqlalchemy-migrate.patch | 85 ++++++++++++++++---------------
python-migrate.spec | 20 ++++----
sources | 2 +-
8 files changed, 183 insertions(+), 93 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 6981667..3bf2496 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
sqlalchemy-migrate-0.6.tar.gz
-/sqlalchemy-migrate-0.7.1.tar.gz
diff --git a/migrate-0.7-compat.patch b/migrate-0.7-compat.patch
new file mode 100644
index 0000000..1ff795a
--- /dev/null
+++ b/migrate-0.7-compat.patch
@@ -0,0 +1,78 @@
+diff -Naur sqlalchemy-migrate-0.6.orig/migrate/changeset/__init__.py sqlalchemy-migrate-0.6/migrate/changeset/__init__.py
+--- sqlalchemy-migrate-0.6.orig/migrate/changeset/__init__.py 2010-07-04 08:24:21.000000000 +0000
++++ sqlalchemy-migrate-0.6/migrate/changeset/__init__.py 2011-12-04 22:36:17.849710345 +0000
+@@ -11,6 +11,7 @@
+
+ _sa_version = tuple(int(re.match("\d+", x).group(0)) for x in _sa_version.split("."))
+ SQLA_06 = _sa_version >= (0, 6)
++SQLA_07 = _sa_version >= (0, 7)
+
+ del re
+ del _sa_version
+diff -Naur sqlalchemy-migrate-0.6.orig/migrate/changeset/schema.py sqlalchemy-migrate-0.6/migrate/changeset/schema.py
+--- sqlalchemy-migrate-0.6.orig/migrate/changeset/schema.py 2010-07-11 16:26:39.000000000 +0000
++++ sqlalchemy-migrate-0.6/migrate/changeset/schema.py 2011-12-04 22:36:54.562808367 +0000
+@@ -6,7 +6,7 @@
+
+ import sqlalchemy
+
+-from migrate.changeset import SQLA_06
++from migrate.changeset import SQLA_06, SQLA_07
+ from migrate.changeset.exceptions import *
+ from migrate.changeset.databases.visitor import (get_engine_visitor,
+ run_single_visitor)
+@@ -556,14 +556,20 @@
+
+ def add_to_table(self, table):
+ if table is not None and self.table is None:
+- self._set_parent(table)
++ if SQLA_07:
++ table.append_column(self)
++ else:
++ self._set_parent(table)
+
+ def remove_from_table(self, table, unset_table=True):
+ # TODO: remove indexes, primary keys, constraints, etc
+ if unset_table:
+ self.table = None
+ if table.c.contains_column(self):
+- table.c.remove(self)
++ if SQLA_07:
++ table._columns.remove(self)
++ else:
++ table.c.remove(self)
+
+ # TODO: this is fixed in 0.6
+ def copy_fixed(self, **kw):
+diff -Naur sqlalchemy-migrate-0.6.orig/migrate/versioning/schema.py sqlalchemy-migrate-0.6/migrate/versioning/schema.py
+--- sqlalchemy-migrate-0.6.orig/migrate/versioning/schema.py 2010-07-04 08:24:22.000000000 +0000
++++ sqlalchemy-migrate-0.6/migrate/versioning/schema.py 2011-12-04 22:36:34.746755563 +0000
+@@ -10,6 +10,7 @@
+ from sqlalchemy import exceptions as sa_exceptions
+ from sqlalchemy.sql import bindparam
+
++from migrate.changeset import SQLA_07
+ from migrate.versioning import exceptions, genmodel, schemadiff
+ from migrate.versioning.repository import Repository
+ from migrate.versioning.util import load_model
+@@ -56,10 +57,16 @@
+ """
+ Remove version control from a database.
+ """
+- try:
+- self.table.drop()
+- except (sa_exceptions.SQLError):
+- raise exceptions.DatabaseNotControlledError(str(self.table))
++ if SQLA_07:
++ try:
++ self.table.drop()
++ except (sa_exceptions.DatabaseError):
++ raise exceptions.DatabaseNotControlledError(str(self.table))
++ else:
++ try:
++ self.table.drop()
++ except (sa_exceptions.SQLError):
++ raise exceptions.DatabaseNotControlledError(str(self.table))
+
+ def changeset(self, version=None):
+ """API to Changeset creation.
diff --git a/migrate-fix-deprecation-warning.patch b/migrate-fix-deprecation-warning.patch
new file mode 100644
index 0000000..958f060
--- /dev/null
+++ b/migrate-fix-deprecation-warning.patch
@@ -0,0 +1,35 @@
+Change the way a deprecation warning is issued. Fixes these:
+
+http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=98
+http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=106
+
+diff -Naur sqlalchemy-migrate-0.6.orig/migrate/versioning/script/py.py sqlalchemy-migrate-0.6/migrate/versioning/script/py.py
+--- sqlalchemy-migrate-0.6.orig/migrate/versioning/script/py.py 2010-07-09 18:53:14.000000000 +0000
++++ sqlalchemy-migrate-0.6/migrate/versioning/script/py.py 2011-12-04 22:35:55.450650132 +0000
+@@ -4,6 +4,7 @@
+ import shutil
+ import warnings
+ import logging
++import inspect
+ from StringIO import StringIO
+
+ import migrate
+@@ -136,12 +137,12 @@
+ funcname = base.operations[op]
+ script_func = self._func(funcname)
+
+- try:
+- script_func(engine)
+- except TypeError:
+- warnings.warn("upgrade/downgrade functions must accept engine"
+- " parameter (since version > 0.5.4)", exceptions.MigrateDeprecationWarning)
+- raise
++ # check for old way of using engine
++ if not inspect.getargspec(script_func).args:
++ raise TypeError("upgrade/downgrade functions must accept engine"
++ " parameter (since version 0.5.4)")
++
++ script_func(engine)
+
+ @property
+ def module(self):
diff --git a/migrate-py27.patch b/migrate-py27.patch
index 1a0b757..2d74db8 100644
--- a/migrate-py27.patch
+++ b/migrate-py27.patch
@@ -1,8 +1,17 @@
-diff -Naur sqlalchemy-migrate-0.7.1/migrate/tests/versioning/test_shell.py sqlalchemy-migrate-0.7.1-a/migrate/tests/versioning/test_shell.py
---- sqlalchemy-migrate-0.7.1/migrate/tests/versioning/test_shell.py 2010-10-31 12:19:56.000000000 +0000
-+++ sqlalchemy-migrate-0.7.1-a/migrate/tests/versioning/test_shell.py 2013-01-22 16:30:39.606918270 +0000
-@@ -482,8 +482,18 @@
- self.assert_("tables missing from database: tmp_account_rundiffs" in result.stdout)
+Index: sqlalchemy-migrate-0.6/migrate/tests/versioning/test_shell.py
+===================================================================
+--- sqlalchemy-migrate-0.6.orig/migrate/tests/versioning/test_shell.py
++++ sqlalchemy-migrate-0.6/migrate/tests/versioning/test_shell.py
+@@ -4,6 +4,7 @@
+ import os
+ import sys
+ import tempfile
++
+ try:
+ from runpy import run_module
+ except ImportError:
+@@ -476,8 +477,18 @@ class TestShellDatabase(Shell, DB):
+ self.assert_("tables missing in database: tmp_account_rundiffs" in result.stdout)
# Test Deprecation
+ if 'PYTHONWARNINGS' in self.env.environ:
@@ -19,4 +28,4 @@ diff -Naur sqlalchemy-migrate-0.7.1/migrate/tests/versioning/test_shell.py sqlal
+
self.assertEqual(result.returncode, 0)
self.assertTrue("DeprecationWarning" in result.stderr)
- self.assert_("tables missing from database: tmp_account_rundiffs" in result.stdout)
+ self.assert_("tables missing in database: tmp_account_rundiffs" in result.stdout)
diff --git a/python-migrate-sqlalchemy-migrate.patch b/python-migrate-sqlalchemy-migrate.patch
index 993484a..8696358 100644
--- a/python-migrate-sqlalchemy-migrate.patch
+++ b/python-migrate-sqlalchemy-migrate.patch
@@ -1,7 +1,23 @@
-diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/fixture/shell.py sqlalchemy-migrate-0.7.1/migrate/tests/fixture/shell.py
---- sqlalchemy-migrate-0.7.1.orig/migrate/tests/fixture/shell.py 2013-01-22 16:38:23.515225096 +0000
-+++ sqlalchemy-migrate-0.7.1/migrate/tests/fixture/shell.py 2013-01-22 16:39:03.189336944 +0000
-@@ -25,9 +25,9 @@
+Index: setup.py
+===================================================================
+--- setup.py.orig
++++ setup.py
+@@ -32,8 +32,8 @@ setup(
+ license = "MIT",
+ entry_points = """
+ [console_scripts]
+- migrate = migrate.versioning.shell:main
+- migrate-repository = migrate.versioning.migrate_repository:main
++ sqlalchemy-migrate = migrate.versioning.shell:main
++ sqlalchemy-migrate-repository = migrate.versioning.migrate_repository:main
+ """,
+ test_suite = "nose.collector",
+ )
+Index: migrate/tests/fixture/shell.py
+===================================================================
+--- migrate/tests/fixture/shell.py.orig
++++ migrate/tests/fixture/shell.py
+@@ -25,9 +25,9 @@ class Shell(Pathed):
)
def run_version(self, repos_path):
@@ -13,10 +29,11 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/fixture/shell.py sqlalche
- result = self.env.run('migrate db_version %s %s' % (url, repos_path))
+ result = self.env.run('sqlalchemy-migrate db_version %s %s' % (url, repos_path))
return int(result.stdout.strip())
-diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py sqlalchemy-migrate-0.7.1/migrate/tests/versioning/test_shell.py
---- sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py 2013-01-22 16:38:23.520225111 +0000
-+++ sqlalchemy-migrate-0.7.1/migrate/tests/versioning/test_shell.py 2013-01-22 16:39:03.195336962 +0000
-@@ -21,15 +21,15 @@
+Index: migrate/tests/versioning/test_shell.py
+===================================================================
+--- migrate/tests/versioning/test_shell.py.orig
++++ migrate/tests/versioning/test_shell.py
+@@ -25,15 +25,15 @@ class TestShellCommands(Shell):
def test_help(self):
"""Displays default help dialog"""
@@ -36,7 +53,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assertTrue(isinstance(result.stdout, basestring))
self.assertTrue(result.stdout)
self.assertFalse(result.stderr)
-@@ -37,10 +37,10 @@
+@@ -41,10 +41,10 @@ class TestShellCommands(Shell):
def test_shutdown_logging(self):
"""Try to shutdown logging output"""
repos = self.tmp_repos()
@@ -50,7 +67,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assertEqual(result.stdout, '')
# TODO: assert logging messages to 0
-@@ -94,7 +94,7 @@
+@@ -89,7 +89,7 @@ class TestShellCommands(Shell):
repos = self.tmp_repos()
# Creating a file that doesn't exist should succeed
@@ -59,7 +76,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
# Files should actually be created
self.assert_(os.path.exists(repos))
-@@ -104,35 +104,35 @@
+@@ -99,35 +99,35 @@ class TestShellCommands(Shell):
self.assertNotEquals(repos_.config.get('db_settings', 'version_table'), 'None')
# Can't create it again: it already exists
@@ -103,7 +120,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assert_(os.path.exists('%s/versions/002_postgres_upgrade.sql' % repos))
self.assert_(os.path.exists('%s/versions/002_postgres_downgrade.sql' % repos))
-@@ -144,7 +144,7 @@
+@@ -139,7 +139,7 @@ class TestShellCommands(Shell):
self.assert_(not os.path.exists(script))
# No attempt is made to verify correctness of the repository path here
@@ -112,7 +129,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assert_(os.path.exists(script))
-@@ -155,41 +155,41 @@
+@@ -150,41 +150,41 @@ class TestShellRepository(Shell):
"""Create repository, python change script"""
super(TestShellRepository, self).setUp()
self.path_repos = self.tmp_repos()
@@ -163,7 +180,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
(filename, self.path_repos))
self.assert_(os.path.exists(filename))
fd = open(filename)
-@@ -209,17 +209,17 @@
+@@ -204,17 +204,17 @@ class TestShellDatabase(Shell, DB):
"""Ensure we can set version control on a database"""
path_repos = repos = self.tmp_repos()
url = self.url
@@ -186,7 +203,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
% locals(), expect_error=True)
self.assertEqual(result.returncode, 1)
-@@ -228,41 +228,41 @@
+@@ -223,41 +223,41 @@ class TestShellDatabase(Shell, DB):
"""Commands with default arguments set by manage.py"""
path_repos = repos = self.tmp_repos()
url = self.url
@@ -239,7 +256,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
@usedb()
def test_upgrade(self):
-@@ -270,67 +270,67 @@
+@@ -265,67 +265,67 @@ class TestShellDatabase(Shell, DB):
# Create a repository
repos_name = 'repos_name'
repos_path = self.tmp()
@@ -328,7 +345,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assertEquals(self.run_version(repos_path), 1)
self.assertEquals(len(os.listdir(os.path.join(repos_path, 'versions'))), beforeCount + 2)
-@@ -340,11 +340,11 @@
+@@ -335,11 +335,11 @@ class TestShellDatabase(Shell, DB):
self.assertEquals(self.run_db_version(self.url, repos_path), 0)
self.assertRaises(Exception, self.engine.text('select * from t_table').execute)
@@ -342,7 +359,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assertEquals(self.run_db_version(self.url, repos_path), 0)
self.assertRaises(Exception, self.engine.text('select * from t_table').execute)
-@@ -384,15 +384,15 @@
+@@ -379,15 +379,15 @@ class TestShellDatabase(Shell, DB):
repos_name = 'repos_name'
repos_path = self.tmp()
@@ -363,7 +380,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assertEquals(self.run_version(repos_path), 1)
self.assertEquals(self.run_db_version(self.url, repos_path), 0)
-@@ -414,7 +414,7 @@
+@@ -409,7 +409,7 @@ class TestShellDatabase(Shell, DB):
file.write(script_text)
file.close()
@@ -372,7 +389,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assertEqual(result.returncode, 2)
self.assertEquals(self.run_version(repos_path), 1)
self.assertEquals(self.run_db_version(self.url, repos_path), 0)
-@@ -445,7 +445,7 @@
+@@ -440,7 +440,7 @@ class TestShellDatabase(Shell, DB):
file = open(script_path, 'w')
file.write(script_text)
file.close()
@@ -381,7 +398,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
self.assertEquals(self.run_version(repos_path), 1)
self.assertEquals(self.run_db_version(self.url, repos_path), 0)
-@@ -465,19 +465,19 @@
+@@ -460,19 +460,19 @@ class TestShellDatabase(Shell, DB):
self.meta.reflect()
self.meta.drop_all() # in case junk tables are lying around in the test database
@@ -404,9 +421,9 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
- result = self.env.run('migrate compare_model_to_db %s %s --model=%s' \
+ result = self.env.run('sqlalchemy-migrate compare_model_to_db %s %s --model=%s' \
% (self.url, repos_path, model_module))
- self.assert_("tables missing from database: tmp_account_rundiffs" in result.stdout)
+ self.assert_("tables missing in database: tmp_account_rundiffs" in result.stdout)
-@@ -487,7 +487,7 @@
+@@ -482,7 +482,7 @@ class TestShellDatabase(Shell, DB):
else:
warnings = None
self.env.environ['PYTHONWARNINGS'] = 'default'
@@ -415,8 +432,8 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
% (self.url, repos_path, model_module.replace(":", ".")), expect_error=True)
if warnings == None:
del(self.env.environ['PYTHONWARNINGS'])
-@@ -499,19 +499,19 @@
- self.assert_("tables missing from database: tmp_account_rundiffs" in result.stdout)
+@@ -494,19 +494,19 @@ class TestShellDatabase(Shell, DB):
+ self.assert_("tables missing in database: tmp_account_rundiffs" in result.stdout)
# Update db to latest model.
- result = self.env.run('migrate update_db_from_model %s %s %s'\
@@ -440,7 +457,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
temp_dict = dict()
exec result.stdout in temp_dict
-@@ -525,10 +525,10 @@
+@@ -520,10 +520,10 @@ class TestShellDatabase(Shell, DB):
##Column('passwd', String(length=None, convert_unicode=False, assert_unicode=None))""" in result.stdout)
## We're happy with db changes, make first db upgrade script to go from version 0 -> 1.
@@ -453,7 +470,7 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
#% (self.url, repos_path, old_model_module, model_module))
#self.assertEqualsIgnoreWhitespace(result_script.stdout,
#'''from sqlalchemy import *
-@@ -555,11 +555,11 @@
+@@ -550,11 +550,11 @@ class TestShellDatabase(Shell, DB):
#tmp_account_rundiffs.drop()''')
## Save the upgrade script.
@@ -467,17 +484,3 @@ diff -Naur sqlalchemy-migrate-0.7.1.orig/migrate/tests/versioning/test_shell.py
#% (self.url, repos_path, model_module))
#self.assert_("No schema diffs" in result.stdout)
-diff -Naur sqlalchemy-migrate-0.7.1.orig/setup.py sqlalchemy-migrate-0.7.1/setup.py
---- sqlalchemy-migrate-0.7.1.orig/setup.py 2011-05-27 12:26:46.000000000 +0000
-+++ sqlalchemy-migrate-0.7.1/setup.py 2013-01-22 16:39:03.189336944 +0000
-@@ -32,8 +32,8 @@
- license = "MIT",
- entry_points = """
- [console_scripts]
-- migrate = migrate.versioning.shell:main
-- migrate-repository = migrate.versioning.migrate_repository:main
-+ sqlalchemy-migrate = migrate.versioning.shell:main
-+ sqlalchemy-migrate-repository = migrate.versioning.migrate_repository:main
- """,
- test_suite = "nose.collector",
- )
diff --git a/python-migrate.spec b/python-migrate.spec
index 49695e7..a4190bd 100644
--- a/python-migrate.spec
+++ b/python-migrate.spec
@@ -5,8 +5,8 @@
%global srcname sqlalchemy-migrate
Name: python-migrate
-Version: 0.7.1
-Release: 1%{?dist}
+Version: 0.6
+Release: 6%{?dist}
Summary: Schema migration tools for SQLAlchemy
Group: Development/Languages
@@ -17,8 +17,10 @@ Source0: http://%{srcname}.googlecode.com/files/%{srcname}-%{version}.tar.gz
Patch0: migrate-scripttest-update.patch
# Patch to fix a unittest on python-2.7
Patch1: migrate-py27.patch
-# Patch to fix a unittest whitespace issue
-Patch2: migrate-test-whitespace.patch
+# Fix invalid code causing an exception
+Patch2: migrate-fix-deprecation-warning.patch
+# Support sqlalchemy 0.7
+Patch3: migrate-0.7-compat.patch
# Local patch to rename /usr/bin/migrate to sqlalchemy-migrate
Patch100: python-migrate-sqlalchemy-migrate.patch
@@ -60,8 +62,9 @@ database change sets and database repository versioning.
%setup -q -n %{srcname}-%{version}
%patch0 -p1 -b .test
%patch1 -p1 -b .py27
-%patch2 -p1 -b .whitespace
-%patch100 -p1 -b .rename
+%patch2 -p1 -b .exception
+%patch3 -p1 -b .compat
+%patch100 -p0 -b .rename
# use real unittest in python 2.7 and up
%if 0%{?fedora} || 0%{?rhel} > 6
@@ -94,14 +97,11 @@ nosetests
%files
%defattr(-,root,root,-)
-%doc README docs/
+%doc README TODO docs/
%{_bindir}/*
%{python_sitelib}/*
%changelog
-* Tue Jan 22 2013 Pádraig Brady <P at draigBrady.com> - 0.7.1-1
-- Update to 0.7.1
-
* Sun Dec 04 2011 Pádraig Brady <P at draigBrady.com> - 0.6-6
- Fix a crash when trying to issue a deprecation warning
- Backport sqlalchemy 0.7 support
diff --git a/sources b/sources
index 8b16ac7..2709451 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-023acd2cb74882597074768a0e84468a sqlalchemy-migrate-0.7.1.tar.gz
+84a983d9cf15cf9bf5dd1b44785f065a sqlalchemy-migrate-0.6.tar.gz
More information about the scm-commits
mailing list