dmg-builder 26.5.0 → 26.6.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.d.ts +2 -3
- package/out/dmgUtil.js +41 -23
- package/out/dmgUtil.js.map +1 -1
- package/package.json +3 -4
- package/vendor/biplist/__init__.py +0 -977
- package/vendor/dmgbuild/__init__.py +0 -5
- package/vendor/dmgbuild/__main__.py +0 -70
- package/vendor/dmgbuild/badge.py +0 -169
- package/vendor/dmgbuild/colors.py +0 -504
- package/vendor/dmgbuild/core.py +0 -963
- package/vendor/dmgbuild/licensing.py +0 -331
- package/vendor/dmgbuild/resources/builtin-arrow.tiff +0 -0
- package/vendor/ds_store/__init__.py +0 -5
- package/vendor/ds_store/__main__.py +0 -102
- package/vendor/ds_store/buddy.py +0 -486
- package/vendor/ds_store/store.py +0 -1262
- package/vendor/mac_alias/__init__.py +0 -47
- package/vendor/mac_alias/alias.py +0 -772
- package/vendor/mac_alias/bookmark.py +0 -677
- package/vendor/mac_alias/osx.py +0 -1074
- package/vendor/mac_alias/utils.py +0 -20
- package/vendor/run_dmgbuild.py +0 -14
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env python3
|
|
2
|
-
import argparse
|
|
3
|
-
|
|
4
|
-
from .core import build_dmg
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def main():
|
|
8
|
-
parser = argparse.ArgumentParser(description="Construct a disk image file.")
|
|
9
|
-
parser.add_argument(
|
|
10
|
-
"volume_name",
|
|
11
|
-
metavar="volume-name",
|
|
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
|
-
),
|
|
16
|
-
)
|
|
17
|
-
parser.add_argument(
|
|
18
|
-
"filename",
|
|
19
|
-
metavar="output.dmg",
|
|
20
|
-
help="The filename of the disk image to create.",
|
|
21
|
-
)
|
|
22
|
-
parser.add_argument("-s", "--settings", help="The path of the settings file.")
|
|
23
|
-
parser.add_argument(
|
|
24
|
-
"-D",
|
|
25
|
-
dest="defines",
|
|
26
|
-
action="append",
|
|
27
|
-
default=[],
|
|
28
|
-
help="Define a value for the settings file (e.g. -Dfoo=bar).",
|
|
29
|
-
)
|
|
30
|
-
parser.add_argument(
|
|
31
|
-
"--no-hidpi",
|
|
32
|
-
dest="lookForHiDPI",
|
|
33
|
-
action="store_false",
|
|
34
|
-
default=True,
|
|
35
|
-
help="Do not search for HiDPI versions of the background image (if specified)",
|
|
36
|
-
)
|
|
37
|
-
parser.add_argument(
|
|
38
|
-
"--detach-retries",
|
|
39
|
-
dest="detachRetries",
|
|
40
|
-
type=int,
|
|
41
|
-
default=5,
|
|
42
|
-
choices=range(1, 31),
|
|
43
|
-
help="Number of attempts to detach disk volume (1 sec. interval)",
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
args = parser.parse_args()
|
|
47
|
-
|
|
48
|
-
defines = {}
|
|
49
|
-
for d in args.defines:
|
|
50
|
-
k, v = d.split("=", 1)
|
|
51
|
-
k = k.strip()
|
|
52
|
-
v = v.strip()
|
|
53
|
-
if (v.startswith("'") and v.endswith("'")) or (
|
|
54
|
-
v.startswith('"') and v.endswith('"')
|
|
55
|
-
):
|
|
56
|
-
v = v[1:-1]
|
|
57
|
-
defines[k] = v
|
|
58
|
-
|
|
59
|
-
build_dmg(
|
|
60
|
-
args.filename,
|
|
61
|
-
args.volume_name,
|
|
62
|
-
args.settings,
|
|
63
|
-
defines=defines,
|
|
64
|
-
lookForHiDPI=args.lookForHiDPI,
|
|
65
|
-
detach_retries=args.detachRetries,
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if __name__ == "__main__":
|
|
70
|
-
main()
|
package/vendor/dmgbuild/badge.py
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import math
|
|
2
|
-
|
|
3
|
-
from Quartz import (
|
|
4
|
-
CFURLCreateWithFileSystemPath,
|
|
5
|
-
CGBitmapContextCreate,
|
|
6
|
-
CGBitmapContextCreateImage,
|
|
7
|
-
CGColorSpaceCreateWithName,
|
|
8
|
-
CGImageDestinationAddImage,
|
|
9
|
-
CGImageDestinationCreateWithURL,
|
|
10
|
-
CGImageDestinationFinalize,
|
|
11
|
-
CGImageSourceCopyPropertiesAtIndex,
|
|
12
|
-
CGImageSourceCreateImageAtIndex,
|
|
13
|
-
CGImageSourceCreateWithURL,
|
|
14
|
-
CGImageSourceGetCount,
|
|
15
|
-
CIContext,
|
|
16
|
-
CIFilter,
|
|
17
|
-
CIImage,
|
|
18
|
-
CIVector,
|
|
19
|
-
NSAffineTransform,
|
|
20
|
-
kCFURLPOSIXPathStyle,
|
|
21
|
-
kCGColorSpaceGenericRGB,
|
|
22
|
-
kCGImageAlphaPremultipliedLast,
|
|
23
|
-
kCIInputAspectRatioKey,
|
|
24
|
-
kCIInputBackgroundImageKey,
|
|
25
|
-
kCIInputImageKey,
|
|
26
|
-
kCIInputScaleKey,
|
|
27
|
-
kCIOutputImageKey,
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
_REMOVABLE_DISK_PATH = (
|
|
31
|
-
"/System/Library/Extensions/IOStorageFamily.kext/Contents/Resources/Removable.icns"
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def badge_disk_icon(badge_file, output_file):
|
|
36
|
-
# Load the Removable disk icon
|
|
37
|
-
url = CFURLCreateWithFileSystemPath(
|
|
38
|
-
None, _REMOVABLE_DISK_PATH, kCFURLPOSIXPathStyle, False
|
|
39
|
-
)
|
|
40
|
-
backdrop = CGImageSourceCreateWithURL(url, None)
|
|
41
|
-
backdropCount = CGImageSourceGetCount(backdrop)
|
|
42
|
-
|
|
43
|
-
# Load the badge
|
|
44
|
-
url = CFURLCreateWithFileSystemPath(None, badge_file, kCFURLPOSIXPathStyle, False)
|
|
45
|
-
badge = CGImageSourceCreateWithURL(url, None)
|
|
46
|
-
assert badge is not None, f"Unable to process image file: {badge_file}"
|
|
47
|
-
badgeCount = CGImageSourceGetCount(badge)
|
|
48
|
-
|
|
49
|
-
# Set up a destination for our target
|
|
50
|
-
url = CFURLCreateWithFileSystemPath(None, output_file, kCFURLPOSIXPathStyle, False)
|
|
51
|
-
target = CGImageDestinationCreateWithURL(url, "com.apple.icns", backdropCount, None)
|
|
52
|
-
|
|
53
|
-
# Get the RGB colorspace
|
|
54
|
-
rgbColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)
|
|
55
|
-
|
|
56
|
-
# Scale
|
|
57
|
-
scale = 1.0
|
|
58
|
-
|
|
59
|
-
# Perspective transform
|
|
60
|
-
corners = ((0.2, 0.95), (0.8, 0.95), (0.85, 0.35), (0.15, 0.35))
|
|
61
|
-
|
|
62
|
-
# Translation
|
|
63
|
-
position = (0.5, 0.5)
|
|
64
|
-
|
|
65
|
-
for n in range(backdropCount):
|
|
66
|
-
props = CGImageSourceCopyPropertiesAtIndex(backdrop, n, None)
|
|
67
|
-
width = props["PixelWidth"]
|
|
68
|
-
height = props["PixelHeight"]
|
|
69
|
-
dpi = props["DPIWidth"]
|
|
70
|
-
depth = props["Depth"]
|
|
71
|
-
|
|
72
|
-
# Choose the best sized badge image
|
|
73
|
-
bestWidth = None
|
|
74
|
-
# ?? bestHeight = None
|
|
75
|
-
bestBadge = None
|
|
76
|
-
bestDepth = None
|
|
77
|
-
# ?? bestDPI = None
|
|
78
|
-
for m in range(badgeCount):
|
|
79
|
-
badgeProps = CGImageSourceCopyPropertiesAtIndex(badge, m, None)
|
|
80
|
-
badgeWidth = badgeProps["PixelWidth"]
|
|
81
|
-
# ?? badgeHeight = badgeProps['PixelHeight']
|
|
82
|
-
badgeDPI = badgeProps["DPIWidth"]
|
|
83
|
-
badgeDepth = badgeProps["Depth"]
|
|
84
|
-
|
|
85
|
-
if bestBadge is None or (
|
|
86
|
-
badgeWidth <= width
|
|
87
|
-
and (
|
|
88
|
-
bestWidth > width
|
|
89
|
-
or badgeWidth > bestWidth
|
|
90
|
-
or (
|
|
91
|
-
badgeWidth == bestWidth
|
|
92
|
-
and badgeDPI == dpi
|
|
93
|
-
and badgeDepth <= depth
|
|
94
|
-
and (bestDepth is None or badgeDepth > bestDepth)
|
|
95
|
-
)
|
|
96
|
-
)
|
|
97
|
-
):
|
|
98
|
-
bestBadge = m
|
|
99
|
-
bestWidth = badgeWidth
|
|
100
|
-
# ?? bestHeight = badgeHeight
|
|
101
|
-
# ?? bestDPI = badgeDPI
|
|
102
|
-
bestDepth = badgeDepth
|
|
103
|
-
|
|
104
|
-
badgeImage = CGImageSourceCreateImageAtIndex(badge, bestBadge, None)
|
|
105
|
-
badgeCI = CIImage.imageWithCGImage_(badgeImage)
|
|
106
|
-
|
|
107
|
-
backgroundImage = CGImageSourceCreateImageAtIndex(backdrop, n, None)
|
|
108
|
-
backgroundCI = CIImage.imageWithCGImage_(backgroundImage)
|
|
109
|
-
|
|
110
|
-
compositor = CIFilter.filterWithName_("CISourceOverCompositing")
|
|
111
|
-
lanczos = CIFilter.filterWithName_("CILanczosScaleTransform")
|
|
112
|
-
perspective = CIFilter.filterWithName_("CIPerspectiveTransform")
|
|
113
|
-
transform = CIFilter.filterWithName_("CIAffineTransform")
|
|
114
|
-
|
|
115
|
-
lanczos.setValue_forKey_(badgeCI, kCIInputImageKey)
|
|
116
|
-
lanczos.setValue_forKey_(scale * float(width) / bestWidth, kCIInputScaleKey)
|
|
117
|
-
lanczos.setValue_forKey_(1.0, kCIInputAspectRatioKey)
|
|
118
|
-
|
|
119
|
-
topLeft = (width * scale * corners[0][0], width * scale * corners[0][1])
|
|
120
|
-
topRight = (width * scale * corners[1][0], width * scale * corners[1][1])
|
|
121
|
-
bottomRight = (width * scale * corners[2][0], width * scale * corners[2][1])
|
|
122
|
-
bottomLeft = (width * scale * corners[3][0], width * scale * corners[3][1])
|
|
123
|
-
|
|
124
|
-
out = lanczos.valueForKey_(kCIOutputImageKey)
|
|
125
|
-
if width >= 16:
|
|
126
|
-
perspective.setValue_forKey_(out, kCIInputImageKey)
|
|
127
|
-
perspective.setValue_forKey_(
|
|
128
|
-
CIVector.vectorWithX_Y_(*topLeft), "inputTopLeft"
|
|
129
|
-
)
|
|
130
|
-
perspective.setValue_forKey_(
|
|
131
|
-
CIVector.vectorWithX_Y_(*topRight), "inputTopRight"
|
|
132
|
-
)
|
|
133
|
-
perspective.setValue_forKey_(
|
|
134
|
-
CIVector.vectorWithX_Y_(*bottomRight), "inputBottomRight"
|
|
135
|
-
)
|
|
136
|
-
perspective.setValue_forKey_(
|
|
137
|
-
CIVector.vectorWithX_Y_(*bottomLeft), "inputBottomLeft"
|
|
138
|
-
)
|
|
139
|
-
out = perspective.valueForKey_(kCIOutputImageKey)
|
|
140
|
-
|
|
141
|
-
tfm = NSAffineTransform.transform()
|
|
142
|
-
tfm.translateXBy_yBy_(
|
|
143
|
-
math.floor((position[0] - 0.5 * scale) * width),
|
|
144
|
-
math.floor((position[1] - 0.5 * scale) * height),
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
transform.setValue_forKey_(out, kCIInputImageKey)
|
|
148
|
-
transform.setValue_forKey_(tfm, "inputTransform")
|
|
149
|
-
out = transform.valueForKey_(kCIOutputImageKey)
|
|
150
|
-
|
|
151
|
-
compositor.setValue_forKey_(out, kCIInputImageKey)
|
|
152
|
-
compositor.setValue_forKey_(backgroundCI, kCIInputBackgroundImageKey)
|
|
153
|
-
|
|
154
|
-
result = compositor.valueForKey_(kCIOutputImageKey)
|
|
155
|
-
|
|
156
|
-
cgContext = CGBitmapContextCreate(
|
|
157
|
-
None, width, height, 8, 0, rgbColorSpace, kCGImageAlphaPremultipliedLast
|
|
158
|
-
)
|
|
159
|
-
context = CIContext.contextWithCGContext_options_(cgContext, None)
|
|
160
|
-
|
|
161
|
-
context.drawImage_inRect_fromRect_(
|
|
162
|
-
result, ((0, 0), (width, height)), ((0, 0), (width, height))
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
image = CGBitmapContextCreateImage(cgContext)
|
|
166
|
-
|
|
167
|
-
CGImageDestinationAddImage(target, image, props)
|
|
168
|
-
|
|
169
|
-
CGImageDestinationFinalize(target)
|