- fix version number in docs here
- add py3.3 compat, other compat to remove all warnings
This commit is contained in:
@@ -4,6 +4,7 @@ if sys.version_info < (2, 6):
|
||||
raise NotImplementedError("Python 2.6 or greater is required.")
|
||||
|
||||
py3k = sys.version_info >= (3, 0)
|
||||
py33 = sys.version_info >= (3, 3)
|
||||
|
||||
if py3k:
|
||||
import builtins as compat_builtins
|
||||
@@ -19,12 +20,27 @@ else:
|
||||
text_type = unicode
|
||||
callable = callable
|
||||
|
||||
|
||||
try:
|
||||
if py3k:
|
||||
from configparser import ConfigParser as SafeConfigParser
|
||||
import configparser
|
||||
except ImportError:
|
||||
else:
|
||||
from ConfigParser import SafeConfigParser
|
||||
import ConfigParser as configparser
|
||||
|
||||
if py33:
|
||||
from importlib import machinery
|
||||
def load_module(module_id, path):
|
||||
return machinery.SourceFileLoader(module_id, path).load_module()
|
||||
else:
|
||||
import imp
|
||||
def load_module(module_id, path):
|
||||
fp = open(path, 'rb')
|
||||
try:
|
||||
return imp.load_source(module_id, path, fp)
|
||||
finally:
|
||||
fp.close()
|
||||
|
||||
|
||||
try:
|
||||
exec_ = getattr(compat_builtins, 'exec')
|
||||
except AttributeError:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from argparse import ArgumentParser
|
||||
from .compat import configparser
|
||||
from .compat import SafeConfigParser
|
||||
import inspect
|
||||
import os
|
||||
import sys
|
||||
@@ -91,7 +91,7 @@ class Config(object):
|
||||
here = os.path.abspath(os.path.dirname(self.config_file_name))
|
||||
else:
|
||||
here = ""
|
||||
file_config = configparser.SafeConfigParser({'here': here})
|
||||
file_config = SafeConfigParser({'here': here})
|
||||
if self.config_file_name:
|
||||
file_config.read([self.config_file_name])
|
||||
else:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
import os
|
||||
import textwrap
|
||||
import imp
|
||||
import warnings
|
||||
import re
|
||||
import inspect
|
||||
@@ -11,7 +10,7 @@ from mako.template import Template
|
||||
from sqlalchemy.engine import url
|
||||
from sqlalchemy import __version__
|
||||
|
||||
from .compat import callable, exec_
|
||||
from .compat import callable, exec_, load_module
|
||||
|
||||
class CommandError(Exception):
|
||||
pass
|
||||
@@ -175,8 +174,7 @@ def load_python_file(dir_, filename):
|
||||
|
||||
module_id = re.sub(r'\W', "_", filename)
|
||||
path = os.path.join(dir_, filename)
|
||||
with open(path, 'rb') as f:
|
||||
module = imp.load_source(module_id, path, f)
|
||||
module = load_module(module_id, path)
|
||||
del sys.modules[module_id]
|
||||
return module
|
||||
|
||||
@@ -246,9 +244,6 @@ class immutabledict(dict):
|
||||
return "immutabledict(%s)" % dict.__repr__(self)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def _with_legacy_names(translations):
|
||||
def decorate(fn):
|
||||
|
||||
|
||||
4
docs/build/tutorial.rst
vendored
4
docs/build/tutorial.rst
vendored
@@ -421,12 +421,10 @@ View all revisions from 1975 to the head::
|
||||
|
||||
$ alembic history -r1975ea:
|
||||
|
||||
.. versionadded:: 0.6.1 ``alembic revision`` now accepts the ``-r`` argument to
|
||||
.. versionadded:: 0.6.0 ``alembic revision`` now accepts the ``-r`` argument to
|
||||
specify specific ranges based on version numbers, symbols, or relative deltas.
|
||||
|
||||
|
||||
|
||||
|
||||
Downgrading
|
||||
===========
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ down_revision = ${repr(down_revision)}
|
||||
command.revision(self.cfg, message="some rev")
|
||||
script = ScriptDirectory.from_config(self.cfg)
|
||||
rev = script.get_revision('head')
|
||||
text = open(rev.path).read()
|
||||
with open(rev.path) as f:
|
||||
text = f.read()
|
||||
assert "somearg: somevalue" in text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user