varies across Unices and is stored in Python's Makefile.
"""
if compiler.compiler_type == "unix":
- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \
+ (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar) = \
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
- 'CCSHARED', 'LDSHARED', 'SO')
+ 'CCSHARED', 'LDSHARED', 'SO', 'AR')
if 'CC' in os.environ:
cc = os.environ['CC']
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
+ if 'AR' in os.environ:
+ ar = os.environ['AR']
cc_cmd = cc + ' ' + cflags
compiler.set_executables(
compiler_so=cc_cmd + ' ' + ccshared,
compiler_cxx=cxx,
linker_so=ldshared,
- linker_exe=cc)
+ linker_exe=cc,
+ archiver=ar)
compiler.shared_lib_extension = so_ext
class SysconfigTestCase(unittest.TestCase):
+ def setUp(self):
+ self.old_AR = os.environ.get('AR')
+
+ def tearDown(self):
+ if self.old_AR is not None:
+ os.environ['AR'] = self.old_AR
+
def test_get_config_h_filename(self):
config_h = sysconfig.get_config_h_filename()
self.assert_(os.path.isfile(config_h), config_h)
self.assert_(isinstance(cvars, dict))
self.assert_(cvars)
+ def test_customize_compiler(self):
+
+ os.environ['AR'] = 'xxx'
+
+ # make sure AR gets caught
+ class compiler:
+ compiler_type = 'unix'
+
+ def set_executables(self, **kw):
+ self.exes = kw
+
+ comp = compiler()
+ sysconfig.customize_compiler(comp)
+ self.assertEquals(comp.exes['archiver'], 'xxx')
+
def test_suite():
suite = unittest.TestSuite()
Library
-------
+- Issue #1520877: Now distutils.sysconfig reads $AR from the
+ environment/Makefile. Patch by Douglas Greiman.
+
- Issue #1276768: The verbose option was not used in the code of
distutils.file_util and distutils.dir_util.