From 1c79330e64e0f3f73bbfe9f0504425520ec44dff Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Fri, 14 Apr 2000 00:48:15 +0000 Subject: [PATCH] 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.) --- Lib/distutils/unixccompiler.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index ec766f54053..0944461b9ab 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -20,8 +20,7 @@ __revision__ = "$Id$" import string, re, os from types import * from copy import copy -from distutils.sysconfig import \ - CC, CCSHARED, CFLAGS, OPT, LDSHARED, LDFLAGS, RANLIB, AR, SO +from distutils import sysconfig from distutils.ccompiler import CCompiler, gen_preprocess_options, gen_lib_options # XXX Things not currently handled: @@ -59,14 +58,15 @@ class UnixCCompiler (CCompiler): src_extensions = [".c",".C",".cc",".cxx",".cpp"] obj_extension = ".o" static_lib_extension = ".a" - shared_lib_extension = ".so" + shared_lib_extension = sysconfig.SO static_lib_format = shared_lib_format = "lib%s%s" # Command to create a static library: seems to be pretty consistent # across the major Unices. Might have to move down into the # constructor if we need platform-specific guesswork. - archiver = "ar" + archiver = sysconfig.AR archiver_options = "-cr" + ranlib = sysconfig.RANLIB def __init__ (self, @@ -90,11 +90,11 @@ class UnixCCompiler (CCompiler): # UnixCCompiler! (self.cc, self.ccflags) = \ - _split_command (CC + ' ' + OPT) - self.ccflags_shared = string.split (CCSHARED) + _split_command (sysconfig.CC + ' ' + sysconfig.OPT) + self.ccflags_shared = string.split (sysconfig.CCSHARED) (self.ld_shared, self.ldflags_shared) = \ - _split_command (LDSHARED) + _split_command (sysconfig.LDSHARED) self.ld_exec = self.cc @@ -157,6 +157,12 @@ class UnixCCompiler (CCompiler): self.archiver_options, output_filename] + 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: self.announce ("skipping %s (up-to-date)" % output_filename)