Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3409de

Browse files
author
Tarek Ziadé
committed
Merged revisions 69342 via svnmerge from
svn+ssh://[email protected]/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 ........
1 parent 35e6fd5 commit d3409de

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

Lib/distutils/sysconfig.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ def customize_compiler(compiler):
160160
varies across Unices and is stored in Python's Makefile.
161161
"""
162162
if compiler.compiler_type == "unix":
163-
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \
163+
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar) = \
164164
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
165-
'CCSHARED', 'LDSHARED', 'SO')
165+
'CCSHARED', 'LDSHARED', 'SO', 'AR')
166166

167167
if 'CC' in os.environ:
168168
cc = os.environ['CC']
@@ -183,6 +183,8 @@ def customize_compiler(compiler):
183183
cpp = cpp + ' ' + os.environ['CPPFLAGS']
184184
cflags = cflags + ' ' + os.environ['CPPFLAGS']
185185
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
186+
if 'AR' in os.environ:
187+
ar = os.environ['AR']
186188

187189
cc_cmd = cc + ' ' + cflags
188190
compiler.set_executables(
@@ -191,7 +193,8 @@ def customize_compiler(compiler):
191193
compiler_so=cc_cmd + ' ' + ccshared,
192194
compiler_cxx=cxx,
193195
linker_so=ldshared,
194-
linker_exe=cc)
196+
linker_exe=cc,
197+
archiver=ar)
195198

196199
compiler.shared_lib_extension = so_ext
197200

Lib/distutils/tests/test_sysconfig.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
class SysconfigTestCase(unittest.TestCase):
1010

11+
def setUp(self):
12+
self.old_AR = os.environ.get('AR')
13+
14+
def tearDown(self):
15+
if self.old_AR is not None:
16+
os.environ['AR'] = self.old_AR
17+
1118
def test_get_config_h_filename(self):
1219
config_h = sysconfig.get_config_h_filename()
1320
self.assert_(os.path.isfile(config_h), config_h)
@@ -32,6 +39,21 @@ def test_get_config_vars(self):
3239
self.assert_(isinstance(cvars, dict))
3340
self.assert_(cvars)
3441

42+
def test_customize_compiler(self):
43+
44+
os.environ['AR'] = 'xxx'
45+
46+
# make sure AR gets caught
47+
class compiler:
48+
compiler_type = 'unix'
49+
50+
def set_executables(self, **kw):
51+
self.exes = kw
52+
53+
comp = compiler()
54+
sysconfig.customize_compiler(comp)
55+
self.assertEquals(comp.exes['archiver'], 'xxx')
56+
3557

3658
def test_suite():
3759
suite = unittest.TestSuite()

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ Core and Builtins
155155
Library
156156
-------
157157

158+
- Issue #1520877: Now distutils.sysconfig reads $AR from the
159+
environment/Makefile. Patch by Douglas Greiman.
160+
158161
- Issue #1276768: The verbose option was not used in the code of
159162
distutils.file_util and distutils.dir_util.
160163

0 commit comments

Comments
 (0)