* integrate patch for Issue #14 by Kevin Dangoor

* merge CHANGELOG from bugfix_0_4_2 branch
This commit is contained in:
jan.dittberner 2008-03-04 17:59:49 +00:00
parent 426c62bfbb
commit 562052de91
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,11 @@
0.4.3
- patch by Kevin Dangoor to handle database versions as packages and ignore
their __init__.py files in version.py
0.4.2
- package name is sqlalchemy-migrate again to make pypi work
- make import of sqlalchemy's SchemaGenerator work regardless of previous imports
0.4.1 0.4.1
- setuptools patch by Kevin Dangoor - setuptools patch by Kevin Dangoor
- re-rename module to migrate - re-rename module to migrate

View File

@ -118,6 +118,10 @@ class Version(pathed.Pathed):
self.python = None self.python = None
try: try:
for script in os.listdir(path): for script in os.listdir(path):
# skip __init__.py, because we assume that it's
# just there to mark the package
if script == '__init__.py':
continue
self._add_script(os.path.join(path,script)) self._add_script(os.path.join(path,script))
except: except:
raise exceptions.InvalidVersionError(path) raise exceptions.InvalidVersionError(path)
@ -142,6 +146,11 @@ class Version(pathed.Pathed):
@classmethod @classmethod
def create(cls,path): def create(cls,path):
os.mkdir(path) os.mkdir(path)
# craete the version as a proper Python package
initfile = os.path.join(path, "__init__.py")
if not os.path.exists(initfile):
# just touch the file
open(initfile, "w").close()
try: try:
ret=cls(path) ret=cls(path)
except: except:

View File

@ -67,6 +67,11 @@ class TestVersionedRepository(fixture.Pathed):
self.assert_(not os.path.exists(self.path_script)) self.assert_(not os.path.exists(self.path_script))
# .pyc file from the committed script shouldn't exist either # .pyc file from the committed script shouldn't exist either
self.assert_(not os.path.exists(self.path_script+'c')) self.assert_(not os.path.exists(self.path_script+'c'))
version = repos.versions.version()
self.assert_(os.path.exists(os.path.join(version.path,
"%s.py" % version.version)))
self.assert_(os.path.exists(os.path.join(version.path,
"__init__.py")))
def test_version(self): def test_version(self):
"""We should correctly detect the version of a repository""" """We should correctly detect the version of a repository"""
self.script_cls.create(self.path_script) self.script_cls.create(self.path_script)

View File

@ -7,8 +7,11 @@ from migrate.versioning.repository import Repository
from migrate.versioning import shell from migrate.versioning import shell
from sqlalchemy import MetaData,Table from sqlalchemy import MetaData,Table
python_version = sys.version[0:3]
class Shell(fixture.Shell): class Shell(fixture.Shell):
_cmd=os.path.join('python shell','migrate') _cmd=os.path.join('python build', 'scripts-%s' % python_version,
'migrate')
@classmethod @classmethod
def cmd(cls,*p): def cmd(cls,*p):
p = map(lambda s: str(s),p) p = map(lambda s: str(s),p)