refactor: make reclone default behavior, add --no-reclone to skip

This commit is contained in:
justin committed 2026-04-22 17:07:05 -07:00
1 parent 90f21bee3d
commit d802b830ae
2 files changed
+22 -11

No files matched your search

+6 -5
View File
@@ -63,10 +63,10 @@ def get_local_head_sha():
return None return None
def clone_repo(force: bool = False): def clone_repo(force: bool = True):
print("[1/3] Preparing CrossPoint repository...") print("[1/3] Preparing CrossPoint repository...")
if os.path.exists(REPO_DIR) and not force: if not force and os.path.exists(REPO_DIR):
print(" Existing repo found, checking remote for updates...") print(" Existing repo found, checking remote for updates...")
remote_sha = get_remote_head_sha() remote_sha = get_remote_head_sha()
local_sha = get_local_head_sha() local_sha = get_local_head_sha()
@@ -278,9 +278,10 @@ def parse_args():
help="Auto-answer Y to all plugin install prompts", help="Auto-answer Y to all plugin install prompts",
) )
parser.add_argument( parser.add_argument(
"--reclone", "--no-reclone",
action="store_true", action="store_true",
help="Force re-clone of the CrossPoint repository even if it already exists", dest="no_reclone",
help="Skip re-cloning if CrossPoint repo already exists and matches remote",
) )
return parser.parse_args() return parser.parse_args()
@@ -305,7 +306,7 @@ def main():
print(" Aborted.") print(" Aborted.")
sys.exit(0) sys.exit(0)
print() print()
clone_repo(force=args.reclone) clone_repo(force=not args.no_reclone)
apply_plugins(yes_all=args.yes) apply_plugins(yes_all=args.yes)
build_and_flash(args.environment) build_and_flash(args.environment)
print("\nDone.") print("\nDone.")
+16 -6
View File
@@ -216,15 +216,25 @@ def patch_settings_list_h(repo_dir):
path = find_first("SettingsList.h", repo_dir) path = find_first("SettingsList.h", repo_dir)
content = read_file(path) content = read_file(path)
if 'STR_NONE_OPT}, "fontFamily"' in content: already_patched = 'STR_NONE_OPT}, "fontFamily"' in content and 'bookerlyInstalled' in content
if already_patched:
print(" SettingsList.h already patched, skipping.") print(" SettingsList.h already patched, skipping.")
return return
if 'STR_NONE_OPT}, "fontFamily"' not in content:
content = content.replace( content = content.replace(
'{StrId::STR_NOTO_SERIF, StrId::STR_NOTO_SANS, StrId::STR_OPEN_DYSLEXIC}, "fontFamily"', '{StrId::STR_NOTO_SERIF, StrId::STR_NOTO_SANS, StrId::STR_OPEN_DYSLEXIC}, "fontFamily"',
'{StrId::STR_NOTO_SERIF, StrId::STR_NOTO_SANS, StrId::STR_OPEN_DYSLEXIC, StrId::STR_NONE_OPT}, "fontFamily"' '{StrId::STR_NOTO_SERIF, StrId::STR_NOTO_SANS, StrId::STR_OPEN_DYSLEXIC, StrId::STR_NONE_OPT}, "fontFamily"'
) )
if 'bookerlyInstalled' not in content:
content = content.replace(
' };\n return list;\n}\n',
' SettingInfo::Enum(StrId::STR_NONE_OPT, &CrossPointSettings::fontFamily,\n'
' {StrId::STR_NONE_OPT}, "bookerlyInstalled"),\n'
' };\n return list;\n}\n'
)
write_file(path, content) write_file(path, content)
print(" SettingsList.h patched.") print(" SettingsList.h patched.")
@@ -312,16 +322,13 @@ def patch_settings_activity_cpp(repo_dir):
' const auto confirmLabel = (selectedSettingIndex == 0) ? nextCatLabel : tr(STR_TOGGLE);' ' const auto confirmLabel = (selectedSettingIndex == 0) ? nextCatLabel : tr(STR_TOGGLE);'
) )
if '"Bookerly"' not in content: if '"Bookerly Plugin"' not in content:
content = content.replace( content = content.replace(
' [&settings](int index) { return std::string(I18N.get(settings[index].nameId)); },', ' [&settings](int index) { return std::string(I18N.get(settings[index].nameId)); },',
' [&settings, this](int index) -> std::string {\n' ' [&settings, this](int index) -> std::string {\n'
' if (settings[index].key && std::string(settings[index].key) == "fontFamily") {\n'
' const uint8_t val = SETTINGS.*(settings[index].valuePtr);\n'
' if (val == CrossPointSettings::BOOKERLY) return "Bookerly";\n'
' }\n'
' if (selectedCategoryIndex == 4) {\n' ' if (selectedCategoryIndex == 4) {\n'
' const auto& s = settings[index];\n' ' const auto& s = settings[index];\n'
' if (s.key && std::string(s.key) == "bookerlyInstalled") return "Bookerly Plugin";\n'
' if (s.key && std::string(s.key) == "darkModeState") return "Dark Mode";\n' ' if (s.key && std::string(s.key) == "darkModeState") return "Dark Mode";\n'
' if (s.key && std::string(s.key) == "smallerFontsMode") return "Smaller Fonts";\n' ' if (s.key && std::string(s.key) == "smallerFontsMode") return "Smaller Fonts";\n'
' }\n' ' }\n'
@@ -329,10 +336,13 @@ def patch_settings_activity_cpp(repo_dir):
' },' ' },'
) )
if '"Bookerly"' not in content:
content = content.replace( content = content.replace(
' } else {\n' ' } else {\n'
' valueText = I18N.get(setting.enumValues[value]);\n' ' valueText = I18N.get(setting.enumValues[value]);\n'
' }', ' }',
' } else if (setting.key && std::string(setting.key) == "bookerlyInstalled") {\n'
' valueText = "Installed";\n'
' } else if (setting.key && std::string(setting.key) == "fontFamily" && value == CrossPointSettings::BOOKERLY) {\n' ' } else if (setting.key && std::string(setting.key) == "fontFamily" && value == CrossPointSettings::BOOKERLY) {\n'
' valueText = "Bookerly";\n' ' valueText = "Bookerly";\n'
' } else {\n' ' } else {\n'