[Lldb-commits] [lldb] r358635 - [Shell] Simplify Extracting Python Version

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 17 18:37:19 PDT 2019


Author: jdevlieghere
Date: Wed Apr 17 18:37:19 2019
New Revision: 358635

URL: http://llvm.org/viewvc/llvm-project?rev=358635&view=rev
Log:
[Shell] Simplify Extracting Python Version

Instead of parsing the Python version with a fairly convoluted regex,
just print the major and minor version and call it a day.

Modified:
    lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh

Modified: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh?rev=358635&r1=358634&r2=358635&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh Wed Apr 17 18:37:19 2019
@@ -56,8 +56,7 @@ fi
 
 OS_NAME=`uname -s`
 PYTHON=${PYTHON_EXECUTABLE:-/usr/bin/env python}
-PYTHON_VERSION=`${PYTHON} --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
-
+PYTHON_VERSION=`${PYTHON} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
 
 if [ $Debug -eq 1 ]
 then




More information about the lldb-commits mailing list