reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index 0817908..bf73416 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -17,6 +17,7 @@
import os, sys, re
+from distutils import sysconfig
from distutils.dep_util import newer
from distutils.ccompiler import \
CCompiler, gen_preprocess_options, gen_lib_options
@@ -24,7 +25,6 @@
DistutilsExecError, CompileError, LibError, LinkError
from distutils import log
-
# XXX Things not currently handled:
# * optimization/debug/warning flags; we just use whatever's in Python's
# Makefile and live with it. Is this adequate? If not, we might
@@ -74,7 +74,7 @@
if 'ARCHFLAGS' in os.environ and not stripArch:
# User specified different -arch flags in the environ,
- # see also the sysconfig
+ # see also distutils.sysconfig
compiler_so = compiler_so + os.environ['ARCHFLAGS'].split()
if stripSysroot:
@@ -281,9 +281,7 @@
# this time, there's no way to determine this information from
# the configuration data stored in the Python installation, so
# we use this hack.
- _sysconfig = __import__('sysconfig')
-
- compiler = os.path.basename(_sysconfig.get_config_var("CC"))
+ compiler = os.path.basename(sysconfig.get_config_var("CC"))
if sys.platform[:6] == "darwin":
# MacOSX's linker doesn't understand the -R flag at all
return "-L" + dir
@@ -293,24 +291,23 @@
return ["+s", "-L" + dir]
elif sys.platform[:7] == "irix646" or sys.platform[:6] == "osf1V5":
return ["-rpath", dir]
- elif self._is_gcc(compiler):
- # gcc on non-GNU systems does not need -Wl, but can
- # use it anyway. Since distutils has always passed in
- # -Wl whenever gcc was used in the past it is probably
- # safest to keep doing so.
- if _sysconfig.get_config_var("GNULD") == "yes":
- # GNU ld needs an extra option to get a RUNPATH
- # instead of just an RPATH.
- return "-Wl,--enable-new-dtags,-R" + dir
- else:
- return "-Wl,-R" + dir
- elif sys.platform[:3] == "aix":
- return "-blibpath:" + dir
else:
- # No idea how --enable-new-dtags would be passed on to
- # ld if this system was using GNU ld. Don't know if a
- # system like this even exists.
- return "-R" + dir
+ if self._is_gcc(compiler):
+ # gcc on non-GNU systems does not need -Wl, but can
+ # use it anyway. Since distutils has always passed in
+ # -Wl whenever gcc was used in the past it is probably
+ # safest to keep doing so.
+ if sysconfig.get_config_var("GNULD") == "yes":
+ # GNU ld needs an extra option to get a RUNPATH
+ # instead of just an RPATH.
+ return "-Wl,--enable-new-dtags,-R" + dir
+ else:
+ return "-Wl,-R" + dir
+ else:
+ # No idea how --enable-new-dtags would be passed on to
+ # ld if this system was using GNU ld. Don't know if a
+ # system like this even exists.
+ return "-R" + dir
def library_option(self, lib):
return "-l" + lib
@@ -324,8 +321,7 @@
# On OSX users can specify an alternate SDK using
# '-isysroot', calculate the SDK root if it is specified
# (and use it further on)
- _sysconfig = __import__('sysconfig')
- cflags = _sysconfig.get_config_var('CFLAGS')
+ cflags = sysconfig.get_config_var('CFLAGS')
m = re.search(r'-isysroot\s+(\S+)', cflags)
if m is None:
sysroot = '/'