From 72269fbfa1207273486fc03c0b31c6a767fa24d0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 19 Apr 2011 11:28:54 -0400 Subject: [PATCH] do "find the templates" identically to how sphinx does it --- alembic/__init__.py | 2 ++ alembic/config.py | 6 ++---- {templates => alembic/templates}/generic/README | 0 {templates => alembic/templates}/generic/alembic.ini.mako | 0 {templates => alembic/templates}/generic/env.py | 0 {templates => alembic/templates}/generic/script.py.mako | 0 {templates => alembic/templates}/multidb/README | 0 {templates => alembic/templates}/multidb/alembic.ini.mako | 0 {templates => alembic/templates}/multidb/env.py | 0 {templates => alembic/templates}/multidb/script.py.mako | 0 {templates => alembic/templates}/pylons/README | 0 {templates => alembic/templates}/pylons/alembic.ini.mako | 0 {templates => alembic/templates}/pylons/env.py | 0 {templates => alembic/templates}/pylons/script.py.mako | 0 14 files changed, 4 insertions(+), 4 deletions(-) rename {templates => alembic/templates}/generic/README (100%) rename {templates => alembic/templates}/generic/alembic.ini.mako (100%) rename {templates => alembic/templates}/generic/env.py (100%) rename {templates => alembic/templates}/generic/script.py.mako (100%) rename {templates => alembic/templates}/multidb/README (100%) rename {templates => alembic/templates}/multidb/alembic.ini.mako (100%) rename {templates => alembic/templates}/multidb/env.py (100%) rename {templates => alembic/templates}/multidb/script.py.mako (100%) rename {templates => alembic/templates}/pylons/README (100%) rename {templates => alembic/templates}/pylons/alembic.ini.mako (100%) rename {templates => alembic/templates}/pylons/env.py (100%) rename {templates => alembic/templates}/pylons/script.py.mako (100%) diff --git a/alembic/__init__.py b/alembic/__init__.py index f18873d..9c52e02 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 e713b04..a8c2614 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