_initappimage.py 491 B

12345678910111213141516171819
  1. # This is a patch to getpath. It must execute before site.main() is called
  2. def _initappimage():
  3. """Initialise executable name when running from an AppImage."""
  4. import os
  5. import sys
  6. env = os.environ
  7. try:
  8. command = env["APPIMAGE_COMMAND"]
  9. except KeyError:
  10. return
  11. if command and ("APPDIR" in env):
  12. command = os.path.abspath(command)
  13. sys.executable = command
  14. sys._base_executable = command
  15. _initappimage()
  16. del _initappimage