From 7e11c4201c6bb99bbff194b35db60c6b2ccb79c8 Mon Sep 17 00:00:00 2001
From: Paul Seyfert <paul.seyfert@mib.infn.it>
Date: Sat, 26 Dec 2015 15:01:27 +0100
Subject: [PATCH] attempt to get shebang right for main/python

Signed-off-by: Fons Rademakers <Fons.Rademakers@cern.ch>
---
 Makefile              | 1 +
 config/Makefile.in    | 1 +
 configure             | 1 +
 main/python/Module.mk | 6 ++++--
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 227c88cfe96..d09add57ce6 100644
--- a/Makefile
+++ b/Makefile
@@ -1456,6 +1456,7 @@ showbuild:
 	@echo "PYTHONLIBDIR       = $(PYTHONLIBDIR)"
 	@echo "PYTHONLIB          = $(PYTHONLIB)"
 	@echo "PYTHONINCDIR       = $(PYTHONINCDIR)"
+	@echo "PYTHONEXE          = $(PYTHONEXE)"
 	@echo "RUBYLIBDIR         = $(RUBYLIBDIR)"
 	@echo "RUBYLIB            = $(RUBYLIB)"
 	@echo "RUBYINCDIR         = $(RUBYINCDIR)"
diff --git a/config/Makefile.in b/config/Makefile.in
index 895e410cfcb..4231dc640f8 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -303,6 +303,7 @@ PYTHONLIBDIR   := @pythonlibdir@
 PYTHONLIB      := @pythonlib@
 PYTHONINCDIR   := $(filter-out /usr/include, @pythonincdir@)
 PYTHONLIBFLAGS := @pythonlibflags@
+PYTHONEXE      := @pythonexe@
 
 BUILDRUBY      := @buildruby@
 RUBYLIBDIR     := @rubylibdir@
diff --git a/configure b/configure
index 21b1b089cb1..6bc758792d3 100755
--- a/configure
+++ b/configure
@@ -7772,6 +7772,7 @@ sed -e "s|@globusincdir@|$globusincdir|"        \
     -e "s|@pythonlibdir@|$pythonlibdir|"        \
     -e "s|@pythonincdir@|$pythonincdir|"        \
     -e "s|@pythonlibflags@|$pythonlibflags|"    \
+    -e "s|@pythonexe@|$pythonexe|"              \
     -e "s|@rubylib@|$rubylib|"                  \
     -e "s|@rubylibdir@|$rubylibdir|"            \
     -e "s|@rubyincdir@|$rubyincdir|"            \
diff --git a/main/python/Module.mk b/main/python/Module.mk
index 8fc174c8396..20abfee95cc 100644
--- a/main/python/Module.mk
+++ b/main/python/Module.mk
@@ -28,10 +28,12 @@ ALLEXECS     += $(CMDTOOLSPY)
 .PHONY:         all-$(MODNAME) clean-$(MODNAME) distclean-$(MODNAME)
 
 bin/%:          $(CMDTOOLSDIR)/%.py
-		cp $< $@
+		#cp $< $@
+		sed "s#@python@#$(PYTHONEXE)#" $< > $@
 
 $(LPATH)/%.py:  $(CMDTOOLSDIR)/%.py
-		cp $< $@
+		#cp $< $@
+		sed "s#@python@#$(PYTHONEXE)#" $< > $@
 
 #%.pyc: %.py;    python -c 'import py_compile; py_compile.compile( "$<" )'
 #%.pyo: %.py;    python -O -c 'import py_compile; py_compile.compile( "$<" )'
-- 
GitLab