From 9862a7bade613e225f8cb7ed7fe268cd8e0c4848 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Mon, 31 Jan 2022 15:21:30 +0100 Subject: [PATCH 1/3] Detect python version --- ssh-wrapper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ssh-wrapper.py b/ssh-wrapper.py index e911629..d7129bb 100755 --- a/ssh-wrapper.py +++ b/ssh-wrapper.py @@ -1,4 +1,11 @@ -#!/usr/bin/env python3 +#!/bin/sh +'''': +for pyint in python3 python python2; do + which $pyint >/dev/null 2>&1 && exec $pyint "$0" "$@" +done +echo "$0: No python could be found" >&2 +exit 1 +# ''' import argparse import os From 76065290c5b627a8a17b2de3f7384b59ea6d59ac Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 1 Dec 2023 09:02:59 +0100 Subject: [PATCH 2/3] Fixed small python detection bug --- ssh-wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh-wrapper.py b/ssh-wrapper.py index d7129bb..2ea189a 100755 --- a/ssh-wrapper.py +++ b/ssh-wrapper.py @@ -1,7 +1,7 @@ #!/bin/sh '''': for pyint in python3 python python2; do - which $pyint >/dev/null 2>&1 && exec $pyint "$0" "$@" + command -v $pyint >/dev/null 2>&1 && exec $pyint "$0" "$@" done echo "$0: No python could be found" >&2 exit 1 From 092b3a1103e203a4bb6e393e6cd1cda2689812d8 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 1 Dec 2023 15:34:47 +0100 Subject: [PATCH 3/3] Added /usr/libexec/platform-python for python discovery --- ssh-wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh-wrapper.py b/ssh-wrapper.py index 2ea189a..99a6a01 100755 --- a/ssh-wrapper.py +++ b/ssh-wrapper.py @@ -1,6 +1,6 @@ #!/bin/sh '''': -for pyint in python3 python python2; do +for pyint in /usr/libexec/platform-python python3 python python2; do command -v $pyint >/dev/null 2>&1 && exec $pyint "$0" "$@" done echo "$0: No python could be found" >&2