Skip to contentSkip to conversation

tests/lcitool: Do not use a hard-coded /usr/bin/python3 as python interpreter

PATCH Applied Thomas Huth 4 participants 4 messages Mar 29, 2022 – Mar 31, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/lcitool: Do not use a hard-coded /usr/bin/python3 as python interpreter

When running "make lcitool-refresh", this currently uses the hard-coded /usr/bin/python3 from the script's shebang line for running Python. That's bad, since neither /usr/bin/python3 is guaranteed to exist, nor does it honor the python interpreter that the user might have chosen while running the "configure" script. Thus let's rather use $(PYTHON) in the Makefile, and improve the shebang line in the script in case someone runs this directly.

---
 tests/lcitool/Makefile.include | 2 +-
 tests/lcitool/refresh          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/lcitool/Makefile.include +1 -1
index 6b215adcd1..3780185c7c 100644
@@ -14,4 +14,4 @@ lcitool-help: lcitool
 
 lcitool-refresh:
 	$(call quiet-command, cd $(SRC_PATH) && git submodule update --init tests/lcitool/libvirt-ci)
-	$(call quiet-command, $(LCITOOL_REFRESH))
+	$(call quiet-command, $(PYTHON) $(LCITOOL_REFRESH))
tests/lcitool/refresh +1 -1
index 1f00281b44..2d198ad281 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 #
 # Re-generate container recipes
 #
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Thomas Huth

When running "make lcitool-refresh", this currently uses the hard-coded /usr/bin/python3 from the script's shebang line for running Python. That's bad, since neither /usr/bin/python3 is guaranteed to exist, nor does it honor the python interpreter that the user might have chosen while running the "configure" script. Thus let's rather use $(PYTHON) in the Makefile, and improve the shebang line in the script in case someone runs this directly.

Quoted 5 lines
---
 tests/lcitool/Makefile.include | 2 +-
 tests/lcitool/refresh          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 8 lines · Thomas Huth

When running "make lcitool-refresh", this currently uses the hard-coded /usr/bin/python3 from the script's shebang line for running Python. That's bad, since neither /usr/bin/python3 is guaranteed to exist, nor does it honor the python interpreter that the user might have chosen while running the "configure" script. Thus let's rather use $(PYTHON) in the Makefile, and improve the shebang line in the script in case someone runs this directly.

Quoted 5 lines
---
  tests/lcitool/Makefile.include | 2 +-
  tests/lcitool/refresh          | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
#3 lore raw
In reply to Thomas Huth

Le 29/03/2022 à 08:39, Thomas Huth a écrit :

Quoted 29 lines

When running "make lcitool-refresh", this currently uses the hard-coded /usr/bin/python3 from the script's shebang line for running Python. That's bad, since neither /usr/bin/python3 is guaranteed to exist, nor does it honor the python interpreter that the user might have chosen while running the "configure" script. Thus let's rather use $(PYTHON) in the Makefile, and improve the shebang line in the script in case someone runs this directly.

---
  tests/lcitool/Makefile.include | 2 +-
  tests/lcitool/refresh          | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
tests/lcitool/Makefile.include +1 -1
index 6b215adcd1..3780185c7c 100644
@@ -14,4 +14,4 @@ lcitool-help: lcitool
 
  lcitool-refresh:
  	$(call quiet-command, cd $(SRC_PATH) && git submodule update --init tests/lcitool/libvirt-ci)
-	$(call quiet-command, $(LCITOOL_REFRESH))
+	$(call quiet-command, $(PYTHON) $(LCITOOL_REFRESH))
tests/lcitool/refresh +0 -0
index 1f00281b44..2d198ad281 100755

tests/lcitool/refresh line 4

Quoted 5 lines
tests/lcitool/refresh +1 -1
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
  #
  # Re-generate container recipes
  #

Applied to my trivial-patches branch.

Thanks,
Laurent