Cleaned up use of sysconfig module a bit: don't import more names
than we actually use, and do actually use AR and SO. Run ranlib on static libraries. (Should probably have a platform-check so we don't run ranlib when it's not necessary, ie. on most modern Unices.)
This commit is contained in:
parent
b6f5adaa12
commit
1c79330e64
|
@ -20,8 +20,7 @@ __revision__ = "$Id$"
|
||||||
import string, re, os
|
import string, re, os
|
||||||
from types import *
|
from types import *
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from distutils.sysconfig import \
|
from distutils import sysconfig
|
||||||
CC, CCSHARED, CFLAGS, OPT, LDSHARED, LDFLAGS, RANLIB, AR, SO
|
|
||||||
from distutils.ccompiler import CCompiler, gen_preprocess_options, gen_lib_options
|
from distutils.ccompiler import CCompiler, gen_preprocess_options, gen_lib_options
|
||||||
|
|
||||||
# XXX Things not currently handled:
|
# XXX Things not currently handled:
|
||||||
|
@ -59,14 +58,15 @@ class UnixCCompiler (CCompiler):
|
||||||
src_extensions = [".c",".C",".cc",".cxx",".cpp"]
|
src_extensions = [".c",".C",".cc",".cxx",".cpp"]
|
||||||
obj_extension = ".o"
|
obj_extension = ".o"
|
||||||
static_lib_extension = ".a"
|
static_lib_extension = ".a"
|
||||||
shared_lib_extension = ".so"
|
shared_lib_extension = sysconfig.SO
|
||||||
static_lib_format = shared_lib_format = "lib%s%s"
|
static_lib_format = shared_lib_format = "lib%s%s"
|
||||||
|
|
||||||
# Command to create a static library: seems to be pretty consistent
|
# Command to create a static library: seems to be pretty consistent
|
||||||
# across the major Unices. Might have to move down into the
|
# across the major Unices. Might have to move down into the
|
||||||
# constructor if we need platform-specific guesswork.
|
# constructor if we need platform-specific guesswork.
|
||||||
archiver = "ar"
|
archiver = sysconfig.AR
|
||||||
archiver_options = "-cr"
|
archiver_options = "-cr"
|
||||||
|
ranlib = sysconfig.RANLIB
|
||||||
|
|
||||||
|
|
||||||
def __init__ (self,
|
def __init__ (self,
|
||||||
|
@ -90,11 +90,11 @@ class UnixCCompiler (CCompiler):
|
||||||
# UnixCCompiler!
|
# UnixCCompiler!
|
||||||
|
|
||||||
(self.cc, self.ccflags) = \
|
(self.cc, self.ccflags) = \
|
||||||
_split_command (CC + ' ' + OPT)
|
_split_command (sysconfig.CC + ' ' + sysconfig.OPT)
|
||||||
self.ccflags_shared = string.split (CCSHARED)
|
self.ccflags_shared = string.split (sysconfig.CCSHARED)
|
||||||
|
|
||||||
(self.ld_shared, self.ldflags_shared) = \
|
(self.ld_shared, self.ldflags_shared) = \
|
||||||
_split_command (LDSHARED)
|
_split_command (sysconfig.LDSHARED)
|
||||||
|
|
||||||
self.ld_exec = self.cc
|
self.ld_exec = self.cc
|
||||||
|
|
||||||
|
@ -157,6 +157,12 @@ class UnixCCompiler (CCompiler):
|
||||||
self.archiver_options,
|
self.archiver_options,
|
||||||
output_filename] +
|
output_filename] +
|
||||||
objects + self.objects)
|
objects + self.objects)
|
||||||
|
|
||||||
|
# Not many Unices required ranlib anymore -- SunOS 4.x is,
|
||||||
|
# I think the only major Unix that does. Probably should
|
||||||
|
# have some platform intelligence here to skip ranlib if
|
||||||
|
# it's not needed.
|
||||||
|
self.spawn ([self.ranlib, output_filename])
|
||||||
else:
|
else:
|
||||||
self.announce ("skipping %s (up-to-date)" % output_filename)
|
self.announce ("skipping %s (up-to-date)" % output_filename)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue