split up taskfiles

add azure builds
This commit is contained in:
onyx-and-iris 2026-03-09 10:27:47 +00:00
parent 5e5ae33e6a
commit b0f634f1e8
8 changed files with 178 additions and 80 deletions

40
Taskfile.azure.yml Normal file
View File

@ -0,0 +1,40 @@
version: '3'
tasks:
build:
desc: Build Azure artifacts
deps: [rewrite]
cmds:
- defer: { task: restore }
- for:
matrix:
KIND: [basic, banana, potato]
THEME: [azure-light, azure-dark]
cmd: poetry run pyinstaller --noconfirm --distpath dist/{{.ITEM.THEME}}-{{.ITEM.KIND}} spec/azure/{{.ITEM.THEME}}-{{.ITEM.KIND}}.spec
rewrite:
internal: true
desc: Run the source code rewriter
cmds:
- poetry run python tools/rewriter.py --rewrite --theme {{.THEME}}
restore:
internal: true
desc: Restore the backup files
cmds:
- poetry run python tools/rewriter.py --restore
compress:
desc: Compress Azure artifacts
cmds:
- for:
matrix:
KIND: [basic, banana, potato]
THEME: [azure-light, azure-dark]
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/{{.ITEM.THEME}}-{{.ITEM.KIND}} -DestinationPath dist/{{.ITEM.THEME}}-{{.ITEM.KIND}}.zip -Force"'
clean:
desc: Clean build and dist directories
cmds:
- |
{{.SHELL}} -Command "Remove-Item -Path build/azure-*,dist/azure-* -Recurse -Force"

40
Taskfile.forest.yml Normal file
View File

@ -0,0 +1,40 @@
version: '3'
tasks:
build:
desc: Build Forest artifacts
deps: [rewrite]
cmds:
- defer: { task: restore }
- for:
matrix:
KIND: [basic, banana, potato]
THEME: [forest-light, forest-dark]
cmd: poetry run pyinstaller --noconfirm --distpath dist/{{.ITEM.THEME}}-{{.ITEM.KIND}} spec/forest/{{.ITEM.THEME}}-{{.ITEM.KIND}}.spec
rewrite:
internal: true
desc: Run the source code rewriter
cmds:
- poetry run python tools/rewriter.py --rewrite --theme {{.THEME}}
restore:
internal: true
desc: Restore the backup files
cmds:
- poetry run python tools/rewriter.py --restore
compress:
desc: Compress Forest artifacts
cmds:
- for:
matrix:
KIND: [basic, banana, potato]
THEME: [forest-light, forest-dark]
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/{{.ITEM.THEME}}-{{.ITEM.KIND}} -DestinationPath dist/{{.ITEM.THEME}}-{{.ITEM.KIND}}.zip -Force"'
clean:
desc: Clean build and dist directories
cmds:
- |
{{.SHELL}} -Command "Remove-Item -Path build/forest-*,dist/forest-* -Recurse -Force"

24
Taskfile.sunvalley.yml Normal file
View File

@ -0,0 +1,24 @@
version: '3'
tasks:
build:
desc: Build Sunvalley artifacts
cmds:
- for:
matrix:
KIND: [basic, banana, potato]
cmd: poetry run pyinstaller --noconfirm --distpath dist/sunvalley-{{.ITEM.KIND}} spec/sunvalley/sunvalley-{{.ITEM.KIND}}.spec
compress:
desc: Compress Sunvalley artifacts
cmds:
- for:
matrix:
KIND: [basic, banana, potato]
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/sunvalley-{{.ITEM.KIND}} -DestinationPath dist/sunvalley-{{.ITEM.KIND}}.zip -Force"'
clean:
desc: Clean build and dist directories
cmds:
- |
{{.SHELL}} -Command "Remove-Item -Path build/sunvalley-*,dist/sunvalley-* -Recurse -Force"

View File

@ -1,5 +1,19 @@
version: '3' version: '3'
includes:
sunvalley:
taskfile: ./Taskfile.sunvalley.yml
vars:
THEME: sunvalley
forest:
taskfile: ./Taskfile.forest.yml
vars:
THEME: forest
azure:
taskfile: ./Taskfile.azure.yml
vars:
THEME: azure
vars: vars:
SHELL: pwsh SHELL: pwsh
@ -18,64 +32,24 @@ tasks:
build: build:
desc: Build all artifacts desc: Build all artifacts
cmds:
- task: build-sunvalley
- echo "Sunvalley build complete"
- task: build-forest
- echo "Forest build complete"
build-sunvalley:
desc: Build Sunvalley artifacts
cmds: cmds:
- for: - for:
matrix: matrix:
KIND: [basic, banana, potato] THEME: [sunvalley, forest, azure]
cmd: poetry run pyinstaller --noconfirm --distpath dist/sunvalley-{{.ITEM.KIND}} spec/sunvalley-{{.ITEM.KIND}}.spec task: '{{.ITEM.THEME}}:build'
build-forest:
desc: Build Forest artifacts
deps: [rewrite]
cmds:
- defer: { task: restore }
- for:
matrix:
KIND: [basic, banana, potato]
THEME: [light, dark]
cmd: poetry run pyinstaller --noconfirm --distpath dist/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}} spec/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}}.spec
rewrite:
internal: true
desc: Run the source code rewriter
cmds:
- poetry run python tools/rewriter.py --rewrite
restore:
internal: true
desc: Restore the backup files
cmds:
- poetry run python tools/rewriter.py --restore
compress: compress:
deps: [compress-sunvalley, compress-forest] desc: Compress all artifacts
compress-sunvalley:
cmds: cmds:
- for: - for:
matrix: matrix:
KIND: [basic, banana, potato] THEME: [sunvalley, forest, azure]
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/sunvalley-{{.ITEM.KIND}} -DestinationPath dist/sunvalley-{{.ITEM.KIND}}.zip -Force"' task: '{{.ITEM.THEME}}:compress'
compress-forest:
cmds:
- for:
matrix:
KIND: [basic, banana, potato]
THEME: [light, dark]
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}} -DestinationPath dist/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}}.zip -Force"'
clean: clean:
desc: Clean up build and dist directories desc: Clean up build and dist directories
cmds: cmds:
- | - for:
{{.SHELL}} -Command " matrix:
Remove-Item -Path build/forest-*,build/sunvalley-*,dist/forest-*,dist/sunvalley-* -Recurse -Force" THEME: [sunvalley, forest, azure]
task: '{{.ITEM.THEME}}:clean'

View File

@ -1,10 +1,9 @@
# load a specific profile on start (file name without .toml ext) # load a specific profile on start (file name without .toml ext)
# [configs] # [configs]
# config="example" # config="example"
# load with themes enabled? set the default mode # load with themes enabled?
[theme] [theme]
enabled = true enabled = true
mode = "light"
# load in extended mode? if so which orientation # load in extended mode? if so which orientation
[extends] [extends]
extended = true extended = true
@ -22,4 +21,4 @@ size = 3
default = 0 default = 0
# show the navigation frame? # show the navigation frame?
[navigation] [navigation]
show = true show = false

View File

@ -2,12 +2,12 @@
### set the ip then uncomment ### set the ip then uncomment
# [connection-1] # [connection-1]
# kind = 'banana' # kind = 'banana'
# ip = '<ip address 1>' # ip = 'localhost'
# streamname = 'Command1' # streamname = 'Command1'
# port = 6980 # port = 6980
# [connection-2] # [connection-2]
# kind = 'potato' # kind = 'potato'
# ip = '<ip address 2>' # ip = 'gamepc.local'
# streamname = 'Command1' # streamname = 'Command1'
# port = 6980 # port = 6980

View File

@ -16,7 +16,7 @@ def write_outs(output, outs: tuple):
output.write(out) output.write(out)
def rewrite_app(): def rewrite_app(theme):
app_logger = logger.getChild('app') app_logger = logger.getChild('app')
app_logger.info('rewriting app.py') app_logger.info('rewriting app.py')
infile = Path(SRC_DIR) / 'app.bk' infile = Path(SRC_DIR) / 'app.bk'
@ -34,24 +34,28 @@ def rewrite_app():
( (
' self._vmr = vmr\n', ' self._vmr = vmr\n',
' self._theme = theme\n', ' self._theme = theme\n',
' self._theme_name = theme.split("-")[0]\n',
' self._theme_type = theme.split("-")[-1]\n',
' tcldir = Path.cwd() / "theme"\n', ' tcldir = Path.cwd() / "theme"\n',
' if not tcldir.is_dir():\n', ' if not tcldir.is_dir():\n',
' tcldir = Path.cwd() / "_internal" / "theme"\n', ' tcldir = Path.cwd() / "_internal" / "theme"\n',
' self.tk.call("source", tcldir.resolve() / f"forest-{self._theme}.tcl")\n', ' match self._theme_name:\n',
' case "forest":\n',
' self.tk.call("source", tcldir.resolve() / f"{self._theme}.tcl")\n',
' case "azure":\n',
' self.tk.call("source", tcldir.resolve() / f"{self._theme_name}.tcl")\n',
), ),
) )
# def connect() # def connect()
case 'def connect(kind_id: str, vmr) -> App:\n': case 'def connect(kind_id: str, vmr) -> App:\n':
output.write( output.write('def connect(kind_id: str, vmr, theme) -> App:\n')
'def connect(kind_id: str, vmr, theme="light") -> App:\n'
)
case ' return VMMIN_cls(vmr)\n': case ' return VMMIN_cls(vmr)\n':
output.write(' return VMMIN_cls(vmr, theme)\n') output.write(' return VMMIN_cls(vmr, theme)\n')
case _: case _:
output.write(line) output.write(line)
def rewrite_builders(): def rewrite_builders(theme):
builders_logger = logger.getChild('builders') builders_logger = logger.getChild('builders')
builders_logger.info('rewriting builders.py') builders_logger.info('rewriting builders.py')
infile = Path(SRC_DIR) / 'builders.bk' infile = Path(SRC_DIR) / 'builders.bk'
@ -71,13 +75,24 @@ def rewrite_builders():
case 'import sv_ttk\n': case 'import sv_ttk\n':
output.write('#import sv_ttk\n') output.write('#import sv_ttk\n')
case ' self.app.resizable(False, False)\n': case ' self.app.resizable(False, False)\n':
if theme.startswith('forest'):
write_outs( write_outs(
output, output,
( (
' self.app.resizable(False, False)\n' ' self.app.resizable(False, False)\n'
' if _configuration.themes_enabled:\n', ' if _configuration.themes_enabled:\n',
' ttk.Style().theme_use(f"forest-{self.app._theme}")\n', ' ttk.Style().theme_use(self.app._theme)\n',
' self.logger.info(f"Forest Theme applied")\n', ' self.logger.info(f"{self.app._theme} Theme applied")\n',
),
)
elif theme.startswith('azure'):
write_outs(
output,
(
' self.app.resizable(False, False)\n'
' if _configuration.themes_enabled:\n',
' self.app.tk.call("set_theme", self.app._theme_type)\n',
' self.logger.info(f"Azure {self.app._theme_type} Theme applied")\n',
), ),
) )
ignore_next_lines = 6 ignore_next_lines = 6
@ -171,12 +186,21 @@ def rewrite_builders():
) )
case _: case _:
if 'Toggle.TButton' in line: if 'Toggle.TButton' in line:
output.write(line.replace('Toggle.TButton', 'ToggleButton')) if theme.startswith('forest'):
output.write(
line.replace('Toggle.TButton', 'ToggleButton')
)
elif theme.startswith('azure'):
output.write(
line.replace(
'Toggle.TButton', 'Switch.TCheckbutton'
)
)
else: else:
output.write(line) output.write(line)
def rewrite_menu(): def rewrite_menu(theme):
menu_logger = logger.getChild('menu') menu_logger = logger.getChild('menu')
menu_logger.info('rewriting menu.py') menu_logger.info('rewriting menu.py')
infile = Path(SRC_DIR) / 'menu.bk' infile = Path(SRC_DIR) / 'menu.bk'
@ -199,7 +223,7 @@ def rewrite_menu():
output.write(line) output.write(line)
def prepare_for_build(): def prepare_for_build(theme):
################# MOVE FILES FROM PACKAGE DIR INTO SRC DIR ######################### ################# MOVE FILES FROM PACKAGE DIR INTO SRC DIR #########################
for file in ( for file in (
PACKAGE_DIR / 'app.py', PACKAGE_DIR / 'app.py',
@ -211,12 +235,8 @@ def prepare_for_build():
file.rename(SRC_DIR / f'{file.stem}.bk') file.rename(SRC_DIR / f'{file.stem}.bk')
###################### RUN THE FILE REWRITER FOR EACH *.BK ######################### ###################### RUN THE FILE REWRITER FOR EACH *.BK #########################
steps = ( for step in (rewrite_app, rewrite_builders, rewrite_menu):
rewrite_app, step(theme)
rewrite_builders,
rewrite_menu,
)
[step() for step in steps]
def cleanup(): def cleanup():
@ -239,12 +259,13 @@ def cleanup():
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--rewrite', action='store_true') parser.add_argument('--rewrite', action='store_true')
parser.add_argument('--theme', type=str, default='forest')
parser.add_argument('--restore', action='store_true') parser.add_argument('--restore', action='store_true')
args = parser.parse_args() args = parser.parse_args()
if args.rewrite: if args.rewrite:
logger.info('preparing files for build') logger.info('preparing files for build')
prepare_for_build() prepare_for_build(args.theme)
elif args.restore: elif args.restore:
logger.info('cleaning up files') logger.info('cleaning up files')
cleanup() cleanup()

View File

@ -60,7 +60,7 @@ _defaults = {
'submixes': { 'submixes': {
'default': 0, 'default': 0,
}, },
'navigation': {'show': True}, 'navigation': {'show': False},
} }