summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--migrate/versioning/util/__init__.py9
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