|
@@ -9,6 +9,24 @@ from pathlib import Path
|
|
|
|
|
|
ULTIMAKER_CURA_DOMAIN = os.environ.get("ULTIMAKER_CURA_DOMAIN", "nl.ultimaker.cura")
|
|
|
|
|
|
+def build_dmg(source_path: str, dist_path: str, filename: str) -> None:
|
|
|
+ create_dmg_executable = os.environ.get("CREATE_DMG_EXECUTABLE", "create-dmg")
|
|
|
+
|
|
|
+ arguments = [create_dmg_executable,
|
|
|
+ "--window-pos", "640", "360",
|
|
|
+ "--window-size", "690", "503",
|
|
|
+ "--app-drop-link", "520", "272",
|
|
|
+ "--volicon", f"{source_path}/packaging/icons/VolumeIcons_Cura.icns",
|
|
|
+ "--icon-size", "90",
|
|
|
+ "--icon", "UltiMaker-Cura.app", "169", "272",
|
|
|
+ "--eula", f"{source_path}/packaging/cura_license.txt",
|
|
|
+ "--background", f"{source_path}/packaging/MacOs/cura_background_dmg.png",
|
|
|
+ f"{dist_path}/{filename}",
|
|
|
+ f"{dist_path}/UltiMaker-Cura.app"]
|
|
|
+
|
|
|
+ subprocess.run(arguments)
|
|
|
+
|
|
|
+
|
|
|
def build_pkg(dist_path: str, app_filename: str, component_filename: str, installer_filename: str) -> None:
|
|
|
""" Builds and signs the pkg installer.
|
|
|
|
|
@@ -102,10 +120,33 @@ def create_pkg_installer(filename: str, dist_path: str) -> None:
|
|
|
if notarize:
|
|
|
notarize_file(dist_path, filename)
|
|
|
|
|
|
+
|
|
|
+def create_dmg(filename: str, dist_path: str, source_path: str) -> None:
|
|
|
+ """ Creates a dmg executable from UltiMaker-Cura.app named {filename}.dmg
|
|
|
+
|
|
|
+ @param filename: The name of the app file and the output dmg file without the extension
|
|
|
+ @param dist_path: The location to read the app from and save the dmg to
|
|
|
+ @param source_path: The location of the project source files
|
|
|
+ """
|
|
|
+
|
|
|
+ dmg_filename = f"{filename}.dmg"
|
|
|
+
|
|
|
+ build_dmg(source_path, dist_path, dmg_filename)
|
|
|
+
|
|
|
+ notarize_dmg = bool(os.environ.get("NOTARIZE_DMG", "TRUE"))
|
|
|
+ if notarize_dmg:
|
|
|
+ notarize_file(dist_path, dmg_filename)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == "__main__":
|
|
|
parser = argparse.ArgumentParser(description = "Create installer for Cura.")
|
|
|
parser.add_argument("dist_path", type = str, help="Path to Pyinstaller dist folder")
|
|
|
parser.add_argument("filename", type = str, help = "Filename of the pkg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64.pkg')")
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
- create_pkg_installer(args.filename, args.dist_path)
|
|
|
+ if Path(args.filename).suffix == ".pkg":
|
|
|
+ create_pkg_installer(args.filename, args.dist_path)
|
|
|
+ elif Path(args.filename).suffix == ".dmg":
|
|
|
+ create_dmg(args.filename, args.dist_path, args.source_path)
|
|
|
+ else:
|
|
|
+ create_dmg(args.filename, args.dist_path, args.source_path)
|