From: Mike Bayer Date: Tue, 19 Apr 2011 15:28:54 +0000 (-0400) Subject: do "find the templates" identically to how sphinx does it X-Git-Tag: rel_0_1_0~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72269fbfa1207273486fc03c0b31c6a767fa24d0;p=thirdparty%2Fsqlalchemy%2Falembic.git do "find the templates" identically to how sphinx does it --- diff --git a/alembic/__init__.py b/alembic/__init__.py index f18873da..9c52e029 100644 --- a/alembic/__init__.py +++ b/alembic/__init__.py @@ -1,4 +1,6 @@ +from os import path __version__ = '0.1alpha' +package_dir = path.abspath(path.dirname(__file__)) diff --git a/alembic/config.py b/alembic/config.py index e713b047..a8c26148 100644 --- a/alembic/config.py +++ b/alembic/config.py @@ -1,4 +1,4 @@ -from alembic import command, util +from alembic import command, util, package_dir from argparse import ArgumentParser import ConfigParser import inspect @@ -15,9 +15,7 @@ class Config(object): return file_config def get_template_directory(self): - # TODO: what's the official way to get at - # setuptools-installed datafiles ? - return os.path.join(os.path.dirname(__file__), '..', 'templates') + return os.path.join(package_dir, 'templates') def get_section(self, name): return dict(self.file_config.items(name)) diff --git a/templates/generic/README b/alembic/templates/generic/README similarity index 100% rename from templates/generic/README rename to alembic/templates/generic/README diff --git a/templates/generic/alembic.ini.mako b/alembic/templates/generic/alembic.ini.mako similarity index 100% rename from templates/generic/alembic.ini.mako rename to alembic/templates/generic/alembic.ini.mako diff --git a/templates/generic/env.py b/alembic/templates/generic/env.py similarity index 100% rename from templates/generic/env.py rename to alembic/templates/generic/env.py diff --git a/templates/generic/script.py.mako b/alembic/templates/generic/script.py.mako similarity index 100% rename from templates/generic/script.py.mako rename to alembic/templates/generic/script.py.mako diff --git a/templates/multidb/README b/alembic/templates/multidb/README similarity index 100% rename from templates/multidb/README rename to alembic/templates/multidb/README diff --git a/templates/multidb/alembic.ini.mako b/alembic/templates/multidb/alembic.ini.mako similarity index 100% rename from templates/multidb/alembic.ini.mako rename to alembic/templates/multidb/alembic.ini.mako diff --git a/templates/multidb/env.py b/alembic/templates/multidb/env.py similarity index 100% rename from templates/multidb/env.py rename to alembic/templates/multidb/env.py diff --git a/templates/multidb/script.py.mako b/alembic/templates/multidb/script.py.mako similarity index 100% rename from templates/multidb/script.py.mako rename to alembic/templates/multidb/script.py.mako diff --git a/templates/pylons/README b/alembic/templates/pylons/README similarity index 100% rename from templates/pylons/README rename to alembic/templates/pylons/README diff --git a/templates/pylons/alembic.ini.mako b/alembic/templates/pylons/alembic.ini.mako similarity index 100% rename from templates/pylons/alembic.ini.mako rename to alembic/templates/pylons/alembic.ini.mako diff --git a/templates/pylons/env.py b/alembic/templates/pylons/env.py similarity index 100% rename from templates/pylons/env.py rename to alembic/templates/pylons/env.py diff --git a/templates/pylons/script.py.mako b/alembic/templates/pylons/script.py.mako similarity index 100% rename from templates/pylons/script.py.mako rename to alembic/templates/pylons/script.py.mako