1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
import os
import subprocess
import shutil
SOURCE_DIR = os.environ.get("SOURCE_DIR", "..")
DIST_DIR = os.environ.get("DIST_DIR", os.path.join(SOURCE_DIR, "dist"))
DMG_PATH = "Ultimaker-Cura.dmg"
APP_PATH = "Ultimaker-Cura.app"
ULTIMAKER_CURA_DOMAIN = os.environ.get("ULTIMAKER_CURA_DOMAIN", "nl.ultimaker.cura")
def build_dmg() -> 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_DIR}/packaging/icons/VolumeIcons_Cura.icns",
"--icon-size", "90",
"--icon", "Ultimaker-Cura.app", "169", "272",
"--eula", f"{SOURCE_DIR}/packaging/cura_license.txt",
"--background", f"{SOURCE_DIR}/packaging/icons/cura_background_dmg.png",
DMG_PATH,
APP_PATH]
subprocess.run(arguments)
def sign(file_path: str) -> None:
codesign_executable = os.environ.get("CODESIGN", "codesign")
codesign_identity = os.environ.get("CODESIGN_IDENTITY", "A831301292FC30F84F3C137F2141401620EE5FA0")
arguments = [codesign_executable,
"-s", codesign_identity,
"--timestamp",
"-i", f"{ULTIMAKER_CURA_DOMAIN}.dmg",
file_path]
subprocess.run(arguments)
def notarize() -> None:
notarize_user = os.environ.get("NOTARIZE_USER")
notarize_password = os.environ.get("NOTARIZE_PASSWORD")
altool_executable = os.environ.get("ALTOOL_EXECUTABLE", "altool")
arguments = [
"xcrun", altool_executable,
"--notarize-app",
"--primary-bundle-id", ULTIMAKER_CURA_DOMAIN,
"--username", notarize_user,
"--password", notarize_password,
"--file", DMG_PATH
]
subprocess.run(arguments)
if __name__ == "__main__":
try:
os.rename(os.path.join(DIST_DIR, "Ultimaker-Cura"), os.path.join(DIST_DIR, "Ultimaker-Cura.app"))
except:
pass
sign(APP_PATH)
build_dmg()
sign(DMG_PATH)
# notarize_dmg = bool(os.environ.get("NOTARIZE_DMG", "TRUE"))
# if notarize_dmg:
# notarize()
|