From 7f57d3c260ab6d84b697c3e721b73f7b19705d42 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 21 Aug 2011 00:39:18 +0200 Subject: Issue #12326: refactor usage of sys.platform * Use str.startswith(tuple): I didn't know this Python feature, Python rocks! * Replace sometimes sys.platform.startswith('linux') with sys.platform == 'linux' * sys.platform doesn't contain the major version on Cygwin on Mac OS X (it's just 'cygwin' and 'darwin') --- Lib/distutils/command/build_ext.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Lib/distutils/command') diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 8d843d689f..8baf538f2a 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -240,8 +240,7 @@ class build_ext(Command): # for extensions under Linux or Solaris with a shared Python library, # Python's library directory must be appended to library_dirs sysconfig.get_config_var('Py_ENABLE_SHARED') - if ((sys.platform.startswith('linux') or sys.platform.startswith('gnu') - or sys.platform.startswith('sunos')) + if (sys.platform.startswith(('linux', 'gnu', 'sunos')) and sysconfig.get_config_var('Py_ENABLE_SHARED')): if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): # building third party extensions -- cgit v1.2.1