Skip to content

Commit 0ca260e

Browse files
author
loewis
committed
Patch #1046831: Use get_python_version where appropriate in sysconfig.py.
git-svn-id: http://svn.python.org/projects/python/trunk@38545 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent bb8996f commit 0ca260e

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

Lib/distutils/sysconfig.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
del argv0_path, landmark
3535

3636

37-
def get_python_version ():
37+
def get_python_version():
3838
"""Return a string containing the major and minor Python version,
3939
leaving off the patchlevel. Sample return values could be '1.5'
4040
or '2.2'.
@@ -65,7 +65,7 @@ def get_python_inc(plat_specific=0, prefix=None):
6565
if not os.path.exists(inc_dir):
6666
inc_dir = os.path.join(os.path.dirname(base), "Include")
6767
return inc_dir
68-
return os.path.join(prefix, "include", "python" + sys.version[:3])
68+
return os.path.join(prefix, "include", "python" + get_python_version())
6969
elif os.name == "nt":
7070
return os.path.join(prefix, "include")
7171
elif os.name == "mac":
@@ -110,7 +110,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
110110
if standard_lib:
111111
return os.path.join(prefix, "Lib")
112112
else:
113-
if sys.version < "2.2":
113+
if get_python_version() < "2.2":
114114
return prefix
115115
else:
116116
return os.path.join(PREFIX, "Lib", "site-packages")
@@ -189,7 +189,7 @@ def get_config_h_filename():
189189
inc_dir = os.curdir
190190
else:
191191
inc_dir = get_python_inc(plat_specific=1)
192-
if sys.version < '2.2':
192+
if get_python_version() < '2.2':
193193
config_h = 'config.h'
194194
else:
195195
# The name of the config.h file changed in 2.2
@@ -378,7 +378,7 @@ def _init_posix():
378378
if python_build:
379379
g['LDSHARED'] = g['BLDSHARED']
380380

381-
elif sys.version < '2.1':
381+
elif get_python_version() < '2.1':
382382
# The following two branches are for 1.5.2 compatibility.
383383
if sys.platform == 'aix4': # what about AIX 3.x ?
384384
# Linker script is in the config directory, not in Modules as the
@@ -405,7 +405,7 @@ def _init_posix():
405405
# it's taken care of for them by the 'build_ext.get_libraries()'
406406
# method.)
407407
g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
408-
(linkerscript, PREFIX, sys.version[0:3]))
408+
(linkerscript, PREFIX, get_python_version()))
409409

410410
global _config_vars
411411
_config_vars = g

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Extension Modules
6161
Library
6262
-------
6363

64+
- Patch #1046831: Use get_python_version where appropriate in sysconfig.py.
65+
6466
- Patch #1117454: Remove code to special-case cookies without values
6567
in LWPCookieJar.
6668

0 commit comments

Comments
 (0)