Patch : improve common/bin/hgforest.sh python detection

Mike Duigou mike.duigou at oracle.com
Thu Jan 17 00:53:17 UTC 2013


With the mac ports version of mercurial (wasn't I just complaining about another mac ports problems yesterday? ;-) ) the path to python in the mercurial launcher has is 

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Note the capital "P" which is what was running afoul of the hgforest.sh detection. The following patch uses a different technique for checking the python executable.

Mike

PS:- I assume that the make/scripts/hgforest.sh is going away at some point?

diff --git a/common/bin/hgforest.sh b/common/bin/hgforest.sh
--- a/common/bin/hgforest.sh
+++ b/common/bin/hgforest.sh
@@ -51,7 +51,7 @@
    bpython="`basename "$python"`"
 fi
 
-if [ "python" = "$bpython" -a -x "$python" ] ; then
+if [ -x "$python" -a ! -d "$python" -a  "`${python} --version 2>&1 | cut -f 1 -d " "`" == "Python" ] ; then
   hg="${python} -u ${whichhg}"
 else
   echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout.




More information about the build-dev mailing list