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
This commit is contained in:
Jelle Spijker 2023-08-18 20:13:49 +02:00
parent 23c407150c
commit 5a12ad2a71
No known key found for this signature in database
GPG key ID: 034D1C0527888B65

View file

@ -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)