diff --git a/flask_migrate/__init__.py b/flask_migrate/__init__.py index 1d9db2e..d7be2c1 100755 --- a/flask_migrate/__init__.py +++ b/flask_migrate/__init__.py @@ -1,7 +1,10 @@ import os import argparse from flask import current_app -from flask_script import Manager +try: + from flask_script import Manager +except ImportError: + Manager = None from alembic import __version__ as __alembic_version__ from alembic.config import Config as AlembicConfig from alembic import command @@ -81,7 +84,16 @@ def get_config(self, directory, x_arg=None, opts=None): return self.call_configure_callbacks(config) -MigrateCommand = Manager(usage='Perform database migrations') +if Manager is not None: + MigrateCommand = Manager(usage='Perform database migrations') +else: + class FakeCommand(object): + def option(self, *args, **kwargs): + def decorator(f): + return f + return decorator + + MigrateCommand = FakeCommand() @MigrateCommand.option('-d', '--directory', dest='directory', default=None, diff --git a/setup.py b/setup.py index 4514206..0589217 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,9 @@ install_requires=[ 'Flask>=0.9', 'Flask-SQLAlchemy>=1.0', - 'alembic>=0.6', + 'alembic>=0.6' + ], + tests_require=[ 'Flask-Script>=0.6' ], entry_points={