VirtualBox

Changeset 102890 in vbox for trunk


Ignore:
Timestamp:
Jan 16, 2024 11:17:47 AM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161112
Message:

Frontends/VBoxShell: Use a shell wrapper code instead of a hardcoded Python shebang to make this frontend more compatible with newer distros. See comments for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r102872 r102890  
    1 #!/usr/bin/env python
     1#!/bin/sh
    22# -*- coding: utf-8 -*-
    33# pylint: disable=too-many-lines
    44# $Id$
    55
     6# The following checks for the right (i.e. most recent) Python binary available
     7# and re-starts the script using that binary (like a shell wrapper).
     8#
     9# Using a shebang like "#!/bin/env python" on newer Fedora/Debian distros is banned [1]
     10# and also won't work on other newer distros (Ubuntu >= 23.10), as those only ship
     11# python3 without a python->python3 symlink anymore.
     12#
     13# Note: As Python 2 is EOL, we consider this last (and hope for the best).
     14#
     15# [1] https://lists.fedoraproject.org/archives/list/[email protected]/message/2PD5RNJRKPN2DVTNGJSBHR5RUSVZSDZI/
     16''':'
     17for python_bin in python3 python python2
     18do
     19    type "$python_bin" > /dev/null 2>&1 && exec "$python_bin" "$0" "$@"
     20done
     21echo >&2 "ERROR: Python not found! Please install this first in order to run this program."
     22exit 1
     23':'''
     24
     25from __future__ import print_function
     26
    627"""
    728VirtualBox Python Shell.
     
    2041P.S. Our apologies for the code quality.
    2142"""
    22 
    23 from __future__ import print_function
    2443
    2544__copyright__ = \
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette