mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
reverted distutils its 3.1 state. All new work is now happening in disutils2, and distutils is now feature-frozen.
This commit is contained in:
parent
5db0c94072
commit
3679727939
64 changed files with 1626 additions and 1678 deletions
|
@ -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 = '/'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue