mirror of
https://github.com/niess/python-appimage.git
synced 2026-03-15 04:40:15 +01:00
_initappimage in site.py
This commit is contained in:
16
python_appimage/data/site-patch.py
Normal file
16
python_appimage/data/site-patch.py
Normal 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
|
||||
Reference in New Issue
Block a user