From: Nabil Ghodbane Date: Mon, 2 Jan 2023 13:10:59 +0000 (+0100) Subject: spns #32335: some projects still rely on Python 2. Implement a switch based on Python... X-Git-Tag: V9_11_0~132 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eca7ecb1662390ba681a630fdd80244434059b38;p=tools%2Fsat_salome.git spns #32335: some projects still rely on Python 2. Implement a switch based on Python major version number --- diff --git a/products/compil_scripts/omniORB.sh b/products/compil_scripts/omniORB.sh index abd2a8e..475fd5c 100755 --- a/products/compil_scripts/omniORB.sh +++ b/products/compil_scripts/omniORB.sh @@ -42,10 +42,17 @@ if version_ge $VERSION "4.1" ; then echo echo "*** fix headers" cd $PRODUCT_INSTALL/bin - sed -e "s%#\!.*python[0-9]*%#\!/usr/bin/env python3%" omniidl > _omniidl + + pyVersionMajor=python$($PYTHONBIN -c 'import sys; print(".".join(map(str, sys.version_info[0:1])))') + if [ $? -ne 0 ]; then + echo ERROR: Failed to extract major Python version - assuming Python version equal to 3... + pyVersionMajor=python3 + fi + echo INFO: Python version major: ${pyVersionMajor} + sed -e "s%#\!.*python[0-9]*%#\!/usr/bin/env ${pyVersionMajor}%" omniidl > _omniidl mv -f _omniidl omniidl chmod a+x omniidl - sed -e "s%#\!.*python[0-9]*%#\!/usr/bin/env python3%" omniidlrun.py > _omniidlrun.py + sed -e "s%#\!.*python[0-9]*%#\!/usr/bin/env ${pyVersionMajor}%" omniidlrun.py > _omniidlrun.py mv -f _omniidlrun.py omniidlrun.py chmod a+x omniidlrun.py fi