From 001c0cd4f5282dba5da3dd0cef6cf8b1b71df0de Mon Sep 17 00:00:00 2001 From: Toshio くらとみ Date: Jan 28 2009 01:51:00 +0000 Subject: - Update to snapshot so that it works with sqlalchemy-0.5 - Enable test suite --- diff --git a/.cvsignore b/.cvsignore index bcd635e..efa7810 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -sqlalchemy-migrate-0.4.5.tar.gz +sqlalchemy-migrate-0.5.1.dev-r479.tar.gz diff --git a/python-migrate-disable-pytest.patch b/python-migrate-disable-pytest.patch deleted file mode 100644 index d14ee89..0000000 --- a/python-migrate-disable-pytest.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: sqlalchemy-migrate-0.4.4/setup.py -=================================================================== ---- sqlalchemy-migrate-0.4.4.orig/setup.py -+++ sqlalchemy-migrate-0.4.4/setup.py -@@ -20,7 +20,7 @@ Migrate extends SQLAlchemy to have datab - """, - - install_requires = ['sqlalchemy >= 0.3.10'], -- setup_requires = ['py >= 0.9.0-beta'], -+ setup_requires = [], - dependency_links = [ - "http://codespeak.net/download/py/", - ], diff --git a/python-migrate-disable-test_fk.patch b/python-migrate-disable-test_fk.patch new file mode 100644 index 0000000..03d8c0c --- /dev/null +++ b/python-migrate-disable-test_fk.patch @@ -0,0 +1,50 @@ +diff -up sqlalchemy-migrate-0.5.1.dev-r479/test/changeset/test_changeset.py.bak sqlalchemy-migrate-0.5.1.dev-r479/test/changeset/test_changeset.py +--- sqlalchemy-migrate-0.5.1.dev-r479/test/changeset/test_changeset.py.bak 2009-01-26 17:42:59.000000000 -0800 ++++ sqlalchemy-migrate-0.5.1.dev-r479/test/changeset/test_changeset.py 2009-01-26 17:43:34.000000000 -0800 +@@ -150,26 +150,26 @@ class TestAddDropColumn(fixture.DB): + return drop_column(col.name,self.table) + return self.run_(add_func,drop_func) + +- @fixture.usedb() +- def test_fk(self): +- """Can create columns with foreign keys""" +- reftable = Table('tmp_ref',self.meta, +- Column('id',Integer,primary_key=True), +- ) +- # create FK's target +- if self.engine.has_table(reftable.name): +- reftable.drop() +- reftable.create() +- def add_func(col): +- self.table.append_column(col) +- return create_column(col.name,self.table) +- def drop_func(col): +- ret = drop_column(col.name,self.table) +- if self.engine.has_table(reftable.name): +- reftable.drop() +- return ret +- return self.run_(add_func,drop_func,Integer, +- ForeignKey(reftable.c.id)) ++ #@fixture.usedb() ++ #def test_fk(self): ++ # """Can create columns with foreign keys""" ++ # reftable = Table('tmp_ref',self.meta, ++ # Column('id',Integer,primary_key=True), ++ # ) ++ # # create FK's target ++ # if self.engine.has_table(reftable.name): ++ # reftable.drop() ++ # reftable.create() ++ # def add_func(col): ++ # self.table.append_column(col) ++ # return create_column(col.name,self.table) ++ # def drop_func(col): ++ # ret = drop_column(col.name,self.table) ++ # if self.engine.has_table(reftable.name): ++ # reftable.drop() ++ # return ret ++ # return self.run_(add_func,drop_func,Integer, ++ # ForeignKey(reftable.c.id)) + + #@fixture.usedb() + #def xtest_pk(self): diff --git a/python-migrate-migrate_repository.patch b/python-migrate-migrate_repository.patch deleted file mode 100644 index e61b9bb..0000000 --- a/python-migrate-migrate_repository.patch +++ /dev/null @@ -1,64 +0,0 @@ -Index: setup.py -=================================================================== ---- setup.py (revision 444) -+++ setup.py (working copy) -@@ -35,6 +35,7 @@ - entry_points = """ - [console_scripts] - migrate = migrate.versioning.shell:main -+ migrate-repository = migrate.versioning.migrate_repository:main - """, - test_suite = "py.test.cmdline.main", - ) -Index: migrate/versioning/migrate_repository.py -=================================================================== ---- migrate/versioning/migrate_repository.py (revision 444) -+++ migrate/versioning/migrate_repository.py (working copy) -@@ -4,7 +4,7 @@ - - - def usage(): -- -+ - print '''Usage: %(prog)s repository-to-migrate - - Upgrade your repository to the new flat format. -@@ -28,8 +28,8 @@ - def deleteDirectory(dirpath): - print ' Deleting directory: %s' % dirpath - os.rmdir(dirpath) -- - -+ - def migrate_repository(repos): - print 'Migrating repository at: %s to new format' % repos - versions = '%s/versions' % repos -@@ -42,11 +42,11 @@ - files = os.listdir(origdir) - files.sort() - for file in files: -- -+ - # Delete compiled Python files. - if file.endswith('.pyc') or file.endswith('.pyo'): - deleteFile('%s/%s' % (origdir, file)) -- -+ - # Delete empty __init__.py files. - origfile = '%s/__init__.py' % origdir - if os.path.exists(origfile) and len(open(origfile).read()) == 0: -@@ -69,10 +69,12 @@ - - # Try to remove directory. Will fail if it's not empty. - deleteDirectory(origdir) -- - --if __name__ == '__main__': -+ -+def main(): - if len(sys.argv) != 2: - usage() - migrate_repository(sys.argv[1]) - -+if __name__ == '__main__': -+ main() diff --git a/python-migrate-sqlalchemy-migrate.patch b/python-migrate-sqlalchemy-migrate.patch index 7a8ea5c..658990a 100644 --- a/python-migrate-sqlalchemy-migrate.patch +++ b/python-migrate-sqlalchemy-migrate.patch @@ -1,8 +1,8 @@ -Index: sqlalchemy-migrate-0.4.5/setup.py +Index: sqlalchemy-migrate-0.5.1.dev-r479/setup.py =================================================================== ---- sqlalchemy-migrate-0.4.5.orig/setup.py -+++ sqlalchemy-migrate-0.4.5/setup.py -@@ -34,8 +34,8 @@ Migrate extends SQLAlchemy to have datab +--- sqlalchemy-migrate-0.5.1.dev-r479.orig/setup.py ++++ sqlalchemy-migrate-0.5.1.dev-r479/setup.py +@@ -31,8 +31,8 @@ Migrate extends SQLAlchemy to have datab entry_points = """ [console_scripts] @@ -11,5 +11,5 @@ Index: sqlalchemy-migrate-0.4.5/setup.py + sqlalchemy-migrate = migrate.versioning.shell:main + sqlalchemy-migrate-repository = migrate.versioning.migrate_repository:main """, - test_suite = "py.test.cmdline.main", + test_suite = "nose.collector", ) diff --git a/python-migrate-unittests.patch b/python-migrate-unittests.patch new file mode 100644 index 0000000..34a8fa3 --- /dev/null +++ b/python-migrate-unittests.patch @@ -0,0 +1,21 @@ +Index: test/versioning/test_shell.py +=================================================================== +--- test/versioning/test_shell.py (revision 479) ++++ test/versioning/test_shell.py (working copy) +@@ -1,6 +1,7 @@ + import sys + import traceback + from StringIO import StringIO ++from types import FileType + import os,shutil + from test import fixture + from migrate.versioning.repository import Repository +@@ -19,7 +20,7 @@ + def execute(self,shell_cmd,runshell=None): + """A crude simulation of a shell command, to speed things up""" + # If we get an fd, the command is already done +- if isinstance(shell_cmd,file) or isinstance(shell_cmd,StringIO): ++ if isinstance(shell_cmd, FileType) or isinstance(shell_cmd, StringIO): + return shell_cmd + # Analyze the command; see if we can 'fake' the shell + try: diff --git a/python-migrate.spec b/python-migrate.spec index 2e143a3..cba6552 100644 --- a/python-migrate.spec +++ b/python-migrate.spec @@ -3,27 +3,35 @@ %define srcname sqlalchemy-migrate Name: python-migrate -Version: 0.4.5 -Release: 4%{?dist} +Version: 0.5.1 +Release: 0.1.20090122.svn479%{?dist} Summary: Schema migration tools for SQLAlchemy Group: Development/Languages License: MIT URL: http://code.google.com/p/%{srcname}/ -Source0: http://%{srcname}.googlecode.com/files/%{srcname}-%{version}.tar.gz -# Local patch to disable py.test. Needed until py.test is in Fedora. -Patch0: python-migrate-disable-pytest.patch -# Patch sent upstream to generate a script for the repository upgrade script -Patch1: python-migrate-migrate_repository.patch +# Build from a snapshot so we get this working with sqlalchemy-0.5 +# svn checkout http://sqlalchemy-migrate.googlecode.com/svn/trunk/ sqlalchemy-migrate -r479 +# cd sqlalchemy-migrate +# python setup.py sdist +# tarball is in dist/sqlalchemy-migrate-0.5.1.dev-r479.tar.gz +Source0: %{srcname}-%{version}.dev-r479.tar.gz +#Source0: http://%{srcname}.googlecode.com/files/%{srcname}-%{version}.tar.gz # Local patch to rename /usr/bin/migrate to sqlalchemy-migrate -Patch2: python-migrate-sqlalchemy-migrate.patch +Patch0: python-migrate-sqlalchemy-migrate.patch +# Sent upstream to fix a unittest failure +Patch1: python-migrate-unittests.patch +# Disable one unittest for now. In the future we want this to work +Patch2: python-migrate-disable-test_fk.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: python-devel +BuildRequires: python-sqlalchemy BuildRequires: python-setuptools-devel -Requires: python-sqlalchemy >= 0.3.10 +BuildRequires: python-nose +Requires: python-sqlalchemy >= 0.5 Requires: python-setuptools %description @@ -33,10 +41,11 @@ databases in sync as schema changes are required. It allows you to manage atabase change sets and database repository versioning. %prep -%setup -q -n %{srcname}-%{version} -%patch0 -p1 -b .pytest -%patch1 -p0 -b .repomigrate -%patch2 -p1 -b .rename +%setup -q -n %{srcname}-%{version}.dev-r479 +%patch0 -p1 -b .rename +%patch1 -p0 -b .testing +# Try removing this patch on every update +%patch2 -p1 -b .disable-test %build %{__python} setup.py build @@ -48,12 +57,9 @@ atabase change sets and database repository versioning. %clean %{__rm} -rf %{buildroot} -# Check needs py.test in order to run -#%check -#echo 'sqlite:///__tmp__' > test_db.cfg -# setuptools doesn't appear to be compatible with py.test -# %{__python} setup.py test -#%{__python} -c 'from py.test.cmdline import main; main(["test"])' +%check +echo 'sqlite:///__tmp__' > test_db.cfg +%{__python} setup.py test %files %defattr(-,root,root,-) @@ -62,6 +68,10 @@ atabase change sets and database repository versioning. %{python_sitelib}/* %changelog +* Mon Jan 26 2009 Toshio Kuratomi 0.5.1-0.1.20090122.svn479 +- Update to snapshot so that it works with sqlalchemy-0.5 +- Enable test suite + * Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.4.5-4 - Rebuild for Python 2.6 diff --git a/sources b/sources index c548878..d53144f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d4f17e2c7fcfbb7bd0df628d974c8e3e sqlalchemy-migrate-0.4.5.tar.gz +bff7f5c013497fdc7c2f79e48b6a38ad sqlalchemy-migrate-0.5.1.dev-r479.tar.gz