Patch : improve common/bin/ python detection

Mike Duigou mike.duigou at
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 


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


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

diff --git a/common/bin/ b/common/bin/
--- a/common/bin/
+++ b/common/bin/
@@ -51,7 +51,7 @@
    bpython="`basename "$python"`"
-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}"
   echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout.

More information about the build-dev mailing list