فهرست منبع

Fix DeprecationWarning on setuptools >= 11.3. Closes #617

Mike Naberezny 9 سال پیش
والد
کامیت
eeb306e0bc
2فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 3 0
      CHANGES.txt
  2. 7 1
      supervisor/options.py

+ 3 - 0
CHANGES.txt

@@ -76,6 +76,9 @@
   Previously, they were logged at the ``TRACE`` level and easily
   missed.  Thanks to Thomas Güttler for reporting this issue.
 
+- Fixed ``DeprecationWarning: Parameters to load are deprecated. Call
+  .resolve and .require separately.`` on setuptools >= 11.3.
+
 3.1.3 (2014-10-28)
 ------------------
 

+ 7 - 1
supervisor/options.py

@@ -396,7 +396,13 @@ class Options:
         return factories
 
     def import_spec(self, spec):
-        return pkg_resources.EntryPoint.parse("x="+spec).load(False)
+        ep = pkg_resources.EntryPoint.parse("x=" + spec)
+        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)
 
 
 class ServerOptions(Options):