From: Mike Bayer Date: Mon, 11 Feb 2013 22:19:42 +0000 (-0500) Subject: - repair argspec to work with py3k also X-Git-Tag: rel_0_5_0~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f00338eadb26f476ccbd947c677cc26784711379;p=thirdparty%2Fsqlalchemy%2Falembic.git - repair argspec to work with py3k also - relying upon SQLA argspec compat here, so let's also bump compatibility to 0.7.3, as 0.6 is working poorly in any case --- diff --git a/alembic/command.py b/alembic/command.py index b3341472..0ed98435 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -1,6 +1,6 @@ from alembic.script import ScriptDirectory from alembic.environment import EnvironmentContext -from alembic import util, ddl, autogenerate as autogen +from alembic import util, autogenerate as autogen import os def list_templates(config): @@ -76,7 +76,6 @@ def revision(config, message=None, autogenerate=False, sql=False): if autogenerate: environment = True - util.requires_07("autogenerate") def retrieve_migrations(rev, context): if script.get_revision(rev) is not script.get_revision("head"): raise util.CommandError("Target database is not up to date.") diff --git a/alembic/util.py b/alembic/util.py index 6d7caf08..7f06f4af 100644 --- a/alembic/util.py +++ b/alembic/util.py @@ -10,7 +10,6 @@ import warnings import re import inspect import uuid -from sqlalchemy.util import format_argspec_plus, update_wrapper class CommandError(Exception): pass @@ -22,21 +21,15 @@ def _safe_int(value): except: return value _vers = tuple([_safe_int(x) for x in re.findall(r'(\d+|[abc]\d)', __version__)]) -sqla_06 = _vers > (0, 6) -sqla_07 = _vers > (0, 7) +sqla_07 = _vers > (0, 7, 2) sqla_08 = _vers >= (0, 8, 0, 'b2') -if not sqla_06: +if not sqla_07: raise CommandError( - "SQLAlchemy 0.6 or greater is required. " - "Version 0.7 or above required for full featureset.") - -def requires_07(feature): - if not sqla_07: - raise CommandError( - "The %s feature requires " - "SQLAlchemy 0.7 or greater." - % feature - ) + "SQLAlchemy 0.7.3 or greater is required. ") + +from sqlalchemy.util import format_argspec_plus, update_wrapper +from sqlalchemy.util.compat import inspect_getfullargspec + try: width = int(os.environ['COLUMNS']) except (KeyError, ValueError): @@ -85,7 +78,7 @@ def create_module_class_proxy(cls, globals_, locals_): num_defaults += len(spec[3]) name_args = spec[0] if num_defaults: - defaulted_vals = name_args[0-num_defaults:] + defaulted_vals = name_args[0 - num_defaults:] else: defaulted_vals = () @@ -114,10 +107,10 @@ def create_module_class_proxy(cls, globals_, locals_): return _proxy.%(name)s(%(apply_kw)s) e """ % { - 'name':name, - 'args':args[1:-1], - 'apply_kw':apply_kw[1:-1], - 'doc':fn.__doc__, + 'name': name, + 'args': args[1:-1], + 'apply_kw': apply_kw[1:-1], + 'doc': fn.__doc__, }) lcl = {} exec func_text in globals_, lcl @@ -173,7 +166,7 @@ def msg(msg, newline=True): lines = textwrap.wrap(msg, width) if len(lines) > 1: for line in lines[0:-1]: - sys.stdout.write(" " +line + "\n") + sys.stdout.write(" " + line + "\n") sys.stdout.write(" " + lines[-1] + ("\n" if newline else "")) def load_python_file(dir_, filename): @@ -256,7 +249,8 @@ class immutabledict(dict): def _with_legacy_names(translations): def decorate(fn): - spec = inspect.getargspec(fn) + + spec = inspect_getfullargspec(fn) metadata = dict(target='target', fn='fn') metadata.update(format_argspec_plus(spec, grouped=False)) diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index 8e52544f..15e57ddb 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -6,6 +6,12 @@ Changelog .. changelog:: :version: 0.5.0 + .. change:: + :tags: change + + SQLAlchemy 0.6 is no longer supported by Alembic - minimum version is 0.7.3, + full support is as of 0.7.9. + .. change:: :tags: bug :tickets: 104 diff --git a/docs/build/front.rst b/docs/build/front.rst index c595ea4a..71444a38 100644 --- a/docs/build/front.rst +++ b/docs/build/front.rst @@ -48,8 +48,11 @@ Dependencies Alembic's install process will ensure that `SQLAlchemy `_ is installed, in addition to other dependencies. Alembic will work with -SQLAlchemy as of version **0.6**, though with a limited featureset. -The latest version of SQLAlchemy within the **0.7** or **0.8** series is strongly recommended. +SQLAlchemy as of version **0.7.3**. The latest version of SQLAlchemy within +the **0.7** or **0.8** series is strongly recommended. + +.. versionchanged:: 0.5.0 + Support for SQLAlchemy 0.6 has been dropped. Community