_initappimage in site.py

This commit is contained in:
Valentin Niess
2022-06-11 16:22:07 +02:00
parent d947ae8afb
commit cd5df332f1
6 changed files with 69 additions and 56 deletions

View File

@@ -0,0 +1,16 @@
# This is a site.py patch when calling Python from an AppImage.
def _initappimage():
"""Initialise executable name for running from an AppImage."""
env = os.environ
try:
command = env["APPIMAGE_COMMAND"]
except KeyError:
return
if command and ("APPDIR" in env):
command = os.path.abspath(command)
sys.executable = command
sys._base_executable = command
_initappimage()
del _initappimage