Skip to content

Commit

Permalink
Remove the Flask-Script dependency in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Jul 28, 2017
1 parent 24fd997 commit 7bd5ef8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 14 additions & 2 deletions flask_migrate/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down

0 comments on commit 7bd5ef8

Please sign in to comment.