From e30c3b9138605a16386a3e67d233b72cbbcfc5e8 Mon Sep 17 00:00:00 2001 From: Jeff Dairiki Date: Thu, 22 Jan 2015 11:01:32 -0800 Subject: Prevent DeprecationWarning from setuptools>=11.3 --- CHANGES.txt | 3 +++ pyramid/path.py | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b334f5258..a7138db1a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -125,6 +125,9 @@ Bug Fixes callback and thus behave just like the ``pyramid.renderers.JSON` renderer. See https://github.com/Pylons/pyramid/pull/1561 +- Prevent "parameters to load are deprecated" ``DeprecationWarning`` + from setuptools>=11.3. + Deprecations ------------ diff --git a/pyramid/path.py b/pyramid/path.py index 470e766f8..8eecc282b 100644 --- a/pyramid/path.py +++ b/pyramid/path.py @@ -337,8 +337,13 @@ class DottedNameResolver(Resolver): value = package.__name__ else: value = package.__name__ + value - return pkg_resources.EntryPoint.parse( - 'x=%s' % value).load(False) + # Calling EntryPoint.load with an argument is deprecated. + # See https://pythonhosted.org/setuptools/history.html#id8 + ep = pkg_resources.EntryPoint.parse('x=%s' % value) + if hasattr(ep, 'resolve'): + return ep.resolve() # setuptools>=10.2 + else: + return ep.load(False) def _zope_dottedname_style(self, value, package): """ package.module.attr style """ -- cgit v1.2.3