dmg-builder 26.4.0 → 26.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/dmgUtil.js +1 -0
- package/out/dmgUtil.js.map +1 -1
- package/package.json +3 -3
- package/vendor/dmgbuild/__init__.py +1 -1
- package/vendor/dmgbuild/__main__.py +4 -1
- package/vendor/dmgbuild/badge.py +1 -1
- package/vendor/dmgbuild/colors.py +10 -10
- package/vendor/dmgbuild/core.py +26 -24
- package/vendor/dmgbuild/licensing.py +21 -19
package/out/dmgUtil.js
CHANGED
|
@@ -99,6 +99,7 @@ async function customizeDmg({ appPath, artifactPath, volumeName, specification,
|
|
|
99
99
|
const settings = {
|
|
100
100
|
title: path.basename(volumePath),
|
|
101
101
|
icon: await packager.getResource(specification.icon),
|
|
102
|
+
"badge-icon": await packager.getResource(specification.badgeIcon),
|
|
102
103
|
"icon-size": specification.iconSize,
|
|
103
104
|
"text-size": iconTextSize,
|
|
104
105
|
"compression-level": Number(process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || "9"),
|
package/out/dmgUtil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dmgUtil.js","sourceRoot":"","sources":["../src/dmgUtil.ts"],"names":[],"mappings":";;;AAWA,gDAEC;AAED,4CAEC;AAED,4CAoBC;AAqBD,wBASC;AAED,8CASC;AAGD,0CASC;AAUD,oCAyFC;AAED,sEAaC;AAED,sDA8BC;AA7OD,+CAAoF;AACpF,6BAA4B;AAC5B,qCAA6D;AAC7D,uCAAoC;AAGpC,6BAAiC;AAAxB,gGAAA,SAAS,OAAA;AAElB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAEvC,SAAgB,kBAAkB;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AACrC,CAAC;AAED,SAAgB,gBAAgB;IAC9B,O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,CAAA;IAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAQ;QACV,CAAC;QAED,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEpC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,GAAG,CAAC,CAAA;QAChE,CAAC;QAED,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;YACzB,KAAK,GAAG,KAAK,CAAA;QACf,CAAC;aAAM,IAAI,GAAG,KAAK,aAAa,EAAE,CAAC;YACjC,MAAM,GAAG,KAAK,CAAA;QAChB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC1B,CAAC","sourcesContent":["import { DmgOptions, MacPackager, PlatformPackager } from \"app-builder-lib\"\nimport { exec, executeFinally, exists, isEmptyOrSpaces, TmpDir } from \"builder-util\"\nimport * as path from \"path\"\nimport { hdiUtil, hdiutilTransientExitCodes } from \"./hdiuil\"\nimport { writeFile } from \"fs-extra\"\nimport { DmgBuildConfig } from \"./dmg\"\n\nexport { DmgTarget } from \"./dmg\"\n\nconst root = path.join(__dirname, \"..\")\n\nexport function getDmgTemplatePath() {\n return path.join(root, \"templates\")\n}\n\nexport function getDmgVendorPath() {\n return path.join(root, \"vendor\")\n}\n\nexport async function attachAndExecute(dmgPath: string, readWrite: boolean, task: (devicePath: string) => Promise<any>) {\n //noinspection SpellCheckingInspection\n const args = [\"attach\", \"-noverify\", \"-noautoopen\"]\n if (readWrite) {\n args.push(\"-readwrite\")\n }\n\n args.push(dmgPath)\n const attachResult = await hdiUtil(args)\n const deviceResult = attachResult == null ? null : /^(\\/dev\\/\\w+)/.exec(attachResult)\n const device = deviceResult == null || deviceResult.length !== 2 ? null : deviceResult[1]\n if (device == null) {\n throw new Error(`Cannot mount: ${attachResult}`)\n }\n const volumePath = await findMountPath(path.basename(device))\n if (volumePath == null) {\n throw new Error(`Cannot find volume mount path for device: ${device}`)\n }\n\n return await executeFinally(task(volumePath), () => detach(device))\n}\n\n/**\n * Find the mount path for a specific device from `hdiutil info`.\n */\nasync function findMountPath(devName: string, index: number = 1): Promise<string | null> {\n const info = await hdiUtil([\"info\"])\n const lines = info!.split(\"\\n\")\n const regex = new RegExp(`^/dev/${devName}(s\\\\d+)?\\\\s+\\\\S+\\\\s+(/Volumes/.+)$`)\n const matches: string[] = []\n\n for (const line of lines) {\n const result = regex.exec(line)\n if (result && result.length >= 3) {\n matches.push(result[2])\n }\n }\n\n return matches.length >= index ? matches[index - 1] : null\n}\n\nexport async function detach(name: string) {\n return hdiUtil([\"detach\", \"-quiet\", name]).catch(async e => {\n if (hdiutilTransientExitCodes.has(e.code)) {\n // Delay then force unmount with verbose output\n await new Promise(resolve => setTimeout(resolve, 3000))\n return hdiUtil([\"detach\", \"-force\", name])\n }\n throw e\n })\n}\n\nexport async function computeBackground(packager: PlatformPackager<any>): Promise<string> {\n const resourceList = await packager.resourceList\n if (resourceList.includes(\"background.tiff\")) {\n return path.join(packager.buildResourcesDir, \"background.tiff\")\n } else if (resourceList.includes(\"background.png\")) {\n return path.join(packager.buildResourcesDir, \"background.png\")\n } else {\n return path.join(getDmgTemplatePath(), \"background.tiff\")\n }\n}\n\n/** @internal */\nexport function serializeString(data: string) {\n return (\n ' $\"' +\n data\n .match(/.{1,32}/g)!\n .map(it => it.match(/.{1,4}/g)!.join(\" \"))\n .join('\"\\n $\"') +\n '\"'\n )\n}\n\ntype DmgBuilderConfig = {\n appPath: string\n artifactPath: string\n volumeName: string\n specification: DmgOptions\n packager: MacPackager\n}\n\nexport async function customizeDmg({ appPath, artifactPath, volumeName, specification, packager }: DmgBuilderConfig): Promise<boolean> {\n const isValidIconTextSize = !!specification.iconTextSize && specification.iconTextSize >= 10 && specification.iconTextSize <= 16\n const iconTextSize = isValidIconTextSize ? specification.iconTextSize : 12\n const volumePath = path.join(\"/Volumes\", volumeName)\n // https://github.com/electron-userland/electron-builder/issues/2115\n const backgroundFile = specification.background == null ? null : await transformBackgroundFileIfNeed(specification.background, packager.info.tempDirManager)\n\n const settings: DmgBuildConfig = {\n title: path.basename(volumePath),\n icon: await packager.getResource(specification.icon),\n \"icon-size\": specification.iconSize,\n \"text-size\": iconTextSize,\n\n \"compression-level\": Number(process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || \"9\"),\n // filesystem: specification.filesystem || \"HFS+\",\n format: specification.format,\n contents:\n specification.contents?.map(c => ({\n path: c.path || appPath, // path is required, when ommitted, appPath is used (backward compatibility\n x: c.x,\n y: c.y,\n name: c.name,\n type: c.type === \"dir\" ? \"file\" : c.type, // appdmg expects \"file\" for directories\n // hide_extension: c.hideExtension,\n })) || [],\n }\n\n if (specification.backgroundColor != null || specification.background == null) {\n settings[\"background-color\"] = specification.backgroundColor || \"#ffffff\"\n\n const window = specification.window\n if (window != null) {\n settings.window = {\n position: {\n x: window.x ?? 100,\n y: window.y ?? 400,\n },\n size: {\n width: window.width ?? 540,\n height: window.height ?? 300,\n },\n }\n }\n } else {\n settings.background = backgroundFile\n delete settings[\"background-color\"]\n }\n\n if (!isEmptyOrSpaces(settings.background)) {\n const size = await getImageSizeUsingSips(settings.background)\n settings.window = { position: { x: 400, y: Math.round((1440 - size.height) / 2) }, size, ...settings.window }\n }\n\n const settingsFile = await packager.getTempFile(\".json\")\n await writeFile(settingsFile, JSON.stringify(settings, null, 2))\n\n const python3Check = () => exec(\"command\", [\"-v\", \"python3\"])\n const pythonCheck = () => exec(\"command\", [\"-v\", \"python\"])\n const pythonPath = process.env.PYTHON_PATH || (await python3Check().catch(pythonCheck)) || (await pythonCheck())\n if (pythonPath == null || isEmptyOrSpaces(pythonPath.trim())) {\n throw new Error(\"Cannot find 'python' or 'python3' executable, please ensure Python is installed and available in PATH or set PYTHON_PATH environment variable\")\n }\n const vendorDir = getDmgVendorPath()\n await exec(pythonPath.trim(), [path.join(vendorDir, \"run_dmgbuild.py\"), \"-s\", settingsFile, path.basename(volumePath), artifactPath], {\n cwd: vendorDir,\n env: {\n ...process.env,\n PYTHONIOENCODING: \"utf8\",\n },\n })\n\n // effectiveOptionComputed, when present, is purely for verifying result during test execution\n return (\n packager.packagerOptions.effectiveOptionComputed == null ||\n (await attachAndExecute(artifactPath, false, async volumePath => {\n return !(await packager.packagerOptions.effectiveOptionComputed!({\n volumePath,\n specification: {\n ...specification,\n // clean up `contents` for test snapshot verification since app path is absolute to a unique tmp dir\n contents: specification.contents?.map((c: any) => ({\n ...c,\n path: path.extname(c.path ?? \"\") === \".app\" ? path.relative(packager.projectDir, c.path) : c.path,\n })),\n },\n packager,\n }))\n }))\n )\n}\n\nexport async function transformBackgroundFileIfNeed(file: string, tmpDir: TmpDir): Promise<string> {\n if (path.extname(file.toLowerCase()) === \".tiff\") {\n return file\n }\n\n const retinaFile = file.replace(/\\.([a-z]+)$/, \"@2x.$1\")\n if (await exists(retinaFile)) {\n const tiffFile = await tmpDir.getTempFile({ suffix: \".tiff\" })\n await exec(\"tiffutil\", [\"-cathidpicheck\", file, retinaFile, \"-out\", tiffFile])\n return tiffFile\n }\n\n return file\n}\n\nexport async function getImageSizeUsingSips(background: string) {\n const stdout = await exec(\"sips\", [\"-g\", \"pixelHeight\", \"-g\", \"pixelWidth\", background])\n\n let width = 0\n let height = 0\n\n const re = /([a-zA-Z]+):\\s*(\\d+)/\n const lines = stdout.split(\"\\n\")\n\n for (const line of lines) {\n const match = re.exec(line)\n if (!match) {\n continue\n }\n\n const key = match[1]\n const value = parseInt(match[2], 10)\n\n if (isNaN(value)) {\n throw new Error(`Failed to parse number from line: \"${line}\"`)\n }\n\n if (key === \"pixelWidth\") {\n width = value\n } else if (key === \"pixelHeight\") {\n height = value\n }\n }\n\n return { width, height }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dmgUtil.js","sourceRoot":"","sources":["../src/dmgUtil.ts"],"names":[],"mappings":";;;AAWA,gDAEC;AAED,4CAEC;AAED,4CAoBC;AAqBD,wBASC;AAED,8CASC;AAGD,0CASC;AAUD,oCA0FC;AAED,sEAaC;AAED,sDA8BC;AA9OD,+CAAoF;AACpF,6BAA4B;AAC5B,qCAA6D;AAC7D,uCAAoC;AAGpC,6BAAiC;AAAxB,gGAAA,SAAS,OAAA;AAElB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAEvC,SAAgB,kBAAkB;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AACrC,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAC;AAEM,KAAK,UAAU,gBAAgB,CAAC,OAAe,EAAE,SAAkB,EAAE,IAA0C;IACpH,sCAAsC;IACtC,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,CAAC,CAAA;IACnD,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACzB,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAClB,MAAM,YAAY,GAAG,MAAM,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAA;IACxC,MAAM,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACrF,MAAM,MAAM,GAAG,YAAY,IAAI,IAAI,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CA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,CAAA;QAChB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC1B,CAAC","sourcesContent":["import { DmgOptions, MacPackager, PlatformPackager } from \"app-builder-lib\"\nimport { exec, executeFinally, exists, isEmptyOrSpaces, TmpDir } from \"builder-util\"\nimport * as path from \"path\"\nimport { hdiUtil, hdiutilTransientExitCodes } from \"./hdiuil\"\nimport { writeFile } from \"fs-extra\"\nimport { DmgBuildConfig } from \"./dmg\"\n\nexport { DmgTarget } from \"./dmg\"\n\nconst root = path.join(__dirname, \"..\")\n\nexport function getDmgTemplatePath() {\n return path.join(root, \"templates\")\n}\n\nexport function getDmgVendorPath() {\n return path.join(root, \"vendor\")\n}\n\nexport async function attachAndExecute(dmgPath: string, readWrite: boolean, task: (devicePath: string) => Promise<any>) {\n //noinspection SpellCheckingInspection\n const args = [\"attach\", \"-noverify\", \"-noautoopen\"]\n if (readWrite) {\n args.push(\"-readwrite\")\n }\n\n args.push(dmgPath)\n const attachResult = await hdiUtil(args)\n const deviceResult = attachResult == null ? null : /^(\\/dev\\/\\w+)/.exec(attachResult)\n const device = deviceResult == null || deviceResult.length !== 2 ? null : deviceResult[1]\n if (device == null) {\n throw new Error(`Cannot mount: ${attachResult}`)\n }\n const volumePath = await findMountPath(path.basename(device))\n if (volumePath == null) {\n throw new Error(`Cannot find volume mount path for device: ${device}`)\n }\n\n return await executeFinally(task(volumePath), () => detach(device))\n}\n\n/**\n * Find the mount path for a specific device from `hdiutil info`.\n */\nasync function findMountPath(devName: string, index: number = 1): Promise<string | null> {\n const info = await hdiUtil([\"info\"])\n const lines = info!.split(\"\\n\")\n const regex = new RegExp(`^/dev/${devName}(s\\\\d+)?\\\\s+\\\\S+\\\\s+(/Volumes/.+)$`)\n const matches: string[] = []\n\n for (const line of lines) {\n const result = regex.exec(line)\n if (result && result.length >= 3) {\n matches.push(result[2])\n }\n }\n\n return matches.length >= index ? matches[index - 1] : null\n}\n\nexport async function detach(name: string) {\n return hdiUtil([\"detach\", \"-quiet\", name]).catch(async e => {\n if (hdiutilTransientExitCodes.has(e.code)) {\n // Delay then force unmount with verbose output\n await new Promise(resolve => setTimeout(resolve, 3000))\n return hdiUtil([\"detach\", \"-force\", name])\n }\n throw e\n })\n}\n\nexport async function computeBackground(packager: PlatformPackager<any>): Promise<string> {\n const resourceList = await packager.resourceList\n if (resourceList.includes(\"background.tiff\")) {\n return path.join(packager.buildResourcesDir, \"background.tiff\")\n } else if (resourceList.includes(\"background.png\")) {\n return path.join(packager.buildResourcesDir, \"background.png\")\n } else {\n return path.join(getDmgTemplatePath(), \"background.tiff\")\n }\n}\n\n/** @internal */\nexport function serializeString(data: string) {\n return (\n ' $\"' +\n data\n .match(/.{1,32}/g)!\n .map(it => it.match(/.{1,4}/g)!.join(\" \"))\n .join('\"\\n $\"') +\n '\"'\n )\n}\n\ntype DmgBuilderConfig = {\n appPath: string\n artifactPath: string\n volumeName: string\n specification: DmgOptions\n packager: MacPackager\n}\n\nexport async function customizeDmg({ appPath, artifactPath, volumeName, specification, packager }: DmgBuilderConfig): Promise<boolean> {\n const isValidIconTextSize = !!specification.iconTextSize && specification.iconTextSize >= 10 && specification.iconTextSize <= 16\n const iconTextSize = isValidIconTextSize ? specification.iconTextSize : 12\n const volumePath = path.join(\"/Volumes\", volumeName)\n // https://github.com/electron-userland/electron-builder/issues/2115\n const backgroundFile = specification.background == null ? null : await transformBackgroundFileIfNeed(specification.background, packager.info.tempDirManager)\n\n const settings: DmgBuildConfig = {\n title: path.basename(volumePath),\n icon: await packager.getResource(specification.icon),\n \"badge-icon\": await packager.getResource(specification.badgeIcon),\n \"icon-size\": specification.iconSize,\n \"text-size\": iconTextSize,\n\n \"compression-level\": Number(process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || \"9\"),\n // filesystem: specification.filesystem || \"HFS+\",\n format: specification.format,\n contents:\n specification.contents?.map(c => ({\n path: c.path || appPath, // path is required, when ommitted, appPath is used (backward compatibility\n x: c.x,\n y: c.y,\n name: c.name,\n type: c.type === \"dir\" ? \"file\" : c.type, // appdmg expects \"file\" for directories\n // hide_extension: c.hideExtension,\n })) || [],\n }\n\n if (specification.backgroundColor != null || specification.background == null) {\n settings[\"background-color\"] = specification.backgroundColor || \"#ffffff\"\n\n const window = specification.window\n if (window != null) {\n settings.window = {\n position: {\n x: window.x ?? 100,\n y: window.y ?? 400,\n },\n size: {\n width: window.width ?? 540,\n height: window.height ?? 300,\n },\n }\n }\n } else {\n settings.background = backgroundFile\n delete settings[\"background-color\"]\n }\n\n if (!isEmptyOrSpaces(settings.background)) {\n const size = await getImageSizeUsingSips(settings.background)\n settings.window = { position: { x: 400, y: Math.round((1440 - size.height) / 2) }, size, ...settings.window }\n }\n\n const settingsFile = await packager.getTempFile(\".json\")\n await writeFile(settingsFile, JSON.stringify(settings, null, 2))\n\n const python3Check = () => exec(\"command\", [\"-v\", \"python3\"])\n const pythonCheck = () => exec(\"command\", [\"-v\", \"python\"])\n const pythonPath = process.env.PYTHON_PATH || (await python3Check().catch(pythonCheck)) || (await pythonCheck())\n if (pythonPath == null || isEmptyOrSpaces(pythonPath.trim())) {\n throw new Error(\"Cannot find 'python' or 'python3' executable, please ensure Python is installed and available in PATH or set PYTHON_PATH environment variable\")\n }\n const vendorDir = getDmgVendorPath()\n await exec(pythonPath.trim(), [path.join(vendorDir, \"run_dmgbuild.py\"), \"-s\", settingsFile, path.basename(volumePath), artifactPath], {\n cwd: vendorDir,\n env: {\n ...process.env,\n PYTHONIOENCODING: \"utf8\",\n },\n })\n\n // effectiveOptionComputed, when present, is purely for verifying result during test execution\n return (\n packager.packagerOptions.effectiveOptionComputed == null ||\n (await attachAndExecute(artifactPath, false, async volumePath => {\n return !(await packager.packagerOptions.effectiveOptionComputed!({\n volumePath,\n specification: {\n ...specification,\n // clean up `contents` for test snapshot verification since app path is absolute to a unique tmp dir\n contents: specification.contents?.map((c: any) => ({\n ...c,\n path: path.extname(c.path ?? \"\") === \".app\" ? path.relative(packager.projectDir, c.path) : c.path,\n })),\n },\n packager,\n }))\n }))\n )\n}\n\nexport async function transformBackgroundFileIfNeed(file: string, tmpDir: TmpDir): Promise<string> {\n if (path.extname(file.toLowerCase()) === \".tiff\") {\n return file\n }\n\n const retinaFile = file.replace(/\\.([a-z]+)$/, \"@2x.$1\")\n if (await exists(retinaFile)) {\n const tiffFile = await tmpDir.getTempFile({ suffix: \".tiff\" })\n await exec(\"tiffutil\", [\"-cathidpicheck\", file, retinaFile, \"-out\", tiffFile])\n return tiffFile\n }\n\n return file\n}\n\nexport async function getImageSizeUsingSips(background: string) {\n const stdout = await exec(\"sips\", [\"-g\", \"pixelHeight\", \"-g\", \"pixelWidth\", background])\n\n let width = 0\n let height = 0\n\n const re = /([a-zA-Z]+):\\s*(\\d+)/\n const lines = stdout.split(\"\\n\")\n\n for (const line of lines) {\n const match = re.exec(line)\n if (!match) {\n continue\n }\n\n const key = match[1]\n const value = parseInt(match[2], 10)\n\n if (isNaN(value)) {\n throw new Error(`Failed to parse number from line: \"${line}\"`)\n }\n\n if (key === \"pixelWidth\") {\n width = value\n } else if (key === \"pixelHeight\") {\n height = value\n }\n }\n\n return { width, height }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dmg-builder",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.5.0",
|
|
4
4
|
"main": "out/dmgUtil.js",
|
|
5
5
|
"author": "Vladimir Krivosheev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"fs-extra": "^10.1.0",
|
|
21
21
|
"iconv-lite": "^0.6.2",
|
|
22
22
|
"js-yaml": "^4.1.0",
|
|
23
|
-
"app-builder-lib": "26.
|
|
24
|
-
"builder-util": "26.
|
|
23
|
+
"app-builder-lib": "26.5.0",
|
|
24
|
+
"builder-util": "26.4.1"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
27
|
"dmg-license": "^1.0.11"
|
|
@@ -9,7 +9,10 @@ def main():
|
|
|
9
9
|
parser.add_argument(
|
|
10
10
|
"volume_name",
|
|
11
11
|
metavar="volume-name",
|
|
12
|
-
help=
|
|
12
|
+
help=(
|
|
13
|
+
"The name to give to the volume (this will appear in the title "
|
|
14
|
+
"bar when the user mounts the disk image)."
|
|
15
|
+
),
|
|
13
16
|
)
|
|
14
17
|
parser.add_argument(
|
|
15
18
|
"filename",
|
package/vendor/dmgbuild/badge.py
CHANGED
|
@@ -43,7 +43,7 @@ def badge_disk_icon(badge_file, output_file):
|
|
|
43
43
|
# Load the badge
|
|
44
44
|
url = CFURLCreateWithFileSystemPath(None, badge_file, kCFURLPOSIXPathStyle, False)
|
|
45
45
|
badge = CGImageSourceCreateWithURL(url, None)
|
|
46
|
-
assert badge is not None, "Unable to process image file:
|
|
46
|
+
assert badge is not None, f"Unable to process image file: {badge_file}"
|
|
47
47
|
badgeCount = CGImageSourceGetCount(badge)
|
|
48
48
|
|
|
49
49
|
# Set up a destination for our target
|
|
@@ -18,10 +18,10 @@ class RGB:
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class HSL(Color):
|
|
21
|
-
def __init__(self, h, s, l): # noqa
|
|
21
|
+
def __init__(self, h, s, l): # noqa: E741
|
|
22
22
|
self.h = h
|
|
23
23
|
self.s = s
|
|
24
|
-
self.l = l # noqa
|
|
24
|
+
self.l = l # noqa: E741
|
|
25
25
|
|
|
26
26
|
@staticmethod
|
|
27
27
|
def _hue_to_rgb(t1, t2, hue):
|
|
@@ -41,7 +41,7 @@ class HSL(Color):
|
|
|
41
41
|
|
|
42
42
|
def to_rgb(self):
|
|
43
43
|
hue = self.h / 60.0
|
|
44
|
-
if self.l <= 0.5: # noqa
|
|
44
|
+
if self.l <= 0.5: # noqa: E741
|
|
45
45
|
t2 = self.l * (self.s + 1)
|
|
46
46
|
else:
|
|
47
47
|
t2 = self.l + self.s - (self.l * self.s)
|
|
@@ -257,7 +257,7 @@ _x11_colors = {
|
|
|
257
257
|
|
|
258
258
|
_ws_re = re.compile(r"\s+")
|
|
259
259
|
_token_re = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
|
|
260
|
-
_hex_re = re.compile(r"#([0-9a-f]{3}(?:[0-9a-f]{3})?)$")
|
|
260
|
+
_hex_re = re.compile(r"#([0-9a-f]{3}(?:[0-9a-f]{3})?)$", re.IGNORECASE)
|
|
261
261
|
_number_re = re.compile(r"[0-9]*(\.[0-9]*)")
|
|
262
262
|
|
|
263
263
|
|
|
@@ -281,7 +281,7 @@ class ColorParser:
|
|
|
281
281
|
|
|
282
282
|
def expectEnd(self):
|
|
283
283
|
if self._pos != len(self._string):
|
|
284
|
-
raise ValueError('junk at end of color "
|
|
284
|
+
raise ValueError(f'junk at end of color "{self._string}"')
|
|
285
285
|
|
|
286
286
|
def getToken(self):
|
|
287
287
|
m = _token_re.match(self._string, self._pos)
|
|
@@ -318,7 +318,7 @@ class ColorParser:
|
|
|
318
318
|
try:
|
|
319
319
|
r, g, b = _x11_colors[token]
|
|
320
320
|
except KeyError:
|
|
321
|
-
raise ValueError('unknown color name "
|
|
321
|
+
raise ValueError(f'unknown color name "{token}"')
|
|
322
322
|
|
|
323
323
|
self.expectEnd()
|
|
324
324
|
|
|
@@ -344,7 +344,7 @@ class ColorParser:
|
|
|
344
344
|
|
|
345
345
|
return RGB(r / 255.0, g / 255.0, b / 255.0)
|
|
346
346
|
|
|
347
|
-
raise ValueError('bad color syntax "
|
|
347
|
+
raise ValueError(f'bad color syntax "{self._string}"')
|
|
348
348
|
|
|
349
349
|
def parseRGB(self):
|
|
350
350
|
self.expect("(", 'after "rgb"')
|
|
@@ -388,7 +388,7 @@ class ColorParser:
|
|
|
388
388
|
self.expect(",", 'in "hsl"')
|
|
389
389
|
self.skipws()
|
|
390
390
|
|
|
391
|
-
l = self.parseValue() # noqa
|
|
391
|
+
l = self.parseValue() # noqa: E741
|
|
392
392
|
|
|
393
393
|
self.skipws()
|
|
394
394
|
self.expect(")", 'at end of "hsl"')
|
|
@@ -487,12 +487,12 @@ class ColorParser:
|
|
|
487
487
|
elif tok == "grad" or tok == "gon":
|
|
488
488
|
n = n * 0.9
|
|
489
489
|
elif tok != "deg":
|
|
490
|
-
raise ValueError('bad angle unit "
|
|
490
|
+
raise ValueError(f'bad angle unit "{tok}"')
|
|
491
491
|
return n
|
|
492
492
|
|
|
493
493
|
|
|
494
494
|
_color_re = re.compile(
|
|
495
|
-
r"\s*(#|rgb|hsl|hwb|cmyk|gray|grey
|
|
495
|
+
r"\s*(#|rgb|hsl|hwb|cmyk|gray|grey|{})".format("|".join(_x11_colors.keys()))
|
|
496
496
|
)
|
|
497
497
|
|
|
498
498
|
|
package/vendor/dmgbuild/core.py
CHANGED
|
@@ -15,7 +15,7 @@ except ImportError:
|
|
|
15
15
|
from importlib import resources
|
|
16
16
|
|
|
17
17
|
from ds_store import DSStore
|
|
18
|
-
from mac_alias import Alias
|
|
18
|
+
from mac_alias import Alias
|
|
19
19
|
|
|
20
20
|
from . import colors, licensing
|
|
21
21
|
|
|
@@ -25,7 +25,7 @@ except ImportError:
|
|
|
25
25
|
badge = None
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
_hexcolor_re = re.compile(r"#[0-9a-f]{3}(?:[0-9a-f]{3})?")
|
|
28
|
+
_hexcolor_re = re.compile(r"#[0-9a-f]{3}(?:[0-9a-f]{3})?", re.IGNORECASE)
|
|
29
29
|
|
|
30
30
|
# The first element in the platform.mac_ver() tuple is a string containing the
|
|
31
31
|
# macOS version (e.g., '10.15.6'). Parse into an integer tuple.
|
|
@@ -159,16 +159,20 @@ def load_json(filename, settings):
|
|
|
159
159
|
settings["icon_locations"] = icon_locations
|
|
160
160
|
|
|
161
161
|
|
|
162
|
-
def build_dmg( # noqa
|
|
162
|
+
def build_dmg( # noqa: C901
|
|
163
163
|
filename,
|
|
164
164
|
volume_name,
|
|
165
165
|
settings_file=None,
|
|
166
|
-
settings=
|
|
167
|
-
defines=
|
|
166
|
+
settings=None,
|
|
167
|
+
defines=None,
|
|
168
168
|
lookForHiDPI=True,
|
|
169
169
|
detach_retries=12,
|
|
170
170
|
callback=quiet_callback,
|
|
171
171
|
):
|
|
172
|
+
if defines is None:
|
|
173
|
+
defines = {}
|
|
174
|
+
if settings is None:
|
|
175
|
+
settings = {}
|
|
172
176
|
options = {
|
|
173
177
|
# Default settings
|
|
174
178
|
"filename": filename,
|
|
@@ -269,8 +273,8 @@ def build_dmg( # noqa; C901
|
|
|
269
273
|
# Set up the finder data
|
|
270
274
|
bounds = options["window_rect"]
|
|
271
275
|
|
|
272
|
-
bounds_string =
|
|
273
|
-
bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]
|
|
276
|
+
bounds_string = (
|
|
277
|
+
f"{{{{{bounds[0][0]}, {bounds[0][1]}}}, {{{bounds[1][0]}, {bounds[1][1]}}}}}"
|
|
274
278
|
)
|
|
275
279
|
bwsp = {
|
|
276
280
|
"ShowStatusBar": options["show_status_bar"],
|
|
@@ -373,8 +377,11 @@ def build_dmg( # noqa; C901
|
|
|
373
377
|
for n, column in enumerate(options["list_columns"]):
|
|
374
378
|
cndx[column] = n
|
|
375
379
|
width = options["list_column_widths"].get(column, default_widths[column])
|
|
376
|
-
asc =
|
|
377
|
-
|
|
380
|
+
asc = (
|
|
381
|
+
options["list_column_sort_directions"].get(
|
|
382
|
+
column, default_sort_directions[column]
|
|
383
|
+
)
|
|
384
|
+
== "ascending"
|
|
378
385
|
)
|
|
379
386
|
|
|
380
387
|
lsvp["columns"][columns[column]] = {
|
|
@@ -387,10 +394,10 @@ def build_dmg( # noqa; C901
|
|
|
387
394
|
|
|
388
395
|
n = len(options["list_columns"])
|
|
389
396
|
for k in columns:
|
|
390
|
-
if cndx.get(k
|
|
397
|
+
if cndx.get(k) is None:
|
|
391
398
|
cndx[k] = n
|
|
392
399
|
width = default_widths[k]
|
|
393
|
-
asc =
|
|
400
|
+
asc = default_sort_directions[k] == "ascending"
|
|
394
401
|
|
|
395
402
|
lsvp["columns"][columns[column]] = {
|
|
396
403
|
"index": n,
|
|
@@ -453,7 +460,7 @@ def build_dmg( # noqa; C901
|
|
|
453
460
|
path = path[0]
|
|
454
461
|
|
|
455
462
|
if not os.path.islink(path) and os.path.isdir(path):
|
|
456
|
-
for dirpath,
|
|
463
|
+
for dirpath, _dirnames, filenames in os.walk(path):
|
|
457
464
|
for f in filenames:
|
|
458
465
|
fp = os.path.join(dirpath, f)
|
|
459
466
|
total_size += roundup(os.lstat(fp).st_size, 4096)
|
|
@@ -566,8 +573,6 @@ def build_dmg( # noqa; C901
|
|
|
566
573
|
if icon or badge_icon:
|
|
567
574
|
subprocess.call(["/usr/bin/SetFile", "-a", "C", mount_point])
|
|
568
575
|
|
|
569
|
-
background_bmk = None
|
|
570
|
-
|
|
571
576
|
callback(
|
|
572
577
|
{
|
|
573
578
|
"type": "operation::start",
|
|
@@ -627,8 +632,8 @@ def build_dmg( # noqa; C901
|
|
|
627
632
|
except Exception as e:
|
|
628
633
|
output.seek(0)
|
|
629
634
|
raise ValueError(
|
|
630
|
-
|
|
631
|
-
|
|
635
|
+
f"unable to compile combined HiDPI file {background!r} "
|
|
636
|
+
f"got error: {str(e)}\noutput: {output.read()}"
|
|
632
637
|
)
|
|
633
638
|
|
|
634
639
|
_, kind = os.path.splitext(background)
|
|
@@ -645,10 +650,9 @@ def build_dmg( # noqa; C901
|
|
|
645
650
|
with open(path_in_image, "wb") as out_file:
|
|
646
651
|
out_file.write(in_file.read())
|
|
647
652
|
else:
|
|
648
|
-
raise ValueError('background file "
|
|
653
|
+
raise ValueError(f'background file "{background}" not found')
|
|
649
654
|
|
|
650
655
|
alias = Alias.for_file(path_in_image)
|
|
651
|
-
background_bmk = Bookmark.for_file(path_in_image)
|
|
652
656
|
|
|
653
657
|
icvp["backgroundType"] = 2
|
|
654
658
|
icvp["backgroundImageAlias"] = alias.to_bytes()
|
|
@@ -767,7 +771,7 @@ def build_dmg( # noqa; C901
|
|
|
767
771
|
}
|
|
768
772
|
)
|
|
769
773
|
|
|
770
|
-
userfn = options.get("create_hook"
|
|
774
|
+
userfn = options.get("create_hook")
|
|
771
775
|
if callable(userfn):
|
|
772
776
|
userfn(mount_point, options)
|
|
773
777
|
|
|
@@ -785,8 +789,6 @@ def build_dmg( # noqa; C901
|
|
|
785
789
|
d["."]["bwsp"] = bwsp
|
|
786
790
|
if include_icon_view_settings:
|
|
787
791
|
d["."]["icvp"] = icvp
|
|
788
|
-
if background_bmk:
|
|
789
|
-
d["."]["pBBk"] = background_bmk
|
|
790
792
|
if include_list_view_settings:
|
|
791
793
|
d["."]["lsvp"] = lsvp
|
|
792
794
|
d["."]["icvl"] = icvl
|
|
@@ -819,7 +821,7 @@ def build_dmg( # noqa; C901
|
|
|
819
821
|
subprocess.check_call(("sync", "--file-system", mount_point))
|
|
820
822
|
|
|
821
823
|
retry_time = 1
|
|
822
|
-
for
|
|
824
|
+
for _ in range(detach_retries):
|
|
823
825
|
callback(
|
|
824
826
|
{
|
|
825
827
|
"type": "command::start",
|
|
@@ -833,8 +835,8 @@ def build_dmg( # noqa; C901
|
|
|
833
835
|
{
|
|
834
836
|
"type": "command::finished",
|
|
835
837
|
"command": "hdiutil::detach",
|
|
836
|
-
"ret
|
|
837
|
-
"output
|
|
838
|
+
"ret": ret,
|
|
839
|
+
"output": output,
|
|
838
840
|
}
|
|
839
841
|
)
|
|
840
842
|
|
|
@@ -27,7 +27,8 @@ language_info_map = {
|
|
|
27
27
|
"buttons": "Japanese",
|
|
28
28
|
"name": "Japanese",
|
|
29
29
|
"language_id": 14,
|
|
30
|
-
|
|
30
|
+
# not sure if this is correct encoding, but seems to be working
|
|
31
|
+
"encoding": "shift_jis",
|
|
31
32
|
"multibyte": True,
|
|
32
33
|
},
|
|
33
34
|
"ko_KR": {
|
|
@@ -78,7 +79,7 @@ default_buttons = {
|
|
|
78
79
|
"Disagree",
|
|
79
80
|
"Print",
|
|
80
81
|
"Save",
|
|
81
|
-
'If you agree with the terms of this license, press "Agree" to install the software. If you do not agree, press "Disagree".', # noqa
|
|
82
|
+
'If you agree with the terms of this license, press "Agree" to install the software. If you do not agree, press "Disagree".', # noqa: E501
|
|
82
83
|
),
|
|
83
84
|
"German": (
|
|
84
85
|
"Deutsch",
|
|
@@ -86,7 +87,7 @@ default_buttons = {
|
|
|
86
87
|
"Ablehnen",
|
|
87
88
|
"Drucken",
|
|
88
89
|
"Sichern...",
|
|
89
|
-
'Klicken Sie in "Akzeptieren", wenn Sie mit den Bestimmungen des Software-Lizenzvertrags einverstanden sind. Falls nicht, bitte "Ablehnen" anklicken. Sie können die Software nur installieren, wenn Sie "Akzeptieren" angeklickt haben.', # noqa
|
|
90
|
+
'Klicken Sie in "Akzeptieren", wenn Sie mit den Bestimmungen des Software-Lizenzvertrags einverstanden sind. Falls nicht, bitte "Ablehnen" anklicken. Sie können die Software nur installieren, wenn Sie "Akzeptieren" angeklickt haben.', # noqa: E501
|
|
90
91
|
),
|
|
91
92
|
"Spanish": (
|
|
92
93
|
"Español",
|
|
@@ -94,7 +95,7 @@ default_buttons = {
|
|
|
94
95
|
"No aceptar",
|
|
95
96
|
"Imprimir",
|
|
96
97
|
"Guardar...",
|
|
97
|
-
'Si está de acuerdo con los términos de esta licencia, pulse "Aceptar" para instalar el software. En el supuesto de que no esté de acuerdo con los términos de esta licencia, pulse "No aceptar."', # noqa
|
|
98
|
+
'Si está de acuerdo con los términos de esta licencia, pulse "Aceptar" para instalar el software. En el supuesto de que no esté de acuerdo con los términos de esta licencia, pulse "No aceptar."', # noqa: E501
|
|
98
99
|
),
|
|
99
100
|
"French": (
|
|
100
101
|
"Français",
|
|
@@ -102,7 +103,7 @@ default_buttons = {
|
|
|
102
103
|
"Refuser",
|
|
103
104
|
"Imprimer",
|
|
104
105
|
"Enregistrer...",
|
|
105
|
-
'Si vous acceptez les termes de la présente licence, cliquez sur "Accepter" afin d\'installer le logiciel. Si vous n\'êtes pas d\'accord avec les termes de la licence, cliquez sur "Refuser".', # noqa
|
|
106
|
+
'Si vous acceptez les termes de la présente licence, cliquez sur "Accepter" afin d\'installer le logiciel. Si vous n\'êtes pas d\'accord avec les termes de la licence, cliquez sur "Refuser".', # noqa: E501
|
|
106
107
|
),
|
|
107
108
|
"Italian": (
|
|
108
109
|
"Italiano",
|
|
@@ -110,7 +111,7 @@ default_buttons = {
|
|
|
110
111
|
"Rifiuto",
|
|
111
112
|
"Stampa",
|
|
112
113
|
"Registra...",
|
|
113
|
-
'Se accetti le condizioni di questa licenza, fai clic su "Accetto" per installare il software. Altrimenti fai clic su "Rifiuto".', # noqa
|
|
114
|
+
'Se accetti le condizioni di questa licenza, fai clic su "Accetto" per installare il software. Altrimenti fai clic su "Rifiuto".', # noqa: E501
|
|
114
115
|
),
|
|
115
116
|
"Japanese": (
|
|
116
117
|
"日本語",
|
|
@@ -118,7 +119,7 @@ default_buttons = {
|
|
|
118
119
|
"同意しません",
|
|
119
120
|
"印刷する",
|
|
120
121
|
"保存...",
|
|
121
|
-
"本ソフトウエア使用許諾契約の条件に同意される場合には、ソフトウエアをインストールするために「同意します」を押してください。\u3000同意されない場合には、「同意しません」を押してください。", # noqa
|
|
122
|
+
"本ソフトウエア使用許諾契約の条件に同意される場合には、ソフトウエアをインストールするために「同意します」を押してください。\u3000同意されない場合には、「同意しません」を押してください。", # noqa: E501
|
|
122
123
|
),
|
|
123
124
|
"Dutch": (
|
|
124
125
|
"Nederlands",
|
|
@@ -126,7 +127,7 @@ default_buttons = {
|
|
|
126
127
|
"Nee",
|
|
127
128
|
"Print",
|
|
128
129
|
"Bewaar...",
|
|
129
|
-
"Indien u akkoord gaat met de voorwaarden van deze licentie, kunt u op 'Ja' klikken om de programmatuur te installeren. Indien u niet akkoord gaat, klikt u op 'Nee'.", # noqa
|
|
130
|
+
"Indien u akkoord gaat met de voorwaarden van deze licentie, kunt u op 'Ja' klikken om de programmatuur te installeren. Indien u niet akkoord gaat, klikt u op 'Nee'.", # noqa: E501
|
|
130
131
|
),
|
|
131
132
|
"Russian": (
|
|
132
133
|
"Русский",
|
|
@@ -134,7 +135,7 @@ default_buttons = {
|
|
|
134
135
|
"Не согласен",
|
|
135
136
|
"Распечатать",
|
|
136
137
|
"Сохранить",
|
|
137
|
-
"Если вы согласны с условиями данной лицензии, нажмите «Согласен», чтобы установить программное обеспечение. Если вы не согласны, нажмите «Не согласен».", # noqa
|
|
138
|
+
"Если вы согласны с условиями данной лицензии, нажмите «Согласен», чтобы установить программное обеспечение. Если вы не согласны, нажмите «Не согласен».", # noqa: E501
|
|
138
139
|
),
|
|
139
140
|
"Swedish": (
|
|
140
141
|
"Svensk",
|
|
@@ -142,7 +143,7 @@ default_buttons = {
|
|
|
142
143
|
"Avböjs",
|
|
143
144
|
"Skriv ut",
|
|
144
145
|
"Spara...",
|
|
145
|
-
'Om Du godkänner licensvillkoren klicka på "Godkänns" för att installera programprodukten. Om Du inte godkänner licensvillkoren, klicka på "Avböjs".', # noqa
|
|
146
|
+
'Om Du godkänner licensvillkoren klicka på "Godkänns" för att installera programprodukten. Om Du inte godkänner licensvillkoren, klicka på "Avböjs".', # noqa: E501
|
|
146
147
|
),
|
|
147
148
|
"Portuguese": (
|
|
148
149
|
"Português",
|
|
@@ -150,7 +151,7 @@ default_buttons = {
|
|
|
150
151
|
"Discordar",
|
|
151
152
|
"Imprimir",
|
|
152
153
|
"Salvar...",
|
|
153
|
-
'Se está de acordo com os termos desta licença, pressione "Concordar" para instalar o software. Se não está de acordo, pressione "Discordar".', # noqa
|
|
154
|
+
'Se está de acordo com os termos desta licença, pressione "Concordar" para instalar o software. Se não está de acordo, pressione "Discordar".', # noqa: E501
|
|
154
155
|
),
|
|
155
156
|
"Simplified Chinese": (
|
|
156
157
|
"汉语",
|
|
@@ -158,7 +159,7 @@ default_buttons = {
|
|
|
158
159
|
"不同意",
|
|
159
160
|
"打印",
|
|
160
161
|
"存储…",
|
|
161
|
-
"如果您同意本许可协议的条款,请按“同意”来安装此软件。如果您不同意,请按“不同意”。", # noqa
|
|
162
|
+
"如果您同意本许可协议的条款,请按“同意”来安装此软件。如果您不同意,请按“不同意”。", # noqa: E501
|
|
162
163
|
),
|
|
163
164
|
"Traditional Chinese": (
|
|
164
165
|
"漢語",
|
|
@@ -166,7 +167,7 @@ default_buttons = {
|
|
|
166
167
|
"不同意",
|
|
167
168
|
"列印",
|
|
168
169
|
"儲存…",
|
|
169
|
-
"如果您同意本許可證裡的條款,請按“同意”以安裝軟體。如果不同意,請按“不同意”。", # noqa
|
|
170
|
+
"如果您同意本許可證裡的條款,請按“同意”以安裝軟體。如果不同意,請按“不同意”。", # noqa: E501
|
|
170
171
|
),
|
|
171
172
|
"Danish": (
|
|
172
173
|
"Dansk",
|
|
@@ -174,7 +175,7 @@ default_buttons = {
|
|
|
174
175
|
"Uenig",
|
|
175
176
|
"Udskriv",
|
|
176
177
|
"Arkiver...",
|
|
177
|
-
"Hvis du accepterer betingelserne i licensaftalen, skal du klikke på “Enig” for at installere softwaren. Klik på “Uenig” for at annullere installeringen.", # noqa
|
|
178
|
+
"Hvis du accepterer betingelserne i licensaftalen, skal du klikke på “Enig” for at installere softwaren. Klik på “Uenig” for at annullere installeringen.", # noqa: E501
|
|
178
179
|
),
|
|
179
180
|
"Finnish": (
|
|
180
181
|
"Suomi",
|
|
@@ -182,7 +183,7 @@ default_buttons = {
|
|
|
182
183
|
"En hyväksy",
|
|
183
184
|
"Tulosta",
|
|
184
185
|
"Tallenna…",
|
|
185
|
-
'Hyväksy lisenssisopimuksen ehdot osoittamalla "Hyväksy". Jos et hyväksy sopimuksen ehtoja, osoita "En hyväksy".', # noqa
|
|
186
|
+
'Hyväksy lisenssisopimuksen ehdot osoittamalla "Hyväksy". Jos et hyväksy sopimuksen ehtoja, osoita "En hyväksy".', # noqa: E501
|
|
186
187
|
),
|
|
187
188
|
"Korean": (
|
|
188
189
|
"한국어",
|
|
@@ -190,7 +191,7 @@ default_buttons = {
|
|
|
190
191
|
"동의 안함",
|
|
191
192
|
"프린트",
|
|
192
193
|
"저장...",
|
|
193
|
-
'사용 계약서의 내용에 동의하면, "동의" 단추를 눌러 소프트웨어를 설치하십시오. 동의하지 않는다면, "동의 안함" 단추를 누르십시오.', # noqa
|
|
194
|
+
'사용 계약서의 내용에 동의하면, "동의" 단추를 눌러 소프트웨어를 설치하십시오. 동의하지 않는다면, "동의 안함" 단추를 누르십시오.', # noqa: E501
|
|
194
195
|
),
|
|
195
196
|
"Norwegian": (
|
|
196
197
|
"Norsk",
|
|
@@ -198,7 +199,7 @@ default_buttons = {
|
|
|
198
199
|
"Ikke enig",
|
|
199
200
|
"Skriv ut",
|
|
200
201
|
"Arkiver...",
|
|
201
|
-
'Hvis De er enig i bestemmelsene i denne lisensavtalen, klikker De på "Enig"-knappen for å installere programvaren. Hvis De ikke er enig, klikker De på "Ikke enig".', # noqa
|
|
202
|
+
'Hvis De er enig i bestemmelsene i denne lisensavtalen, klikker De på "Enig"-knappen for å installere programvaren. Hvis De ikke er enig, klikker De på "Ikke enig".', # noqa: E501
|
|
202
203
|
),
|
|
203
204
|
}
|
|
204
205
|
|
|
@@ -241,7 +242,7 @@ def build_license(license_info):
|
|
|
241
242
|
|
|
242
243
|
lpic = b""
|
|
243
244
|
# The first field is the default language ID.
|
|
244
|
-
lpic +=
|
|
245
|
+
lpic += (5000).to_bytes(2, "big")
|
|
245
246
|
# The second field is the count of language ID to license resource mappings.
|
|
246
247
|
lpic += len(licenses.items()).to_bytes(2, "big")
|
|
247
248
|
|
|
@@ -258,7 +259,8 @@ def build_license(license_info):
|
|
|
258
259
|
language_buttons = language_info["buttons"]
|
|
259
260
|
language_name = language_info["name"]
|
|
260
261
|
language_id = language_info["language_id"]
|
|
261
|
-
# for simplicity we use the same id for the resource
|
|
262
|
+
# for simplicity we use the same id for the resource
|
|
263
|
+
# as system language id + 5000
|
|
262
264
|
resource_id = language_id + 5000
|
|
263
265
|
language_encoding = language_info.get("encoding", "mac_roman")
|
|
264
266
|
multibyte_encoding = language_info.get("multibyte_encoding", False)
|