diff options
author | dineshbhor <dinesh.bhor@nttdata.com> | 2016-05-26 20:04:09 +0530 |
---|---|---|
committer | dineshbhor <dinesh.bhor@nttdata.com> | 2016-05-26 20:12:25 +0530 |
commit | 9356e5e28aff46b98db9619b55dc191b6843a217 (patch) | |
tree | dcc0b68d316ad3b07926a0babb0d20629a957e32 | |
parent | fe3e08ae0b70cd94b0105a87919977ce506fe49b (diff) | |
download | sqlalchemy-migrate-9356e5e28aff46b98db9619b55dc191b6843a217.tar.gz |
Fix DeprecationWarning on setuptools >= 11.3
Python 3.4 unit test is failing because of
DeprecationWarning: Parameters to load are deprecated.
Called .resolve and .require separately on setuptools >= 11.3.
Made provision to call .resolve() method if setuptools >= 10.2
and less than 11.3 else call .load() method.
Change-Id: I5ba80edfbf6b7c8399c66f01d57c91bd02eab274
Closes-Bug: #1586060
-rw-r--r-- | migrate/versioning/util/__init__.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/migrate/versioning/util/__init__.py b/migrate/versioning/util/__init__.py index 7ad226b..55c72c9 100644 --- a/migrate/versioning/util/__init__.py +++ b/migrate/versioning/util/__init__.py @@ -33,7 +33,14 @@ def load_model(dotted_name): warnings.warn('model should be in form of module.model:User ' 'and not module.model.User', exceptions.MigrateDeprecationWarning) dotted_name = ':'.join(dotted_name.rsplit('.', 1)) - return EntryPoint.parse('x=%s' % dotted_name).load(False) + + ep = EntryPoint.parse('x=%s' % dotted_name) + if hasattr(ep, 'resolve'): + # this is available on setuptools >= 10.2 + return ep.resolve() + else: + # this causes a DeprecationWarning on setuptools >= 11.3 + return ep.load(False) else: # Assume it's already loaded. return dotted_name |