[mnet-devel] patch: find python 2.2 on unix

Zooko O'Whielacronx zooko at zooko.com
Tue Feb 17 03:51:09 GMT 2004


This patch makes the various unix scripts (including the launcher script 
Mnet.sh) find Python 2.2 even if it can't be found with "which python" nor 
"which python2".  I've compiled and am running with Python 2.2 here, but with no 
GUI as Debian doesn't have wxPython for Python 2.2 (only for Python 2.3).

The scripts will still find and use version of Python > 2.3 if those versions 
can be found via the PYTHON environment variable, or "which python", or 
"which python2", or "/usr/local/bin/python", or "/usr/local/bin/python2".

--Z

--- Mnet.sh.in	29 Nov 2003 11:51:59 -0000	1.11
+++ Mnet.sh.in	17 Feb 2004 03:38:15 -0000
@@ -75,8 +75,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${ORIGPYTHONVAR}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${ORIGPYTHONVAR}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -209,6 +209,7 @@ print string.join(pp, ':') 
 }
 
 findpython ${PYMAJNUM} ${PYMINNUM} "true" # strict
+if [ "X${PYTHON}" = "X" ] ; then echo "the PYTHON environment variable: ${ORIGPYTHONVAR}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up." ; exit 1 ; fi
 findmnetdir
 # echo "MNETDIR: ${MNETDIR}"
 mnetenvset
--- hackerdocs/cvsinstall.sh	16 Nov 2003 22:44:29 -0000	1.20
+++ hackerdocs/cvsinstall.sh	17 Feb 2004 03:38:16 -0000
@@ -118,8 +118,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -180,7 +180,11 @@ findmnetdir() {
     fi
 }
 
-findpython
+findpython 2 3
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 2 ; fi
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 1 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 0 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 1 5 ; fi # versions of Python < 2.2 are untested
 findmnetdir ".."
 
 if [ "X" = "X${MNETDIR}" ] ; then MNETDIR=mnet ; fi ; export MNETDIR
--- utilscripts/Mme	16 Nov 2003 22:44:29 -0000	1.20
+++ utilscripts/Mme	17 Feb 2004 03:38:16 -0000
@@ -68,8 +68,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -214,7 +214,11 @@ print string.join(pp, ':')
 
 
 
-findpython
+findpython 2 3
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 2 ; fi
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 1 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 0 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 1 5 ; fi # versions of Python < 2.2 are untested
 # echo "o o o    PYTHON: ${PYTHON}"
 findmnetdir ".."
 # echo "o o o    MNETDIR: ${MNETDIR}"
--- utilscripts/Mstart	16 Nov 2003 22:44:29 -0000	1.21
+++ utilscripts/Mstart	17 Feb 2004 03:38:16 -0000
@@ -75,8 +75,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -212,7 +212,11 @@ print string.join(pp, ':') 
         export MNETCONFDIR
     fi
 }
-findpython
+findpython 2 3
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 2 ; fi
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 1 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 0 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 1 5 ; fi # versions of Python < 2.2 are untested
 findmnetdir ".."
 mnetenvset
 
--- utilscripts/cmdpub	16 Nov 2003 22:44:29 -0000	1.21
+++ utilscripts/cmdpub	17 Feb 2004 03:38:16 -0000
@@ -114,8 +114,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -246,7 +246,11 @@ print string.join(pp, ':') 
 
 
 
-findpython
+findpython 2 3
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 2 ; fi
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 1 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 0 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 1 5 ; fi # versions of Python < 2.2 are untested
 # echo "o o o    PYTHON: ${PYTHON}"
 findmnetdir ".."
 # echo "o o o    MNETDIR: ${MNETDIR}"
--- utilscripts/cmdshutdown	16 Nov 2003 22:44:29 -0000	1.20
+++ utilscripts/cmdshutdown	17 Feb 2004 03:38:16 -0000
@@ -74,8 +74,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -211,7 +211,11 @@ print string.join(pp, ':') 
     fi
 }
 
-findpython
+findpython 2 3
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 2 ; fi
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 1 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 0 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 1 5 ; fi # versions of Python < 2.2 are untested
 # echo "o o o    PYTHON: ${PYTHON}"
 findmnetdir ".."
 # echo "o o o    MNETDIR: ${MNETDIR}"
--- utilscripts/conids	16 Nov 2003 22:44:29 -0000	1.4
+++ utilscripts/conids	17 Feb 2004 03:38:16 -0000
@@ -75,8 +75,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -212,7 +212,11 @@ print string.join(pp, ':') 
         export MNETCONFDIR
     fi
 }
-findpython
+findpython 2 3
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 2 ; fi
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 1 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 0 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 1 5 ; fi # versions of Python < 2.2 are untested
 findmnetdir ".."
 mnetenvset
 
--- utilscripts/killemall.sh	16 Nov 2003 22:44:29 -0000	1.19
+++ utilscripts/killemall.sh	17 Feb 2004 03:38:16 -0000
@@ -68,8 +68,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi
@@ -136,7 +136,11 @@ findmnetdir() {
 
 }
 
-findpython
+findpython 2 3
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 2 ; fi
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 1 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 2 0 ; fi # versions of Python < 2.2 are untested
+if [ "X${PYTHON}" = "X" ] ; then findpython 1 5 ; fi # versions of Python < 2.2 are untested
 findmnetdir ".."
 
 # We depend on listemall.sh:
--- utilscripts/startscripts.ba.sh	16 Nov 2003 22:44:29 -0000	1.21
+++ utilscripts/startscripts.ba.sh	17 Feb 2004 03:38:16 -0000
@@ -76,8 +76,8 @@ findpython() {
                             ${PYTHON:-true} -c "import sys; sys.exit((((sys.version[0] == '${PYMAJNUM}') and (sys.version[2] == '${PYMINNUM}')) or (not '${STRICT}'))+66)" 1>/dev/null 2>/dev/null
 
                             if [ $? != 67 ]; then
-                                echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
-                                exit 1 # signal failure
+                                # echo "the PYTHON environment variable: ${PYTHON}, doesn't specify a working python interpreter, and I tried just invoking python under various names and none of those worked either.  Giving up."
+                                unset PYTHON
                             fi
                         fi
                     fi


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
mnet-devel mailing list
mnet-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mnet-devel




More information about the Mnet-devel mailing list