--- cinder-2013.1-orig/cinder/__init__.py 2012-11-22 04:22:19.000000000 -0500 +++ cinder-2013.1/cinder/__init__.py 2012-12-20 12:57:42.337489999 -0500 @@ -31,6 +31,36 @@ .. moduleauthor:: Andy Smith """ +import sys +import pkg_resources + +# If there is a conflicting non egg module, +# i.e. an older standard system module installed, +# then replace it with this requirement +def replace_dist(requirement): + try: + return pkg_resources.require(requirement) + except pkg_resources.VersionConflict: + e = sys.exc_info()[1] + dist=e.args[0] + req=e.args[1] + if dist.key == req.key and not dist.location.endswith('.egg'): + del pkg_resources.working_set.by_key[dist.key] + # We assume there is no need to adjust sys.path + # and the associated pkg_resources.working_set.entries + return pkg_resources.require(requirement) + +replace_dist("WebOb >= 1.0") +replace_dist("SQLAlchemy >= 0.6.3") +replace_dist("Routes >= 1.12.3") + +replace_dist("PasteDeploy >= 1.5.0") +# This hack is needed because replace_dist() results in +# the standard paste module path being at the start of __path__. +# TODO: See can we get pkg_resources to do the right thing directly +import paste +paste.__path__.insert(0, paste.__path__.pop(-1)) + import gettext --- cinder-2013.1-orig/bin/cinder-manage 2012-11-22 04:22:19.000000000 -0500 +++ cinder-2013.1/bin/cinder-manage 2012-12-20 12:58:01.014504835 -0500 @@ -60,9 +60,6 @@ import sys import uuid -from sqlalchemy import create_engine, MetaData, Table -from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy.orm import sessionmaker # If ../cinder/__init__.py exists, add ../ to Python search path, so that @@ -86,6 +83,10 @@ from cinder import utils from cinder import version +from sqlalchemy import create_engine, MetaData, Table +from sqlalchemy.orm import sessionmaker +from sqlalchemy.ext.declarative import declarative_base + FLAGS = flags.FLAGS --- cinder-2013.1-orig/cinder/db/sqlalchemy/migration.py 2012-11-22 04:22:19.000000000 -0500 +++ cinder-2013.1/cinder/db/sqlalchemy/migration.py 2012-12-20 12:57:44.821491814 -0500 @@ -57,7 +57,12 @@ # NOTE(jkoelker) Delay importing migrate until we are patched -from migrate import exceptions as versioning_exceptions +try: + # Try the more specific path first (migrate <= 0.6) + from migrate.versioning import exceptions as versioning_exceptions +except ImportError: + # Use the newer path (migrate >= 0.7) + from migrate import exceptions as versioning_exceptions from migrate.versioning import api as versioning_api from migrate.versioning.repository import Repository