Commit 9121f8d9 authored by Barry Warsaw's avatar Barry Warsaw

Issue 19555 for distutils, plus a little clean up (pyflakes, line lengths).

parent aa407758
...@@ -518,6 +518,11 @@ def get_config_vars(*args): ...@@ -518,6 +518,11 @@ def get_config_vars(*args):
_config_vars['prefix'] = PREFIX _config_vars['prefix'] = PREFIX
_config_vars['exec_prefix'] = EXEC_PREFIX _config_vars['exec_prefix'] = EXEC_PREFIX
# For backward compatibility, see issue19555
SO = _config_vars.get('EXT_SUFFIX')
if SO is not None:
_config_vars['SO'] = SO
# Always convert srcdir to an absolute path # Always convert srcdir to an absolute path
srcdir = _config_vars.get('srcdir', project_base) srcdir = _config_vars.get('srcdir', project_base)
if os.name == 'posix': if os.name == 'posix':
...@@ -568,4 +573,7 @@ def get_config_var(name): ...@@ -568,4 +573,7 @@ def get_config_var(name):
returned by 'get_config_vars()'. Equivalent to returned by 'get_config_vars()'. Equivalent to
get_config_vars().get(name) 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) return get_config_vars().get(name)
"""Tests for distutils.sysconfig.""" """Tests for distutils.sysconfig."""
import os import os
import shutil import shutil
import test
import unittest import unittest
from distutils import sysconfig from distutils import sysconfig
...@@ -9,8 +8,7 @@ from distutils.ccompiler import get_default_compiler ...@@ -9,8 +8,7 @@ from distutils.ccompiler import get_default_compiler
from distutils.tests import support from distutils.tests import support
from test.support import TESTFN, run_unittest from test.support import TESTFN, run_unittest
class SysconfigTestCase(support.EnvironGuard, class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
unittest.TestCase):
def setUp(self): def setUp(self):
super(SysconfigTestCase, self).setUp() super(SysconfigTestCase, self).setUp()
self.makefile = None self.makefile = None
...@@ -32,7 +30,6 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -32,7 +30,6 @@ class SysconfigTestCase(support.EnvironGuard,
self.assertTrue(os.path.isfile(config_h), config_h) self.assertTrue(os.path.isfile(config_h), config_h)
def test_get_python_lib(self): def test_get_python_lib(self):
lib_dir = sysconfig.get_python_lib()
# XXX doesn't work on Linux when Python was never installed before # XXX doesn't work on Linux when Python was never installed before
#self.assertTrue(os.path.isdir(lib_dir), lib_dir) #self.assertTrue(os.path.isdir(lib_dir), lib_dir)
# test for pythonxx.lib? # test for pythonxx.lib?
...@@ -67,7 +64,8 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -67,7 +64,8 @@ class SysconfigTestCase(support.EnvironGuard,
self.assertTrue(os.path.exists(Python_h), Python_h) self.assertTrue(os.path.exists(Python_h), Python_h)
self.assertTrue(sysconfig._is_python_source_dir(srcdir)) self.assertTrue(sysconfig._is_python_source_dir(srcdir))
elif os.name == 'posix': elif os.name == 'posix':
self.assertEqual(os.path.dirname(sysconfig.get_makefile_filename()), self.assertEqual(
os.path.dirname(sysconfig.get_makefile_filename()),
srcdir) srcdir)
def test_srcdir_independent_of_cwd(self): def test_srcdir_independent_of_cwd(self):
...@@ -129,10 +127,13 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -129,10 +127,13 @@ class SysconfigTestCase(support.EnvironGuard,
def test_sysconfig_module(self): def test_sysconfig_module(self):
import sysconfig as global_sysconfig import sysconfig as global_sysconfig
self.assertEqual(global_sysconfig.get_config_var('CFLAGS'), sysconfig.get_config_var('CFLAGS')) self.assertEqual(global_sysconfig.get_config_var('CFLAGS'),
self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'), sysconfig.get_config_var('LDFLAGS')) sysconfig.get_config_var('CFLAGS'))
self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'),
sysconfig.get_config_var('LDFLAGS'))
@unittest.skipIf(sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'),'compiler flags customized') @unittest.skipIf(sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'),
'compiler flags customized')
def test_sysconfig_compiler_vars(self): def test_sysconfig_compiler_vars(self):
# On OS X, binary installers support extension module building on # On OS X, binary installers support extension module building on
# various levels of the operating system with differing Xcode # various levels of the operating system with differing Xcode
...@@ -151,9 +152,29 @@ class SysconfigTestCase(support.EnvironGuard, ...@@ -151,9 +152,29 @@ class SysconfigTestCase(support.EnvironGuard,
import sysconfig as global_sysconfig import sysconfig as global_sysconfig
if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'): if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'):
return return
self.assertEqual(global_sysconfig.get_config_var('LDSHARED'), sysconfig.get_config_var('LDSHARED')) self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),
self.assertEqual(global_sysconfig.get_config_var('CC'), sysconfig.get_config_var('CC')) sysconfig.get_config_var('LDSHARED'))
self.assertEqual(global_sysconfig.get_config_var('CC'),
sysconfig.get_config_var('CC'))
@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'])
def test_suite(): def test_suite():
......
...@@ -10,7 +10,8 @@ Projected release date: 2013-11-24 ...@@ -10,7 +10,8 @@ Projected release date: 2013-11-24
Core and Builtins Core and Builtins
----------------- -----------------
- Use the repr of a module name in more places in import, especially exceptions. - Use the repr of a module name in more places in import, especially
exceptions.
- Issue #19619: str.encode, bytes.decode and bytearray.decode now use an - Issue #19619: str.encode, bytes.decode and bytearray.decode now use an
internal API to throw LookupError for known non-text encodings, rather internal API to throw LookupError for known non-text encodings, rather
...@@ -79,8 +80,8 @@ Library ...@@ -79,8 +80,8 @@ Library
CRL enumeration are now two functions. enum_certificates() also returns CRL enumeration are now two functions. enum_certificates() also returns
purpose flags as set of OIDs. purpose flags as set of OIDs.
- Issue #19555: Restore sysconfig.get_config_var('SO'), with a - Issue #19555: Restore sysconfig.get_config_var('SO'), (and the distutils
DeprecationWarning pointing people at $EXT_SUFFIX. equivalent) with a DeprecationWarning pointing people at $EXT_SUFFIX.
- Issue #8813: Add SSLContext.verify_flags to change the verification flags - Issue #8813: Add SSLContext.verify_flags to change the verification flags
of the context in order to enable certification revocation list (CRL) of the context in order to enable certification revocation list (CRL)
......
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