summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid King <amigadave@amigadave.com>2021-06-21 17:10:43 +0100
committerDavid King <amigadave@amigadave.com>2021-06-21 17:21:08 +0100
commit04eeeabb42436cb58e9bac2f6c31c0fb87905a72 (patch)
tree8120d9584a90fc86c6f2dec1411c2116fe7fac8e
parent49bc258fd56db6ee0518058129f8fdc7f35a57e8 (diff)
downloadlibproxy-git-04eeeabb42436cb58e9bac2f6c31c0fb87905a72.tar.gz
python: Support Python 3.10 and above
As suggested by Miro HronĨok, change the way that the Python interpreter version is found. Additionally, update the static list of accepted Python 3 versions. https://bugzilla.redhat.com/show_bug.cgi?id=1898060
-rw-r--r--bindings/python/python2/CMakeLists.txt2
-rw-r--r--bindings/python/python3/CMakeLists.txt2
-rw-r--r--cmake/FindPython3Interp.cmake2
3 files changed, 3 insertions, 3 deletions
diff --git a/bindings/python/python2/CMakeLists.txt b/bindings/python/python2/CMakeLists.txt
index 00df551..f4d2b91 100644
--- a/bindings/python/python2/CMakeLists.txt
+++ b/bindings/python/python2/CMakeLists.txt
@@ -6,7 +6,7 @@ if(PYTHON2INTERP_FOUND)
if(NOT PYTHON2_SITEPKG_DIR)
execute_process(COMMAND
${PYTHON2_EXECUTABLE}
- -c "import sys; print (sys.version[0:3])"
+ -c "import sys; print('{}.{}'.format(*sys.version_info[0:2]))"
OUTPUT_VARIABLE PYTHON2_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/bindings/python/python3/CMakeLists.txt b/bindings/python/python3/CMakeLists.txt
index bf87dfc..fc3b24b 100644
--- a/bindings/python/python3/CMakeLists.txt
+++ b/bindings/python/python3/CMakeLists.txt
@@ -6,7 +6,7 @@ if(PYTHON3INTERP_FOUND)
if(NOT PYTHON3_SITEPKG_DIR)
execute_process(COMMAND
${PYTHON3_EXECUTABLE}
- -c "import sys; print (sys.version[0:3])"
+ -c "import sys; print('{}.{}'.format(*sys.version_info[0:2]))"
OUTPUT_VARIABLE PYTHON3_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/cmake/FindPython3Interp.cmake b/cmake/FindPython3Interp.cmake
index 74398b2..5b25e5a 100644
--- a/cmake/FindPython3Interp.cmake
+++ b/cmake/FindPython3Interp.cmake
@@ -39,7 +39,7 @@
unset(_Python3_NAMES)
-set(_Python3_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_Python3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(Python3Interp_FIND_VERSION)
if(Python3Interp_FIND_VERSION_COUNT GREATER 1)