upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/scripts/launcher_python.sh
diff options
context:
space:
mode:
authorOreoFR <29048345+OreoFR@users.noreply.github.com>2026-11-29 13:51:31 +0100
committerOreoFR <29048345+OreoFR@users.noreply.github.com>2026-11-29 13:51:31 +0100
commitdb567419fa01f1e10aa1d48caa46dcd27b029843 (patch)
tree552c121a926a7759651b178a9aa5afad76f856b1 /scripts/launcher_python.sh
parent0c4bdde51c696c7fd2dc3e77004c8a7ad9fd4134 (diff)
parentcc0f662a70b6e6e561692f56342b5a7df3831bd7 (diff)
Merge origin/main into carry/pr-2029
d3d12_xs_alloc_size: the PR's single-pass console_placement with main's title_descs/title_layout and console_unordered_access_size added to the per-description overrides; CMakeLists: xs_alloc_size_test and appnotify_test both kept. Co-authored-by: Ilyass Roussi <76879547+IlyassRS3@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/launcher_python.sh')
-rw-r--r--scripts/launcher_python.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/launcher_python.sh b/scripts/launcher_python.sh
new file mode 100644
index 000000000..a469f34ec
--- /dev/null
+++ b/scripts/launcher_python.sh
@@ -0,0 +1,40 @@
1# Sourced by the POSIX launchers. Search for versioned Python names on PATH so a new Python minor
2# release works even if the system's unversioned python3 still points to an older interpreter.
3exec_leonida_python() {
4 remaining=${PATH-}
5 best_minor=11
6 best_python=
7 while :; do
8 directory=${remaining%%:*}
9 for candidate in "${directory:-.}"/python3.*; do
10 [ -f "$candidate" ] && [ -x "$candidate" ] || continue
11 name=${candidate##*/}
12 minor=${name#python3.}
13 case $minor in
14 0*|''|*[!0-9]*) continue ;;
15 esac
16 # Invoke by name to keep PATH precedence if that version appears in more than one directory.
17 if [ "$minor" -gt "$best_minor" ] 2>/dev/null && leonida_python_is_supported "$name"; then
18 best_minor=$minor
19 best_python=$name
20 fi
21 done
22 case $remaining in
23 *:*) remaining=${remaining#*:} ;;
24 *) break ;;
25 esac
26 done
27
28 if [ -n "$best_python" ]; then
29 exec "$best_python" -I "$@"
30 fi
31 for name in python3 python; do
32 if leonida_python_is_supported "$name"; then
33 exec "$name" -I "$@"
34 fi
35 done
36}
37
38leonida_python_is_supported() {
39 "$1" -I -c 'import sys; sys.exit(0 if sys.version_info >= (3, 12) else 1)' >/dev/null 2>&1
40}