Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Fix DeprecationWarning on setuptools >= 11.3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dineshbhor committed May 26, 2016
1 parent fe3e08a commit 9356e5e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion migrate/versioning/util/__init__.py
Expand Up @@ -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
Expand Down

0 comments on commit 9356e5e

Please sign in to comment.