summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/unixccompiler.py
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2010-07-22 12:50:05 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2010-07-22 12:50:05 (GMT)
commit3679727939a9d25ccfe057e71e8a4b8be73d47ce (patch)
tree88326b8ec80cf57f51d2e093143e233ec4ce1be5 /Lib/distutils/unixccompiler.py
parent5db0c94072abad10c9d2df99eefd1f51eb84f2bc (diff)
downloadcpython-3679727939a9d25ccfe057e71e8a4b8be73d47ce.zip
cpython-3679727939a9d25ccfe057e71e8a4b8be73d47ce.tar.gz
cpython-3679727939a9d25ccfe057e71e8a4b8be73d47ce.tar.bz2
reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
Diffstat (limited to 'Lib/distutils/unixccompiler.py')
-rw-r--r--Lib/distutils/unixccompiler.py44
1 files changed, 20 insertions, 24 deletions
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 @@ __revision__ = "$Id$"
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 @@ from distutils.errors import \
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 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
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 @@ class UnixCCompiler(CCompiler):
# 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 @@ class UnixCCompiler(CCompiler):
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 @@ class UnixCCompiler(CCompiler):
# 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 = '/'