ykit/buildtool/task/patch_resources.py

29 lines
857 B
Python

from .util import *
from . import fileutil
import shutil
from polly.patcher import process_all_patches
# Task dependencies
from .extract import extract
def patch_resources():
_ = extract()
first_time = False
# Copy original resources only the first time
if not PATCHED_RSC_DIR.exists():
print("Copying original resources...")
shutil.copytree(EXTRACTED_DIR, PATCHED_RSC_DIR, ignore=shutil.ignore_patterns("smali*"))
first_time = True
s = fileutil.merge_into(SRC_RESOURCES_DIR, PATCHED_RSC_DIR, check_date=not first_time)
if s:
print("Copied custom resources from src/resources")
else:
print("Skipped copying resources from src/resources")
# Patch other resources
process_all_patches(SRC_PATCHES_DIR, check_date=not first_time)