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

Commit

Permalink
fix: small path issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nullishamy committed May 25, 2024
1 parent 542e611 commit 23ad967
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ bin/
lib*/
*.cfg
.direnv
./build/
build/
*.log
.ruff-cache
.tmp

# Releases folder
releases
Expand Down
4 changes: 2 additions & 2 deletions sources/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

def execute_build(git_root: str, args: Namespace):
colloid_dir = f"{git_root}/sources/colloid"
colloid_tmp_dir = f"{git_root}/sources/colloid-tmp-{args.flavor}"
colloid_tmp_dir = f"{git_root}/.tmp/colloid-tmp-{args.flavor}"

shutil.copytree(colloid_dir, colloid_tmp_dir)

src_dir = colloid_tmp_dir + "/src"

if args.patch:
patch_dir = git_root + "/sources//patches/colloid/"
patch_dir = git_root + "/sources/patches/colloid/"
apply_colloid_patches(colloid_tmp_dir, patch_dir)

if args.zip:
Expand Down
12 changes: 8 additions & 4 deletions sources/build/patches.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import os
import subprocess
from pathlib import Path
from .logger import logger


def apply_colloid_patches(colloid_dir, patch_dir):
if os.path.isfile(colloid_dir + "/.patched"):
colloid_dir = Path(colloid_dir).relative_to(os.getcwd())
if os.path.isfile(colloid_dir / ".patched"):
logger.info(
f'Patches seem to be applied, remove "{colloid_dir}/.patched" to force application (this may fail)'
)
Expand All @@ -20,12 +23,13 @@ def apply_colloid_patches(colloid_dir, patch_dir):
"sass-palette-latte.patch",
"sass-palette-macchiato.patch",
]:
path = f"{patch_dir}/{patch}"
path = (Path(patch_dir) / patch).relative_to(os.getcwd())
logger.info(f"Applying patch '{patch}', located at '{path}'")
subprocess.check_call(
["git", "apply", path, "--directory", os.path.basename(colloid_dir)])
["git", "apply", str(path), "--directory", str(colloid_dir)]
)

with open(colloid_dir + "/.patched", "w") as f:
with open(colloid_dir / ".patched", "w") as f:
f.write("true")

logger.info("Patching finished.")
3 changes: 2 additions & 1 deletion sources/build/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def apply_tweaks(ctx: BuildContext):
ctx.apply_tweak("compact", "'false'", "'true'")

find_and_replace(
f"{ctx.src_dir}/sass/_tweaks-temp.scss",
f"{ctx.colloid_src_dir}/sass/_tweaks-temp.scss",
Subsitution(
find="@import 'color-palette-default';",
replace=f"@import 'color-palette-catppuccin-{ctx.flavor.identifier}';",
Expand Down Expand Up @@ -345,6 +345,7 @@ def zip_artifacts(dir_list, zip_name, remove=True):
def build_with_context(ctx: BuildContext):
build_info = f"""Build info:
build_root: {ctx.output_root}
src_root: {ctx.colloid_src_dir}
theme_name: {ctx.theme_name}
flavor: {ctx.flavor.identifier}
accent: {ctx.accent.identifier}
Expand Down

0 comments on commit 23ad967

Please sign in to comment.