dmg-builder 26.0.16 → 26.0.18
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/dmg.d.ts +33 -1
- package/out/dmg.js +9 -165
- package/out/dmg.js.map +1 -1
- package/out/dmgUtil.d.ts +16 -2
- package/out/dmgUtil.js +153 -2
- package/out/dmgUtil.js.map +1 -1
- package/out/hdiuil.js +1 -1
- package/out/hdiuil.js.map +1 -1
- package/package.json +3 -4
- package/vendor/biplist/__init__.py +75 -75
- package/vendor/dmgbuild/__init__.py +5 -0
- package/vendor/dmgbuild/__main__.py +67 -0
- package/vendor/dmgbuild/badge.py +104 -78
- package/vendor/dmgbuild/colors.py +239 -229
- package/vendor/dmgbuild/core.py +945 -274
- package/vendor/dmgbuild/licensing.py +329 -0
- package/vendor/dmgbuild/resources/builtin-arrow.tiff +0 -0
- package/vendor/ds_store/__init__.py +3 -1
- package/vendor/ds_store/__main__.py +102 -0
- package/vendor/ds_store/buddy.py +142 -134
- package/vendor/ds_store/store.py +333 -322
- package/vendor/mac_alias/__init__.py +43 -23
- package/vendor/mac_alias/alias.py +334 -224
- package/vendor/mac_alias/bookmark.py +283 -278
- package/vendor/mac_alias/osx.py +406 -302
- package/vendor/mac_alias/utils.py +10 -8
- package/vendor/run_dmgbuild.py +14 -0
package/vendor/dmgbuild/badge.py
CHANGED
|
@@ -1,37 +1,61 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from __future__ import unicode_literals
|
|
3
|
-
|
|
4
|
-
from Quartz import *
|
|
5
1
|
import math
|
|
6
2
|
|
|
7
|
-
|
|
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
|
+
|
|
8
34
|
|
|
9
35
|
def badge_disk_icon(badge_file, output_file):
|
|
10
36
|
# Load the Removable disk icon
|
|
11
|
-
url = CFURLCreateWithFileSystemPath(
|
|
12
|
-
|
|
37
|
+
url = CFURLCreateWithFileSystemPath(
|
|
38
|
+
None, _REMOVABLE_DISK_PATH, kCFURLPOSIXPathStyle, False
|
|
39
|
+
)
|
|
13
40
|
backdrop = CGImageSourceCreateWithURL(url, None)
|
|
14
41
|
backdropCount = CGImageSourceGetCount(backdrop)
|
|
15
|
-
|
|
42
|
+
|
|
16
43
|
# Load the badge
|
|
17
|
-
url = CFURLCreateWithFileSystemPath(None, badge_file,
|
|
18
|
-
kCFURLPOSIXPathStyle, False)
|
|
44
|
+
url = CFURLCreateWithFileSystemPath(None, badge_file, kCFURLPOSIXPathStyle, False)
|
|
19
45
|
badge = CGImageSourceCreateWithURL(url, None)
|
|
20
|
-
assert badge is not None,
|
|
46
|
+
assert badge is not None, "Unable to process image file: %s" % badge_file
|
|
21
47
|
badgeCount = CGImageSourceGetCount(badge)
|
|
22
|
-
|
|
48
|
+
|
|
23
49
|
# Set up a destination for our target
|
|
24
|
-
url = CFURLCreateWithFileSystemPath(None, output_file,
|
|
25
|
-
|
|
26
|
-
target = CGImageDestinationCreateWithURL(url, 'com.apple.icns',
|
|
27
|
-
backdropCount, None)
|
|
50
|
+
url = CFURLCreateWithFileSystemPath(None, output_file, kCFURLPOSIXPathStyle, False)
|
|
51
|
+
target = CGImageDestinationCreateWithURL(url, "com.apple.icns", backdropCount, None)
|
|
28
52
|
|
|
29
53
|
# Get the RGB colorspace
|
|
30
54
|
rgbColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)
|
|
31
55
|
|
|
32
56
|
# Scale
|
|
33
57
|
scale = 1.0
|
|
34
|
-
|
|
58
|
+
|
|
35
59
|
# Perspective transform
|
|
36
60
|
corners = ((0.2, 0.95), (0.8, 0.95), (0.85, 0.35), (0.15, 0.35))
|
|
37
61
|
|
|
@@ -40,104 +64,106 @@ def badge_disk_icon(badge_file, output_file):
|
|
|
40
64
|
|
|
41
65
|
for n in range(backdropCount):
|
|
42
66
|
props = CGImageSourceCopyPropertiesAtIndex(backdrop, n, None)
|
|
43
|
-
width = props[
|
|
44
|
-
height = props[
|
|
45
|
-
dpi = props[
|
|
46
|
-
depth = props[
|
|
47
|
-
|
|
67
|
+
width = props["PixelWidth"]
|
|
68
|
+
height = props["PixelHeight"]
|
|
69
|
+
dpi = props["DPIWidth"]
|
|
70
|
+
depth = props["Depth"]
|
|
71
|
+
|
|
48
72
|
# Choose the best sized badge image
|
|
49
73
|
bestWidth = None
|
|
50
|
-
bestHeight = None
|
|
74
|
+
# ?? bestHeight = None
|
|
51
75
|
bestBadge = None
|
|
52
76
|
bestDepth = None
|
|
53
|
-
bestDPI = None
|
|
77
|
+
# ?? bestDPI = None
|
|
54
78
|
for m in range(badgeCount):
|
|
55
79
|
badgeProps = CGImageSourceCopyPropertiesAtIndex(badge, m, None)
|
|
56
|
-
badgeWidth = badgeProps[
|
|
57
|
-
badgeHeight = badgeProps['PixelHeight']
|
|
58
|
-
badgeDPI = badgeProps[
|
|
59
|
-
badgeDepth = badgeProps[
|
|
60
|
-
|
|
61
|
-
if bestBadge is None or (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
+
):
|
|
69
98
|
bestBadge = m
|
|
70
99
|
bestWidth = badgeWidth
|
|
71
|
-
bestHeight = badgeHeight
|
|
72
|
-
bestDPI = badgeDPI
|
|
100
|
+
# ?? bestHeight = badgeHeight
|
|
101
|
+
# ?? bestDPI = badgeDPI
|
|
73
102
|
bestDepth = badgeDepth
|
|
74
103
|
|
|
75
104
|
badgeImage = CGImageSourceCreateImageAtIndex(badge, bestBadge, None)
|
|
76
105
|
badgeCI = CIImage.imageWithCGImage_(badgeImage)
|
|
77
|
-
|
|
106
|
+
|
|
78
107
|
backgroundImage = CGImageSourceCreateImageAtIndex(backdrop, n, None)
|
|
79
108
|
backgroundCI = CIImage.imageWithCGImage_(backgroundImage)
|
|
80
|
-
|
|
81
|
-
compositor = CIFilter.filterWithName_(
|
|
82
|
-
lanczos = CIFilter.filterWithName_(
|
|
83
|
-
perspective = CIFilter.filterWithName_(
|
|
84
|
-
transform = CIFilter.filterWithName_(
|
|
85
|
-
|
|
109
|
+
|
|
110
|
+
compositor = CIFilter.filterWithName_("CISourceOverCompositing")
|
|
111
|
+
lanczos = CIFilter.filterWithName_("CILanczosScaleTransform")
|
|
112
|
+
perspective = CIFilter.filterWithName_("CIPerspectiveTransform")
|
|
113
|
+
transform = CIFilter.filterWithName_("CIAffineTransform")
|
|
114
|
+
|
|
86
115
|
lanczos.setValue_forKey_(badgeCI, kCIInputImageKey)
|
|
87
|
-
lanczos.setValue_forKey_(scale * float(width)/bestWidth, kCIInputScaleKey)
|
|
116
|
+
lanczos.setValue_forKey_(scale * float(width) / bestWidth, kCIInputScaleKey)
|
|
88
117
|
lanczos.setValue_forKey_(1.0, kCIInputAspectRatioKey)
|
|
89
118
|
|
|
90
|
-
topLeft = (width * scale * corners[0][0],
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
bottomRight = (width * scale * corners[2][0],
|
|
95
|
-
width * scale * corners[2][1])
|
|
96
|
-
bottomLeft = (width * scale * corners[3][0],
|
|
97
|
-
width * scale * corners[3][1])
|
|
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])
|
|
98
123
|
|
|
99
124
|
out = lanczos.valueForKey_(kCIOutputImageKey)
|
|
100
125
|
if width >= 16:
|
|
101
126
|
perspective.setValue_forKey_(out, kCIInputImageKey)
|
|
102
|
-
perspective.setValue_forKey_(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
perspective.setValue_forKey_(
|
|
109
|
-
|
|
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
|
+
)
|
|
110
139
|
out = perspective.valueForKey_(kCIOutputImageKey)
|
|
111
140
|
|
|
112
141
|
tfm = NSAffineTransform.transform()
|
|
113
|
-
tfm.translateXBy_yBy_(
|
|
114
|
-
|
|
142
|
+
tfm.translateXBy_yBy_(
|
|
143
|
+
math.floor((position[0] - 0.5 * scale) * width),
|
|
144
|
+
math.floor((position[1] - 0.5 * scale) * height),
|
|
145
|
+
)
|
|
115
146
|
|
|
116
147
|
transform.setValue_forKey_(out, kCIInputImageKey)
|
|
117
|
-
transform.setValue_forKey_(tfm,
|
|
148
|
+
transform.setValue_forKey_(tfm, "inputTransform")
|
|
118
149
|
out = transform.valueForKey_(kCIOutputImageKey)
|
|
119
|
-
|
|
150
|
+
|
|
120
151
|
compositor.setValue_forKey_(out, kCIInputImageKey)
|
|
121
152
|
compositor.setValue_forKey_(backgroundCI, kCIInputBackgroundImageKey)
|
|
122
153
|
|
|
123
154
|
result = compositor.valueForKey_(kCIOutputImageKey)
|
|
124
155
|
|
|
125
|
-
cgContext = CGBitmapContextCreate(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
8,
|
|
129
|
-
0,
|
|
130
|
-
rgbColorSpace,
|
|
131
|
-
kCGImageAlphaPremultipliedLast)
|
|
156
|
+
cgContext = CGBitmapContextCreate(
|
|
157
|
+
None, width, height, 8, 0, rgbColorSpace, kCGImageAlphaPremultipliedLast
|
|
158
|
+
)
|
|
132
159
|
context = CIContext.contextWithCGContext_options_(cgContext, None)
|
|
133
160
|
|
|
134
|
-
context.drawImage_inRect_fromRect_(
|
|
135
|
-
|
|
136
|
-
|
|
161
|
+
context.drawImage_inRect_fromRect_(
|
|
162
|
+
result, ((0, 0), (width, height)), ((0, 0), (width, height))
|
|
163
|
+
)
|
|
137
164
|
|
|
138
165
|
image = CGBitmapContextCreateImage(cgContext)
|
|
139
166
|
|
|
140
167
|
CGImageDestinationAddImage(target, image, props)
|
|
141
168
|
|
|
142
169
|
CGImageDestinationFinalize(target)
|
|
143
|
-
|