summaryrefslogtreecommitdiff
path: root/scripts/Util.py
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2021-01-19 10:13:06 +0100
committerJose <jose@zeroc.com>2021-01-19 10:13:06 +0100
commitfa4ee8db60077d6ee8ea9037ba386637ec7f058e (patch)
tree9fc7c7d8fc254801530ae710d9a18154caaf2374 /scripts/Util.py
parentJavaScript default protocol for browsers should be "ws" - Close #934 (diff)
downloadice-fa4ee8db60077d6ee8ea9037ba386637ec7f058e.tar.bz2
ice-fa4ee8db60077d6ee8ea9037ba386637ec7f058e.tar.xz
ice-fa4ee8db60077d6ee8ea9037ba386637ec7f058e.zip
Add getPythonVersion to PythonMapping.Config
Diffstat (limited to 'scripts/Util.py')
-rw-r--r--scripts/Util.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/Util.py b/scripts/Util.py
index 7497cee2096..92a8427c65f 100644
--- a/scripts/Util.py
+++ b/scripts/Util.py
@@ -3688,6 +3688,17 @@ class PythonMapping(CppBasedMapping):
def __init__(self, options=[]):
Mapping.Config.__init__(self, options)
+ self.pythonVersion = None
+
+ def getPythonVersion(self):
+ if self.pythonVersion is None:
+ version = subprocess.check_output(
+ [currentConfig.python,
+ "-c",
+ "import sys; print(\"{0}.{1}\".format(sys.version_info[0], sys.version_info[1]))"],
+ text=True)
+ self.pythonVersion = tuple(int(num) for num in version.split("."))
+ return self.pythonVersion
def getCommandLine(self, current, process, exe, args):
return "\"{0}\" {1} {2} {3}".format(current.config.python,