contrib: fix using macdploy script without translations.
What changed, and why it matters
This is a build-script bug fix. The macOS packaging helper would crash with an error if no Qt translation directory was provided, because it tried to use a NULL/default value. The fix simply skips the translation-copying step when no directory is configured. It does not affect Bitcoin's network code, wallet security, or consensus rules.
No security action required; treat as a normal build-system fix.
Security signals we found
None identified: change is a build-time script robustness fix for an optional resource directory.
Evidence from the diff
In contrib/macdeploy/macdeployqtplus, the Qt translation deployment block was unconditionally executed after parsing config.translations_dir. When the option was absent, config.translations_dir fell back to None/NULL, causing the script to fail. The patch indents the translation setup, regex, file iteration, and copy loop under the existing if config.translations_dir: guard so it only runs when translations are actually supplied. No cryptographic, networking, or consensus code is changed.
Changed components
contrib/macdeploy/macdeployqtplus build scriptInspect captured patch +8 / −8
diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus
index 571485e5..476ac133 100755
--- a/contrib/macdeploy/macdeployqtplus
+++ b/contrib/macdeploy/macdeployqtplus
@@ -460,18 +460,18 @@ if config.translations_dir:
sys.stderr.write(f"Error: Could not find translation dir \"{config.translations_dir[0]}\"\n")
sys.exit(1)
-print("+ Adding Qt translations +")
+ print("+ Adding Qt translations +")
-translations = Path(config.translations_dir[0])
+ translations = Path(config.translations_dir[0])
-regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)')
+ regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)')
-lang_files = [x for x in translations.iterdir() if regex.match(x.name)]
+ lang_files = [x for x in translations.iterdir() if regex.match(x.name)]
-for file in lang_files:
- if verbose:
- print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name))
- shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name))
+ for file in lang_files:
+ if verbose:
+ print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name))
+ shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name))
# ------------------------------------------------
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.