Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: argument --accent behaves like the old argument (#200)
Browse files Browse the repository at this point in the history
* fix: argument --accent behaves like the old argument

* fix: seprate arg for all accents

* fix: logger accurracy

* ci: call correct build arg
  • Loading branch information
isabelroses authored May 20, 2024
1 parent 8d8949e commit 66c2314
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 45 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
run: sudo apt update && sudo apt install -y sassc inkscape optipng
- name: Generate themes
run: |
python ./build.py mocha -a all --zip -d $PWD/releases &&
python ./build.py macchiato -a all --zip -d $PWD/releases &&
python ./build.py frappe -a all --zip -d $PWD/releases &&
python ./build.py latte -a all --zip -d $PWD/releases
python ./build.py mocha --all-accents --zip -d $PWD/releases &&
python ./build.py macchiato --all-accents --zip -d $PWD/releases &&
python ./build.py frappe --all-accents --zip -d $PWD/releases &&
python ./build.py latte --all-accents --zip -d $PWD/releases
- name: Add zips to release
uses: softprops/action-gh-release@v2
with:
Expand Down
80 changes: 39 additions & 41 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python3
#!/usr/bin/env python3
import os, re, shutil, subprocess, argparse, glob, logging, zipfile

from dataclasses import dataclass
Expand Down Expand Up @@ -525,7 +525,8 @@ def parse_args():
"-a",
type=str,
default="mauve",
dest="accent",
nargs='+',
dest="accents",
choices=[
"rosewater",
"flamingo",
Expand All @@ -541,11 +542,17 @@ def parse_args():
"sapphire",
"blue",
"lavender",
"all",
],
help="Accent of the theme.",
)

parser.add_argument(
"--all-accents",
help="Whether to build all accents",
dest="all_accents",
action="store_true",
)

parser.add_argument(
"--size",
"-s",
Expand Down Expand Up @@ -598,44 +605,35 @@ def main():
tweaks = Tweaks(tweaks=args.tweaks)

palette = getattr(PALETTE, args.flavor)
accents = [
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
]

if args.accent == "all":
for accent in accents:
accent = getattr(palette.colors, accent)

ctx = BuildContext(
build_root=args.dest,
theme_name=args.name,
flavor=palette,
accent=accent,
size=args.size,
tweaks=tweaks,
output_format=output_format,
)

tweaks_temp()
gnome_shell_version()
build_theme(ctx)
logger.info("Done!")
else:
accent = getattr(palette.colors, args.accent)
accents = args.accents
if args.all_accents:
accents = [
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
]

for accent in accents:
accent = getattr(palette.colors, accent)

tweaks = Tweaks(tweaks=args.tweaks)

if args.zip:
output_format = "zip"
else:
output_format = "dir"
ctx = BuildContext(
build_root=args.dest,
theme_name=args.name,
Expand All @@ -645,15 +643,15 @@ def main():
tweaks=tweaks,
output_format=output_format,
)

logger.info("Building temp tweaks file")
tweaks_temp()
logger.info("Inserting gnome-shell imports")
gnome_shell_version()
logger.info("Building main theme")
build_theme(ctx)
logger.info("Done!")
logger.info(f"Completed {palette.identifier} with {accent.identifier}")

logger.info("Done!")

try:
main()
Expand Down

0 comments on commit 66c2314

Please sign in to comment.