mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-17 08:47:49 +00:00
Expose a 'decky_plugin' module to decky plugins (#353)
* Expose a 'decky_plugin' module to decky plugins * expose decky user home path * support 'py_modules' python modules in plugins * allow for a '_migration' method in plugins to have an explicit file moving step * Expose the plugin python module as .pyi stub interface * Expose system and user python paths to plugins
This commit is contained in:
+12
-2
@@ -115,8 +115,18 @@ def mkdir_as_user(path):
|
||||
|
||||
# Fetches the version of loader
|
||||
def get_loader_version() -> str:
|
||||
with open(os.path.join(os.path.dirname(sys.argv[0]), ".loader.version"), "r", encoding="utf-8") as version_file:
|
||||
return version_file.readline().replace("\n", "")
|
||||
try:
|
||||
with open(os.path.join(os.path.dirname(sys.argv[0]), ".loader.version"), "r", encoding="utf-8") as version_file:
|
||||
return version_file.readline().replace("\n", "")
|
||||
except:
|
||||
return ""
|
||||
|
||||
# returns the appropriate system python paths
|
||||
def get_system_pythonpaths() -> list[str]:
|
||||
# run as normal normal user to also include user python paths
|
||||
proc = subprocess.run(["python3", "-c", "import sys; print(':'.join(x for x in sys.path if x))"],
|
||||
user=get_user_id(), env={}, capture_output=True)
|
||||
return proc.stdout.decode().strip().split(":")
|
||||
|
||||
# Download Remote Binaries to local Plugin
|
||||
async def download_remote_binary_to_path(url, binHash, path) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user