summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2002-11-14 01:43:00 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2002-11-14 01:43:00 (GMT)
commit0ff98b9346f77d6888c29e5c787c5b1b75023efc (patch)
treea99b04b40e883a0ee8f1fdfecc260f6069682a96 /Lib/distutils
parent9a38dcf05743347c556660347a014620e3625949 (diff)
downloadcpython-0ff98b9346f77d6888c29e5c787c5b1b75023efc.zip
cpython-0ff98b9346f77d6888c29e5c787c5b1b75023efc.tar.gz
cpython-0ff98b9346f77d6888c29e5c787c5b1b75023efc.tar.bz2
[Bug #550364] Add get_python_version()
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/sysconfig.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 3d369b0..b12b98d 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -35,6 +35,14 @@ python_build = os.path.isfile(landmark)
del argv0_path, landmark
+def get_python_version ():
+ """Return a string containing the major and minor Python version,
+ leaving off the patchlevel. Sample return values could be '1.5'
+ or '2.2'.
+ """
+ return sys.version[:3]
+
+
def get_python_inc(plat_specific=0, prefix=None):
"""Return the directory containing installed Python header files.
@@ -93,7 +101,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
if os.name == "posix":
libpython = os.path.join(prefix,
- "lib", "python" + sys.version[:3])
+ "lib", "python" + get_python_version())
if standard_lib:
return libpython
else: