From b3d82a626bc0876ceacf4f516100f4e7d3174d50 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Tue, 19 Sep 2017 22:28:05 +0200
Subject: [PATCH] Added python_bin variable to config script

---
 scripts/config.sh                  | 12 ++++++++++++
 src/config/Makefile                |  2 +-
 src/maketools/update-config-txt.sh |  2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/scripts/config.sh b/scripts/config.sh
index 727d3e8ca..4857e0625 100755
--- a/scripts/config.sh
+++ b/scripts/config.sh
@@ -48,6 +48,7 @@ do
     ;;
   (has) action=has ;;
   (module) action=module ;;
+  (python_bin) action=python_bin ;;
   (*)
     checklist="$checklist $opt"
   esac
@@ -89,5 +90,16 @@ case $action in
   git=$(echo "$configfile" | grep -v \# | awk '{ if($1=="version" && $2=="git") print $3 }')
   echo "Version: $long (git: $git)"
  ;;
+(python_bin)
+  py=$(echo "$configfile" | grep -v \# | awk '{ if($1=="python_bin") print $2 }')
+  if test -n "$py" ; then
+    retval=0
+    test "$quiet" = no && echo "$py"
+  else
+    retval=1
+    test "$quiet" = no && echo "python not found"
+  fi
+  exit $retval
+;;
 esac
 
diff --git a/src/config/Makefile b/src/config/Makefile
index b02391589..640d415ea 100644
--- a/src/config/Makefile
+++ b/src/config/Makefile
@@ -23,7 +23,7 @@ obj: all
 
 config.txt: ../../Makefile.conf
 	@echo "Updating config.txt file"
-	@ ../maketools/update-config-txt.sh config.txt $(CPPFLAGS)
+	@python_bin="$(python_bin)" ../maketools/update-config-txt.sh config.txt $(CPPFLAGS)
 
 version.h:
 	@echo "Updating version.h"
diff --git a/src/maketools/update-config-txt.sh b/src/maketools/update-config-txt.sh
index 4efebe16f..a8953be96 100755
--- a/src/maketools/update-config-txt.sh
+++ b/src/maketools/update-config-txt.sh
@@ -101,6 +101,8 @@ echo "# version strings"
 echo "# syntax: version short/long/git number"
 echo "$version"
 echo
+echo "python_bin $python_bin"
+echo
 echo "# list of 'has' options"
 echo "# syntax: has name on/of"
 echo "# if option xx is on then plumed has beeen compiled with -D__PLUMED_HAS_XX"
-- 
GitLab