[Python-checkins] cpython: Issue # 17177: Stop using imp in setup.py

brett.cannon python-checkins at python.org
Sat Jun 15 23:53:08 CEST 2013


http://hg.python.org/cpython/rev/4a1161eaed99
changeset:   84157:4a1161eaed99
user:        Brett Cannon <brett at python.org>
date:        Sat Jun 15 17:52:59 2013 -0400
summary:
  Issue # 17177: Stop using imp in setup.py

files:
  setup.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 # Autodetecting setup.py script for building the Python extensions
 #
 
-import sys, os, imp, re, optparse
+import sys, os, importlib.machinery, re, optparse
 from glob import glob
 import sysconfig
 
@@ -325,8 +325,9 @@
         if cross_compiling:
             return
 
+        loader = importlib.machinery.ExtensionFileLoader(ext.name, ext_filename)
         try:
-            imp.load_dynamic(ext.name, ext_filename)
+            loader.load_module()
         except ImportError as why:
             self.failed.append(ext.name)
             self.announce('*** WARNING: renaming "%s" since importing it'

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list