summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/util.py
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2010-01-26 22:46:15 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2010-01-26 22:46:15 (GMT)
commit92e68af56a2b95627c2220c3e190d7e3c2d4643e (patch)
treea747d03dd4dac1a4b85eee955e3f965b5f135c72 /Lib/distutils/util.py
parent0276c7ad0b56024f5373ad8f7edca5d77c58df22 (diff)
downloadcpython-92e68af56a2b95627c2220c3e190d7e3c2d4643e.zip
cpython-92e68af56a2b95627c2220c3e190d7e3c2d4643e.tar.gz
cpython-92e68af56a2b95627c2220c3e190d7e3c2d4643e.tar.bz2
added local get_platform/set_platform APIs in distutils.sysconfig
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r--Lib/distutils/util.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 8650d45..fbd3a67 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -16,10 +16,27 @@ from distutils.version import LooseVersion
from distutils.errors import DistutilsByteCompileError
_sysconfig = __import__('sysconfig')
+_PLATFORM = None
-# kept for backward compatibility
-# since this API was relocated
-get_platform = _sysconfig.get_platform
+def get_platform():
+ """Return a string that identifies the current platform.
+
+ By default, will return the value returned by sysconfig.get_platform(),
+ but it can be changed by calling set_platform().
+ """
+ global _PLATFORM
+ if _PLATFORM is None:
+ _PLATFORM = _sysconfig.get_platform()
+ return _PLATFORM
+
+def set_platform(identifier):
+ """Sets the platform string identifier returned by get_platform().
+
+ Note that this change doesn't impact the value returned by
+ sysconfig.get_platform() and is local to Distutils
+ """
+ global _PLATFORM
+ _PLATFORM = identifier
def convert_path(pathname):
"""Return 'pathname' as a name that will work on the native filesystem.