summaryrefslogtreecommitdiff
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
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
-rw-r--r--python/test/Ice/asyncio/test.py9
-rw-r--r--scripts/Util.py11
2 files changed, 12 insertions, 8 deletions
diff --git a/python/test/Ice/asyncio/test.py b/python/test/Ice/asyncio/test.py
index 8df759f8107..c688472887d 100644
--- a/python/test/Ice/asyncio/test.py
+++ b/python/test/Ice/asyncio/test.py
@@ -5,13 +5,6 @@
# This test requires asyncio methods which are only available with Python 3.7
-# We want to check the version of the python interpreter used to run the tests
-# not the version of the python interpreter running this script see --python option
-version = subprocess.check_output([currentConfig.python,
- "-c",
- "import sys; print(f\"{sys.version_info[0]}.{sys.version_info[1]}\")"], text=True)
-version = tuple(int(num) for num in version.split("."))
-
-if version >= (3, 7):
+if currentConfig.getPythonVersion() >= (3, 7):
TestSuite(__name__)
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,