Skip to content

Commit 86eaa4d

Browse files
committed
Merge bitcoin/bitcoin#33482: contrib: fix macOS deployment with no translations
7b5261f contrib: fix using macdploy script without translations. (amisha) Pull request description: **Description** From what I deciphered reading the line https://github.com/bitcoin/bitcoin/blob/master/contrib/macdeploy/macdeployqtplus#L390 is that qt translations are optional to have hence we should be able to build without it but the case where the flag translations_dir falls back to its default Null value it raises this error. The config comments also mentioned that adding translation file is optional. ``` ./macdeployqtplus --help usage: macdeployqtplus [-h] [-verbose [VERBOSE]] [-no-plugins] [-no-strip] [-translations-dir path] [-zip zip] app-bundle Improved version of macdeployqt. Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .zip file. Note, that the "dist" folder will be deleted before deploying on each run. Optionally, Qt translation files (.qm) can be added to the bundle. ``` **Steps to reproduce** So I was following the general steps to set up app on macos however I didn't download any qt translations presuming it was optional from the comment linkedin in PR, so to reproduce if you have translation directories in place ull need to delete them and then try to build the file, otherwise don't download it at all and try to build it. It should fail on that flag as translations dir was never downloaded. **Approach taken** I have moved the code which adds language files under the if statement that first checks if the value of the flag is not Null before referencing it. ACKs for top commit: ismaelsadeeq: ACK 7b5261f Tree-SHA512: 8d51b17569e42c9feb95e1be17b1551c708a05eb44b82c74db0b25e07006b4ee223d64484f8bdb2ee1420f6e571686561ae1c09bd3362f77dcbb507bc5085f86
2 parents 007900e + 7b5261f commit 86eaa4d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

contrib/macdeploy/macdeployqtplus

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,18 +460,18 @@ if config.translations_dir:
460460
sys.stderr.write(f"Error: Could not find translation dir \"{config.translations_dir[0]}\"\n")
461461
sys.exit(1)
462462

463-
print("+ Adding Qt translations +")
463+
print("+ Adding Qt translations +")
464464

465-
translations = Path(config.translations_dir[0])
465+
translations = Path(config.translations_dir[0])
466466

467-
regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)')
467+
regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)')
468468

469-
lang_files = [x for x in translations.iterdir() if regex.match(x.name)]
469+
lang_files = [x for x in translations.iterdir() if regex.match(x.name)]
470470

471-
for file in lang_files:
472-
if verbose:
473-
print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name))
474-
shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name))
471+
for file in lang_files:
472+
if verbose:
473+
print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name))
474+
shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name))
475475

476476
# ------------------------------------------------
477477

0 commit comments

Comments
 (0)