mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
71 lines
2.2 KiB
Python
71 lines
2.2 KiB
Python
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()
|