[Python-checkins] cpython (merge default -> default): merge

christian.heimes python-checkins at python.org
Fri Nov 22 01:18:05 CET 2013


http://hg.python.org/cpython/rev/392212768451
changeset:   87328:392212768451
parent:      87327:a0ec33b83ba4
parent:      87326:f0090ff52128
user:        Christian Heimes <christian at cheimes.de>
date:        Fri Nov 22 01:17:34 2013 +0100
summary:
  merge

files:
  Lib/sysconfig.py           |   7 +++++++
  Lib/test/test_sysconfig.py |  19 +++++++++++++++++++
  Misc/NEWS                  |   3 +++
  3 files changed, 29 insertions(+), 0 deletions(-)


diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -409,6 +409,10 @@
     # _sysconfigdata is generated at build time, see _generate_posix_vars()
     from _sysconfigdata import build_time_vars
     vars.update(build_time_vars)
+    # For backward compatibility, see issue19555
+    SO = build_time_vars.get('EXT_SUFFIX')
+    if SO is not None:
+        vars['SO'] = SO
 
 def _init_non_posix(vars):
     """Initialize the module as appropriate for NT"""
@@ -579,6 +583,9 @@
 
     Equivalent to get_config_vars().get(name)
     """
+    if name == 'SO':
+        import warnings
+        warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning)
     return get_config_vars().get(name)
 
 
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -369,6 +369,25 @@
             os.chdir(cwd)
         self.assertEqual(srcdir, srcdir2)
 
+    @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
+                     'EXT_SUFFIX required for this test')
+    def test_SO_deprecation(self):
+        self.assertWarns(DeprecationWarning,
+                         sysconfig.get_config_var, 'SO')
+
+    @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
+                     'EXT_SUFFIX required for this test')
+    def test_SO_value(self):
+        self.assertEqual(sysconfig.get_config_var('SO'),
+                         sysconfig.get_config_var('EXT_SUFFIX'))
+
+    @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
+                     'EXT_SUFFIX required for this test')
+    def test_SO_in_vars(self):
+        vars = sysconfig.get_config_vars()
+        self.assertIsNotNone(vars['SO'])
+        self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
+
 
 class MakefileTests(unittest.TestCase):
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -59,6 +59,9 @@
 Library
 -------
 
+- Issue #19555: Restore sysconfig.get_config_var('SO'), with a
+  DeprecationWarning pointing people at $EXT_SUFFIX.
+
 - Issue #8813: Add SSLContext.verify_flags to change the verification flags
   of the context in order to enable certification revocation list (CRL)
   checks or strict X509 rules.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list