From 031b1fb83cfbdba6d3b4ea9947c50aba25234b7e Mon Sep 17 00:00:00 2001 From: GloriousEggroll Date: Sun, 7 Jul 2024 09:46:42 -0600 Subject: [PATCH] add python shebang fixer to makefile --- Makefile.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 88cede925..c6be674ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -16,21 +16,32 @@ DESTDIR ?= USERINSTALL ?= xfalse FLATPAK ?= xfalse +# Define the Python interpreter to use +PYTHON_INTERPRETER = /usr/bin/python3 .PHONY: all ifeq ($(FLATPAK), xtrue) -all: version umu umu-launcher +all: version umu umu-launcher fix_shebangs else -all: version umu umu-docs umu-launcher +all: version umu umu-docs umu-launcher fix_shebangs endif .PHONY: install ifeq ($(USERINSTALL), xtrue) -install: umu-install umu-launcher-install user-install +install: umu-install umu-launcher-install user-install fix_shebangs else -install: umu-install umu-launcher-install +install: umu-install umu-launcher-install fix_shebangs endif +fix_shebangs: + $(info :: Fixing shebangs... ) + find . -type f -name "*.py" -exec sed -i '1s|^#!/usr/bin/python|#!$(PYTHON_INTERPRETER)|' {} \; + find . -type f -name "*.py" -exec sed -i '1s|^#!/usr/bin/env python|#!$(PYTHON_INTERPRETER)|' {} \; + find . -type f -name "*.sh" -exec sed -i '1s|^#!/usr/bin/python|#!$(PYTHON_INTERPRETER)|' {} \; + find . -type f -name "*.sh" -exec sed -i '1s|^#!/usr/bin/env python|#!$(PYTHON_INTERPRETER)|' {} \; + find . -type f -name "umu-run" -exec sed -i '1s|^#!/usr/bin/python|#!$(PYTHON_INTERPRETER)|' {} \; + find . -type f -name "umu-run" -exec sed -i '1s|^#!/usr/bin/env python|#!$(PYTHON_INTERPRETER)|' {} \; + # Special case, do this inside the source directory for release distribution umu/umu_version.json: umu/umu_version.json.in $(info :: Updating $(@) )