summaryrefslogtreecommitdiffstats
path: root/src/VBox/Frontends/VBoxShell/vboxshell.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:47:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:47:04 +0000
commit8b152439beb81c8da1bdb00c7870e2d9e8d49612 (patch)
treeea7e527f7531053d0bcc60ce1eea46e1c4b15757 /src/VBox/Frontends/VBoxShell/vboxshell.py
parentAdding debian version 7.0.16-dfsg-8. (diff)
downloadvirtualbox-8b152439beb81c8da1bdb00c7870e2d9e8d49612.tar.xz
virtualbox-8b152439beb81c8da1bdb00c7870e2d9e8d49612.zip
Merging upstream version 7.0.18-dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Frontends/VBoxShell/vboxshell.py')
-rwxr-xr-xsrc/VBox/Frontends/VBoxShell/vboxshell.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/VBox/Frontends/VBoxShell/vboxshell.py b/src/VBox/Frontends/VBoxShell/vboxshell.py
index bd0222c7..f1083dd1 100755
--- a/src/VBox/Frontends/VBoxShell/vboxshell.py
+++ b/src/VBox/Frontends/VBoxShell/vboxshell.py
@@ -1,7 +1,28 @@
-#!/usr/bin/env python
+#!/bin/sh
# -*- coding: utf-8 -*-
# $Id: vboxshell.py $
+# The following checks for the right (i.e. most recent) Python binary available
+# and re-starts the script using that binary (like a shell wrapper).
+#
+# Using a shebang like "#!/bin/env python" on newer Fedora/Debian distros is banned [1]
+# and also won't work on other newer distros (Ubuntu >= 23.10), as those only ship
+# python3 without a python->python3 symlink anymore.
+#
+# Note: As Python 2 is EOL, we consider this last (and hope for the best).
+#
+# [1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/2PD5RNJRKPN2DVTNGJSBHR5RUSVZSDZI/
+''':'
+for python_bin in python3 python python2
+do
+ type "$python_bin" > /dev/null 2>&1 && exec "$python_bin" "$0" "$@"
+done
+echo >&2 "ERROR: Python not found! Please install this first in order to run this program."
+exit 1
+':'''
+
+from __future__ import print_function
+
"""
VirtualBox Python Shell.
@@ -19,8 +40,6 @@ Finally, shell allows arbitrary custom extensions, just create
P.S. Our apologies for the code quality.
"""
-from __future__ import print_function
-
__copyright__ = \
"""
Copyright (C) 2009-2023 Oracle and/or its affiliates.
@@ -43,7 +62,7 @@ along with this program; if not, see <https://www.gnu.org/licenses>.
SPDX-License-Identifier: GPL-3.0-only
"""
-__version__ = "$Revision: 155244 $"
+__version__ = "$Revision: 162975 $"
import gc