]> granicus.if.org Git - python/commitdiff
Merged revisions 69342 via svnmerge from
authorTarek Ziadé <ziade.tarek@gmail.com>
Fri, 6 Feb 2009 01:18:36 +0000 (01:18 +0000)
committerTarek Ziadé <ziade.tarek@gmail.com>
Fri, 6 Feb 2009 01:18:36 +0000 (01:18 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69342 | tarek.ziade | 2009-02-06 02:15:51 +0100 (Fri, 06 Feb 2009) | 1 line

  fixed #1520877: now distutils reads Read  from the environment/Makefile
........

Lib/distutils/sysconfig.py
Lib/distutils/tests/test_sysconfig.py
Misc/NEWS

index de8c5fccd6c557a1d06e531e7b66e35ea456e5ec..386ae89b83e2420a3a7603cae902d48455ea8a79 100644 (file)
@@ -160,9 +160,9 @@ def customize_compiler(compiler):
     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']
@@ -183,6 +183,8 @@ def customize_compiler(compiler):
             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(
@@ -191,7 +193,8 @@ def customize_compiler(compiler):
             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
 
index 490410e1269ff592ea38a7dcfcd67f4359b597ad..cb802c62db6f3ecc50585ccbec5eda4984a21d9a 100644 (file)
@@ -8,6 +8,13 @@ from test.support import TESTFN
 
 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)
@@ -32,6 +39,21 @@ class SysconfigTestCase(unittest.TestCase):
         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()
index 522c520eb5143c7b956ac718caf46be5642cae31..98a7cefa1d5cb6495323ff70d1c3821908367bfe 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -155,6 +155,9 @@ Core and Builtins
 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.