Kaydet (Commit) abcc3f43 authored tarafından Tarek Ziadé's avatar Tarek Ziadé

Merged revisions 73341 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73341 | tarek.ziade | 2009-06-11 10:12:20 +0200 (Thu, 11 Jun 2009) | 1 line

  Fixed #5201: now distutils.sysconfig.parse_makefile() understands '53264' in Makefiles
........
üst 015c8103
...@@ -286,11 +286,18 @@ def parse_makefile(fn, g=None): ...@@ -286,11 +286,18 @@ def parse_makefile(fn, g=None):
if m: if m:
n, v = m.group(1, 2) n, v = m.group(1, 2)
v = v.strip() v = v.strip()
if "$" in v: # `$$' is a literal `$' in make
tmpv = v.replace('$$', '')
if "$" in tmpv:
notdone[n] = v notdone[n] = v
else: else:
try: v = int(v) try:
except ValueError: pass v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v done[n] = v
# do variable interpolation here # do variable interpolation here
......
"""Tests for distutils.sysconfig.""" """Tests for distutils.sysconfig."""
import os import os
import test
import unittest import unittest
from distutils import sysconfig from distutils import sysconfig
from distutils.ccompiler import get_default_compiler from distutils.ccompiler import get_default_compiler
from distutils.tests import support from distutils.tests import support
from test.support import TESTFN from test.support import TESTFN, run_unittest
class SysconfigTestCase(support.EnvironGuard, class SysconfigTestCase(support.EnvironGuard,
unittest.TestCase): unittest.TestCase):
def setUp(self):
super(SysconfigTestCase, self).setUp()
self.makefile = None
def tearDown(self):
if self.makefile is not None:
os.unlink(self.makefile)
super(SysconfigTestCase, self).tearDown()
def test_get_config_h_filename(self): def test_get_config_h_filename(self):
config_h = sysconfig.get_config_h_filename() config_h = sysconfig.get_config_h_filename()
...@@ -56,8 +65,32 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -56,8 +65,32 @@ class SysconfigTestCase(support.EnvironGuard,
sysconfig.customize_compiler(comp) sysconfig.customize_compiler(comp)
self.assertEquals(comp.exes['archiver'], 'my_ar -arflags') self.assertEquals(comp.exes['archiver'], 'my_ar -arflags')
def test_parse_makefile_base(self):
self.makefile = TESTFN
fd = open(self.makefile, 'w')
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n')
fd.write('VAR=$OTHER\nOTHER=foo')
fd.close()
d = sysconfig.parse_makefile(self.makefile)
self.assertEquals(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'",
'OTHER': 'foo'})
def test_parse_makefile_literal_dollar(self):
self.makefile = TESTFN
fd = open(self.makefile, 'w')
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n')
fd.write('VAR=$OTHER\nOTHER=foo')
fd.close()
d = sysconfig.parse_makefile(self.makefile)
self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'",
'OTHER': 'foo'})
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(SysconfigTestCase)) suite.addTest(unittest.makeSuite(SysconfigTestCase))
return suite return suite
if __name__ == '__main__':
run_unittest(test_suite())
...@@ -772,6 +772,10 @@ Core and Builtins ...@@ -772,6 +772,10 @@ Core and Builtins
Library Library
------- -------
- Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$`
in Makefiles. This prevents compile errors when using syntax like:
`LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe.
- Issue #6131: test_modulefinder leaked when run after test_distutils. - Issue #6131: test_modulefinder leaked when run after test_distutils.
Patch by Hirokazu Yamamoto. Patch by Hirokazu Yamamoto.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment