From 5a12ad2a7148482168f89116af93b18af12d951d Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 20:13:49 +0200 Subject: [PATCH] Allow the build_macos script to build both dmg/pkg on the same runner Why should we build the installer twice? Contributes to CURA-8415 --- packaging/MacOS/build_macos.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packaging/MacOS/build_macos.py b/packaging/MacOS/build_macos.py index dcde629900..bea248b324 100644 --- a/packaging/MacOS/build_macos.py +++ b/packaging/MacOS/build_macos.py @@ -21,6 +21,7 @@ def build_dmg(source_path: str, dist_path: str, filename: str, app_name: str) -> "--icon", app_name, "169", "272", "--eula", f"{source_path}/packaging/cura_license.txt", "--background", f"{source_path}/packaging/MacOs/cura_background_dmg.png", + "--hdiutil-quiet", f"{dist_path}/{filename}", f"{dist_path}/{app_name}"] @@ -141,7 +142,9 @@ if __name__ == "__main__": parser.add_argument("source_path", type = str, help = "Path to Pyinstaller source folder") parser.add_argument("dist_path", type = str, help = "Path to Pyinstaller dist folder") parser.add_argument("cura_conan_version", type = str, help="The version of cura") - parser.add_argument("filename", type = str, help = "Filename of the pkg/dmg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64.pkg' or 'UltiMaker-Cura-5.1.0-beta-Macos-X64.dmg')") + parser.add_argument("filename", type = str, help = "Filename of the pkg/dmg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64' or 'UltiMaker-Cura-5.1.0-beta-Macos-X64')") + parser.add_argument("build_pkg", type = bool, default = False, help = "build the pkg") + parser.add_argument("build_dmg", type = bool, default = True, help = "build the dmg") parser.add_argument("app_name", type = str, help = "Filename of the .app that will be contained within the dmg/pkg") args = parser.parse_args() @@ -149,7 +152,7 @@ if __name__ == "__main__": app_name = f"{args.app_name}.app" - if Path(args.filename).suffix == ".pkg": - create_pkg_installer(args.filename, args.dist_path, cura_version, app_name) - else: - create_dmg(args.filename, args.dist_path, args.source_path, app_name) + if args.build_pkg: + create_pkg_installer(args.filename + ".pkg", args.dist_path, cura_version, app_name) + if args.build_dmg: + create_dmg(args.filename + ".dmg", args.dist_path, args.source_path, app_name)