コード例 #1
0
    def createPackage(self):
        """ create a package """
        CraftCore.log.debug("packaging using the MacDMGPackager")

        defines = self.setDefaults(self.defines)
        # TODO: provide an image with dbg files
        if not self.internalCreatePackage(defines):
            return False
        appPath = self.getMacAppPath(defines)
        if not appPath:
            return False
        archive = os.path.normpath(self.archiveDir())

        CraftCore.log.info(f"Packaging {appPath}")

        dmgDest = defines["setupname"]
        if os.path.exists(dmgDest):
            utils.deleteFile(dmgDest)
        appName = defines['appname'] + ".app"
        if not utils.system(["create-dmg", "--volname", os.path.basename(dmgDest),
                                # Add a drop link to /Applications:
                                "--icon", appName, "140", "150", "--app-drop-link", "350", "150",
                                dmgDest, appPath]):
            return False

        if not CodeSign.signMacPackage(dmgDest):
                return False
        CraftHash.createDigestFiles(dmgDest)

        return True
コード例 #2
0
    def createPackage(self):
        """ create a package """
        CraftCore.log.debug("packaging using the MacDMGPackager")
        if not CraftCore.cache.findApplication("packagesutil"):
            CraftCore.log.critical(
                "Craft requires dev-utils/packagesdev to create a package, please install dev-utils/packagesdev\n"
                "\t'craft dev-utils/packagesdev'")
            return False

        defines = self.setDefaults(self.defines)
        if not "pkgproj" in defines:
            CraftCore.log.error(
                "Cannot not create .pkg because no .pkgproj was defined.")
            return False
        if not self.internalCreatePackage(
                defines, seperateSymbolFiles=True, packageSymbols=True):
            return False

        packageDest = Path(defines["setupname"])
        if packageDest.exists():
            utils.deleteFile(packageDest)

        pkgprojPath = defines["pkgproj"]
        # set output file basename
        packagesutil = CraftCore.cache.findApplication("packagesutil")
        if not utils.system([
                packagesutil, '--file', pkgprojPath, 'set', 'project', 'name',
                packageDest.stem
        ]):
            return False

        packagesbuild = CraftCore.cache.findApplication("packagesbuild")
        if not utils.system([
                packagesbuild, "-v", '--reference-folder',
                os.path.dirname(self.getMacAppPath(defines)), '--build-folder',
                packageDest.parent, pkgprojPath
        ]):
            return False

        if not CodeSign.signMacPackage(packageDest):
            return False

        CraftHash.createDigestFiles(packageDest)

        return True