]> SALOME platform Git repositories - tools/sat_salome.git/commitdiff
Salome HOME
spns #32335: some projects still rely on Python 2. Implement a switch based on Python...
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Mon, 2 Jan 2023 13:10:59 +0000 (14:10 +0100)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Mon, 2 Jan 2023 13:10:59 +0000 (14:10 +0100)
products/compil_scripts/omniORB.sh

index abd2a8e20f25ad6e3dd82af61f2c1ec2b597afde..475fd5ccf510d11f57ac120d1b19f2c942f5b2b5 100755 (executable)
@@ -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