From f19b5d6ea6cf14d89844653953ec05683b995210 Mon Sep 17 00:00:00 2001 From: glubsy Date: Fri, 24 Jul 2020 03:12:40 +0200 Subject: [PATCH 1/4] Fix error in package script for (Arch) Linux * While packaging, the "build/help" and "build/locale" directories are not found. * Work around the issue with try/except statements. --- package.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/package.py b/package.py index be949bce..f89a5a60 100644 --- a/package.py +++ b/package.py @@ -43,8 +43,14 @@ def copy_files_to_package(destpath, packages, with_so): shutil.copy("run.py", op.join(destpath, "run.py")) extra_ignores = ["*.so"] if not with_so else None copy_packages(packages, destpath, extra_ignores=extra_ignores) - shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) - shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) + try: + shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) + except Exception as e: + print(f"Warning: exception: {e}") + try: + shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) + except Exception as e: + print(f"Warning: exception: {e}") compileall.compile_dir(destpath) From 49a1beb22506902e8f0203f8ab4595211b80f1b5 Mon Sep 17 00:00:00 2001 From: glubsy Date: Fri, 24 Jul 2020 03:33:13 +0200 Subject: [PATCH 2/4] Avoid using workarounds in package script * Just like the Windows package function counterpart, better abort building the package if the help and locale files have not been build instead of ignoring the error --- package.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/package.py b/package.py index f89a5a60..693baee8 100644 --- a/package.py +++ b/package.py @@ -43,14 +43,17 @@ def copy_files_to_package(destpath, packages, with_so): shutil.copy("run.py", op.join(destpath, "run.py")) extra_ignores = ["*.so"] if not with_so else None copy_packages(packages, destpath, extra_ignores=extra_ignores) - try: - shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) - except Exception as e: - print(f"Warning: exception: {e}") - try: - shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) - except Exception as e: - print(f"Warning: exception: {e}") + # include locale files if they are built otherwise exit as it will break + # the localization + if not op.exists("build/locale"): + print("Locale files not built, exiting...") + return + # include help files if they are built otherwise exit as they should be included? + if not op.exists("build/help"): + print("Help files not built, exiting...") + return + shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) + shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) compileall.compile_dir(destpath) From f0adf35db45b10d85bcc1217614e3063bce40480 Mon Sep 17 00:00:00 2001 From: glubsy Date: Fri, 24 Jul 2020 03:48:07 +0200 Subject: [PATCH 3/4] Add helpful message in build files are missing --- package.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.py b/package.py index 693baee8..d66eedda 100644 --- a/package.py +++ b/package.py @@ -46,11 +46,11 @@ def copy_files_to_package(destpath, packages, with_so): # include locale files if they are built otherwise exit as it will break # the localization if not op.exists("build/locale"): - print("Locale files not built, exiting...") + print("Locale files are missing. Have you run \"build.py --loc\"? Exiting...") return # include help files if they are built otherwise exit as they should be included? if not op.exists("build/help"): - print("Help files not built, exiting...") + print("Help files are missing. Have you run \"build.py --help\"? Exiting...") return shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) @@ -161,11 +161,11 @@ def package_windows(): # include locale files if they are built otherwise exit as it will break # the localization if not op.exists("build/locale"): - print("Locale files not built, exiting...") + print("Locale files are missing. Have you run \"build.py --loc\"? Exiting...") return # include help files if they are built otherwise exit as they should be included? if not op.exists("build/help"): - print("Help files not built, exiting...") + print("Help files are missing. Have you run \"build.py --help\"? Exiting...") return # create version information file from template try: From d193e1fd12f426503ffabdc5b8926b23c14835d4 Mon Sep 17 00:00:00 2001 From: glubsy Date: Fri, 24 Jul 2020 03:50:08 +0200 Subject: [PATCH 4/4] Fix typo in error message --- package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.py b/package.py index d66eedda..aa876b36 100644 --- a/package.py +++ b/package.py @@ -50,7 +50,7 @@ def copy_files_to_package(destpath, packages, with_so): return # include help files if they are built otherwise exit as they should be included? if not op.exists("build/help"): - print("Help files are missing. Have you run \"build.py --help\"? Exiting...") + print("Help files are missing. Have you run \"build.py --doc\"? Exiting...") return shutil.copytree(op.join("build", "help"), op.join(destpath, "help")) shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale")) @@ -165,7 +165,7 @@ def package_windows(): return # include help files if they are built otherwise exit as they should be included? if not op.exists("build/help"): - print("Help files are missing. Have you run \"build.py --help\"? Exiting...") + print("Help files are missing. Have you run \"build.py --doc\"? Exiting...") return # create version information file from template try: