-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: the big packaging/versioning rework
- move some files around so everything we need is in a single Python package - build that Python package with Poetry - write a shared spec file for PyInstaller builds - use the metadata from the package to determine versions
- Loading branch information
Showing
52 changed files
with
975 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,23 +22,21 @@ jobs: | |
with: | ||
separator: "," | ||
files: | | ||
plugin/* | ||
decky_loader/plugin_api/* | ||
- name: Is stub changed | ||
id: changed-stub | ||
run: | | ||
STUB_CHANGED="false" | ||
PATHS=(plugin plugin/decky_plugin.pyi) | ||
PATHS=(decky_loader decky_loader/plugin_api/decky_plugin.pyi) | ||
SHA=${{ github.sha }} | ||
SHA_PREV=HEAD^ | ||
FILES=$(git diff $SHA_PREV..$SHA --name-only -- ${PATHS[@]} | jq -Rsc 'split("\n")[:-1] | join (",")') | ||
if [[ "$FILES" == *"plugin/decky_plugin.pyi"* ]]; then | ||
$STUB_CHANGED="true" | ||
if [[ "$FILES" == *"decky_loader/plugin_api/decky_plugin.pyi"* ]]; then | ||
STUB_CHANGED="true" | ||
echo "Stub has changed, pushing updated stub" | ||
else | ||
echo "Stub has not changed, exiting." | ||
echo "has_changed=$STUB_CHANGED" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
echo "has_changed=$STUB_CHANGED" >> $GITHUB_OUTPUT | ||
|
@@ -48,7 +46,7 @@ jobs: | |
env: | ||
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
source_file: 'plugin/decky_plugin.pyi' | ||
source_file: 'decky_loader/plugin_api/decky_plugin.pyi' | ||
destination_repo: 'SteamDeckHomebrew/decky-plugin-template' | ||
user_email: '[email protected]' | ||
user_name: 'TrainDoctor' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
import os | ||
from PyInstaller.building.build_main import Analysis | ||
from PyInstaller.building.api import EXE, PYZ | ||
from PyInstaller.utils.hooks import copy_metadata | ||
|
||
a = Analysis( | ||
['pyi-main.py'], | ||
datas=[ | ||
('decky_loader/static', 'decky_loader/static'), | ||
('decky_loader/legacy', 'decky_loader/legacy'), | ||
('decky_loader/locales', 'decky_loader/locales'), | ||
] + copy_metadata('decky_loader'), | ||
hiddenimports=['sqlite3'], | ||
) | ||
pyz = PYZ(a.pure, a.zipped_data) | ||
|
||
noconsole = bool(os.getenv('DECKY_NOCONSOLE')) | ||
name = "PluginLoader" | ||
if noconsole: | ||
name += "_noconsole" | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
name=name, | ||
upx=True, | ||
console=not noconsole, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import sys | ||
from .localplatform import chmod | ||
|
||
# Change PyInstaller files permissions | ||
if hasattr(sys, '_MEIPASS'): | ||
chmod(sys._MEIPASS, 755) | ||
|
||
from asyncio import new_event_loop, set_event_loop | ||
from logging import basicConfig, getLogger | ||
import multiprocessing | ||
from os import path | ||
import sys | ||
|
||
from .helpers import get_effective_user_id, get_system_pythonpaths | ||
from .localplatform import ON_WINDOWS, get_log_level | ||
from .main import PluginManager | ||
|
||
logger = getLogger("Main") | ||
|
||
|
||
def main(): | ||
basicConfig( | ||
level=get_log_level(), | ||
format="[%(module)s][%(levelname)s]: %(message)s" | ||
) | ||
|
||
if ON_WINDOWS: | ||
# Fix windows/flask not recognising that .js means 'application/javascript' | ||
import mimetypes | ||
mimetypes.add_type('application/javascript', '.js') | ||
|
||
# Required for multiprocessing support in frozen files | ||
multiprocessing.freeze_support() | ||
else: | ||
if get_effective_user_id() != 0: | ||
logger.warning(f"decky is running as an unprivileged user, this is not officially supported and may cause issues") | ||
|
||
# Append the loader's plugin path to the recognized python paths | ||
sys.path.append(path.join(path.dirname(__file__), "plugin_api")) | ||
|
||
# Append the system and user python paths | ||
sys.path.extend(get_system_pythonpaths()) | ||
|
||
loop = new_event_loop() | ||
set_event_loop(loop) | ||
PluginManager(loop).run() | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.