aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-07-27 13:00:21 -0700
committerJake Petroules <jake.petroules@qt.io>2017-07-28 16:24:57 +0000
commit149980a682edd4874968749565b690e0431e9115 (patch)
treeaed33540045b23db0e2d1a02169f8e000d960179
parent998c69898058a7917a35875b7c7591bba6cf9f48 (diff)
Update third party DMG dependencies
These are now all pure and untouched from upstream. Change-Id: I0721258122bd72a89114bbdd3ab8f8ca7482a988 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json4
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py143
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json4
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py15
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json4
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py76
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py56
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py55
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py6
-rw-r--r--src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json4
10 files changed, 221 insertions, 146 deletions
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json
index 6b0df2d21..266e9dd89 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json
+++ b/src/3rdparty/python/lib/python2.7/site-packages/biplist/qt_attribution.json
@@ -5,8 +5,8 @@
"QtUsage": "Used in the qbs dmg module for building Apple disk images.",
"Description": "biplist is a library for reading/writing binary plists.",
"Homepage": "https://bitbucket.org/wooster/biplist",
- "Version": "1.0.1",
- "License": "BSD 3-clause "New" or "Revised" License",
+ "Version": "1.0.2",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
"LicenseId": "BSD-3-Clause",
"LicenseFile": "LICENSE",
"Copyright": "Copyright (c) 2010, Andrew Wooster"
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py
index 91f5e6c24..9ffcd3790 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py
+++ b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/core.py
@@ -127,8 +127,9 @@ def load_json(filename, settings):
settings['symlinks'] = symlinks
settings['icon_locations'] = icon_locations
-def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDPI=True):
- settings = {
+def build_dmg(filename, volume_name, settings_file=None, settings={},
+ defines={}, lookForHiDPI=True):
+ options = {
# Default settings
'filename': filename,
'volume_name': volume_name,
@@ -199,26 +200,30 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
if settings_file:
# We now support JSON settings files using appdmg's format
if settings_file.endswith('.json'):
- load_json(settings_file, settings)
+ load_json(settings_file, options)
else:
- load_settings(settings_file, settings)
+ load_settings(settings_file, options)
+
+ # Add any overrides
+ options.update(settings)
# Set up the finder data
- bounds = settings['window_rect']
+ bounds = options['window_rect']
+ bounds_string = '{{%s, %s}, {%s, %s}}' % (bounds[0][0],
+ bounds[0][1],
+ bounds[1][0],
+ bounds[1][1])
bwsp = {
- b'ShowStatusBar': settings['show_status_bar'],
- b'WindowBounds': b'{{%s, %s}, {%s, %s}}' % (bounds[0][0],
- bounds[0][1],
- bounds[1][0],
- bounds[1][1]),
- b'ContainerShowSidebar': False,
- b'PreviewPaneVisibility': False,
- b'SidebarWidth': settings['sidebar_width'],
- b'ShowTabView': settings['show_tab_view'],
- b'ShowToolbar': settings['show_toolbar'],
- b'ShowPathbar': settings['show_pathbar'],
- b'ShowSidebar': settings['show_sidebar']
+ 'ShowStatusBar': options['show_status_bar'],
+ 'WindowBounds': bounds_string.encode('utf-8'),
+ 'ContainerShowSidebar': False,
+ 'PreviewPaneVisibility': False,
+ 'SidebarWidth': options['sidebar_width'],
+ 'ShowTabView': options['show_tab_view'],
+ 'ShowToolbar': options['show_toolbar'],
+ 'ShowPathbar': options['show_pathbar'],
+ 'ShowSidebar': options['show_sidebar']
}
arrange_options = {
@@ -233,25 +238,25 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
}
icvp = {
- b'viewOptionsVersion': 1,
- b'backgroundType': 0,
- b'backgroundColorRed': 1.0,
- b'backgroundColorGreen': 1.0,
- b'backgroundColorBlue': 1.0,
- b'gridOffsetX': float(settings['grid_offset'][0]),
- b'gridOffsetY': float(settings['grid_offset'][1]),
- b'gridSpacing': float(settings['grid_spacing']),
- b'arrangeBy': str(arrange_options.get(settings['arrange_by'], 'none')),
- b'showIconPreview': settings['show_icon_preview'] == True,
- b'showItemInfo': settings['show_item_info'] == True,
- b'labelOnBottom': settings['label_pos'] == 'bottom',
- b'textSize': float(settings['text_size']),
- b'iconSize': float(settings['icon_size']),
- b'scrollPositionX': float(settings['scroll_position'][0]),
- b'scrollPositionY': float(settings['scroll_position'][1])
+ 'viewOptionsVersion': 1,
+ 'backgroundType': 0,
+ 'backgroundColorRed': 1.0,
+ 'backgroundColorGreen': 1.0,
+ 'backgroundColorBlue': 1.0,
+ 'gridOffsetX': float(options['grid_offset'][0]),
+ 'gridOffsetY': float(options['grid_offset'][1]),
+ 'gridSpacing': float(options['grid_spacing']),
+ 'arrangeBy': str(arrange_options.get(options['arrange_by'], 'none')),
+ 'showIconPreview': options['show_icon_preview'] == True,
+ 'showItemInfo': options['show_item_info'] == True,
+ 'labelOnBottom': options['label_pos'] == 'bottom',
+ 'textSize': float(options['text_size']),
+ 'iconSize': float(options['icon_size']),
+ 'scrollPositionX': float(options['scroll_position'][0]),
+ 'scrollPositionY': float(options['scroll_position'][1])
}
- background = settings['background']
+ background = options['background']
columns = {
'name': 'name',
@@ -293,25 +298,25 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
}
lsvp = {
- b'viewOptionsVersion': 1,
- b'sortColumn': columns.get(settings['list_sort_by'], 'name'),
- b'textSize': float(settings['list_text_size']),
- b'iconSize': float(settings['list_icon_size']),
- b'showIconPreview': settings['show_icon_preview'],
- b'scrollPositionX': settings['list_scroll_position'][0],
- b'scrollPositionY': settings['list_scroll_position'][1],
- b'useRelativeDates': settings['list_use_relative_dates'],
- b'calculateAllSizes': settings['list_calculate_all_sizes'],
+ 'viewOptionsVersion': 1,
+ 'sortColumn': columns.get(options['list_sort_by'], 'name'),
+ 'textSize': float(options['list_text_size']),
+ 'iconSize': float(options['list_icon_size']),
+ 'showIconPreview': options['show_icon_preview'],
+ 'scrollPositionX': options['list_scroll_position'][0],
+ 'scrollPositionY': options['list_scroll_position'][1],
+ 'useRelativeDates': options['list_use_relative_dates'],
+ 'calculateAllSizes': options['list_calculate_all_sizes'],
}
lsvp['columns'] = {}
cndx = {}
- for n, column in enumerate(settings['list_columns']):
+ for n, column in enumerate(options['list_columns']):
cndx[column] = n
- width = settings['list_column_widths'].get(column,
+ width = options['list_column_widths'].get(column,
default_widths[column])
- asc = 'ascending' == settings['list_column_sort_directions'].get(column,
+ asc = 'ascending' == options['list_column_sort_directions'].get(column,
default_sort_directions[column])
lsvp['columns'][columns[column]] = {
@@ -322,7 +327,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
'ascending': asc
}
- n = len(settings['list_columns'])
+ n = len(options['list_columns'])
for k in iterkeys(columns):
if cndx.get(k, None) is None:
cndx[k] = n
@@ -339,7 +344,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
n += 1
- default_view = settings['default_view']
+ default_view = options['default_view']
views = {
'icon-view': b'icnv',
'column-view': b'clmv',
@@ -350,14 +355,14 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
icvl = (b'type', views.get(default_view, 'icnv'))
include_icon_view_settings = default_view == 'icon-view' \
- or settings['include_icon_view_settings'] not in \
+ or options['include_icon_view_settings'] not in \
('auto', 'no', 0, False, None)
include_list_view_settings = default_view in ('list-view', 'coverflow') \
- or settings['include_list_view_settings'] not in \
+ or options['include_list_view_settings'] not in \
('auto', 'no', 0, False, None)
- filename = settings['filename']
- volume_name = settings['volume_name']
+ filename = options['filename']
+ volume_name = options['volume_name']
# Construct a writeable image to start with
dirname, basename = os.path.split(os.path.realpath(filename))
@@ -366,7 +371,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
writableFile = tempfile.NamedTemporaryFile(dir=dirname, prefix='.temp',
suffix=basename)
- total_size = settings['size']
+ total_size = options['size']
if total_size == None:
# Start with a size of 128MB - this way we don't need to calculate the
# size of the background image, volume icon, and .DS_Store file (and
@@ -377,7 +382,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
def roundup(x, n):
return x if x % n == 0 else x + n - x % n
- for path in settings['files']:
+ for path in options['files']:
if isinstance(path, tuple):
path = path[0]
@@ -389,7 +394,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
else:
total_size += roundup(os.lstat(path).st_size, 4096)
- for name,target in iteritems(settings['symlinks']):
+ for name,target in iteritems(options['symlinks']):
total_size += 4096
total_size = str(max(total_size / 1024, 1024)) + 'K'
@@ -420,9 +425,9 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
device = info['dev-entry']
mount_point = info['mount-point']
- icon = settings['icon']
+ icon = options['icon']
if badge:
- badge_icon = settings['badge_icon']
+ badge_icon = options['badge_icon']
else:
badge_icon = None
icon_target_path = os.path.join(mount_point, '.VolumeIcon.icns')
@@ -491,7 +496,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
'resources/' + background + '.tiff')
path_in_image = os.path.join(mount_point, '.background.tiff')
- with open(path_in_image, 'w') as f:
+ with open(path_in_image, 'wb') as f:
f.write(tiffdata)
else:
raise ValueError('background file "%s" not found' % background)
@@ -502,7 +507,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
icvp['backgroundType'] = 2
icvp['backgroundImageAlias'] = biplist.Data(alias.to_bytes())
- for f in settings['files']:
+ for f in options['files']:
if isinstance(f, tuple):
f_in_image = os.path.join(mount_point, f[1])
f = f[0]
@@ -513,13 +518,13 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
# use system ditto command to preserve code signing, etc.
subprocess.call(['/usr/bin/ditto', f, f_in_image])
- for name,target in iteritems(settings['symlinks']):
+ for name,target in iteritems(options['symlinks']):
name_in_image = os.path.join(mount_point, name)
os.symlink(target, name_in_image)
- userfn = settings.get('create_hook', None)
+ userfn = options.get('create_hook', None)
if callable(userfn):
- userfn(mount_point, settings)
+ userfn(mount_point, options)
image_dsstore = os.path.join(mount_point, '.DS_Store')
@@ -534,7 +539,7 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
d['.']['lsvp'] = lsvp
d['.']['icvl'] = icvl
- for k,v in iteritems(settings['icon_locations']):
+ for k,v in iteritems(options['icon_locations']):
d[k]['Iloc'] = v
# Delete .Trashes, if it gets created
@@ -561,30 +566,30 @@ def build_dmg(filename, volume_name, settings_file=None, defines={}, lookForHiDP
raise DMGError('Unable to shrink')
key_prefix = {'UDZO': 'zlib', 'UDBZ': 'bzip2', 'ULFO': 'lzfse'}
- compression_level = settings['compression_level']
- if settings['format'] in key_prefix and compression_level:
+ compression_level = options['compression_level']
+ if options['format'] in key_prefix and compression_level:
compression_args = [
'-imagekey',
- key_prefix[settings['format']] + '-level=' + str(compression_level)
+ key_prefix[options['format']] + '-level=' + str(compression_level)
]
else:
compression_args = []
ret, output = hdiutil('convert', writableFile.name,
- '-format', settings['format'],
+ '-format', options['format'],
'-ov',
'-o', filename, *compression_args)
if ret:
raise DMGError('Unable to convert')
- if settings['license']:
+ if options['license']:
ret, output = hdiutil('unflatten', '-quiet', filename, plist=False)
if ret:
raise DMGError('Unable to unflatten to add license')
- licensing.add_license(filename, settings['license'])
+ licensing.add_license(filename, options['license'])
ret, output = hdiutil('flatten', '-quiet', filename, plist=False)
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json
index 9f318e6d2..d9f97ae2c 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json
+++ b/src/3rdparty/python/lib/python2.7/site-packages/dmgbuild/qt_attribution.json
@@ -4,8 +4,8 @@
"QDocModule": "qbs",
"QtUsage": "Used in the qbs dmg module for building Apple disk images.",
"Description": "macOS command line utility to build disk images",
- "Homepage": "https://bitbucket.org/al45tair/dmgbuild",
- "Version": "1.3.0~16",
+ "Homepage": "https://github.com/al45tair/dmgbuild",
+ "Version": "1.3.1",
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "LICENSE",
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py
index a94ab6e22..320768cd3 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py
+++ b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/buddy.py
@@ -158,7 +158,7 @@ class Allocator(object):
count = self._root.read('>I')[0]
for n in range(count):
nlen = self._root.read('B')[0]
- name = str(self._root.read(nlen))
+ name = bytes(self._root.read(nlen))
value = self._root.read('>I')[0]
self._toc[name] = value
@@ -347,9 +347,8 @@ class Allocator(object):
block.write('>I', len(keys))
for k in keys:
- b = k.encode('utf-8')
- block.write('B', len(b))
- block.write(b)
+ block.write('B', len(k))
+ block.write(k)
block.write('>I', self._toc[k])
# Free list
@@ -445,17 +444,23 @@ class Allocator(object):
def __getitem__(self, key):
if not isinstance(key, (str, unicode)):
raise TypeError('Keys must be of string type')
+ if not isinstance(key, bytes):
+ key = key.encode('latin_1')
return self._toc[key]
def __setitem__(self, key, value):
if not isinstance(key, (str, unicode)):
raise TypeError('Keys must be of string type')
+ if not isinstance(key, bytes):
+ key = key.encode('latin_1')
self._toc[key] = value
self._dirty = True
def __delitem__(self, key):
if not isinstance(key, (str, unicode)):
raise TypeError('Keys must be of string type')
+ if not isinstance(key, bytes):
+ key = key.encode('latin_1')
del self._toc[key]
self._dirty = True
@@ -464,7 +469,7 @@ class Allocator(object):
def keys(self):
return iterkeys(self._toc)
-
+
def __iter__(self):
return iterkeys(self._toc)
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json
index dda98b937..a4854d1ed 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json
+++ b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/qt_attribution.json
@@ -4,8 +4,8 @@
"QDocModule": "qbs",
"QtUsage": "Used in the qbs dmg module for building Apple disk images.",
"Description": "Manipulate Finder .DS_Store files from Python",
- "Homepage": "https://bitbucket.org/al45tair/ds_store",
- "Version": "1.1.0",
+ "Homepage": "https://github.com/al45tair/ds_store",
+ "Version": "1.1.2",
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "LICENSE",
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py
index bf680d77a..b6f805b24 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py
+++ b/src/3rdparty/python/lib/python2.7/site-packages/ds_store/store.py
@@ -55,12 +55,12 @@ class BookmarkCodec(object):
# .DS_Store file. This is really a convenience, and we currently only
# support a tiny subset of the possible entry types.
codecs = {
- 'Iloc': ILocCodec,
- 'bwsp': PlistCodec,
- 'lsvp': PlistCodec,
- 'lsvP': PlistCodec,
- 'icvp': PlistCodec,
- 'pBBk': BookmarkCodec
+ b'Iloc': ILocCodec,
+ b'bwsp': PlistCodec,
+ b'lsvp': PlistCodec,
+ b'lsvP': PlistCodec,
+ b'icvp': PlistCodec,
+ b'pBBk': BookmarkCodec
}
class DSStoreEntry(object):
@@ -76,6 +76,10 @@ class DSStoreEntry(object):
def __init__(self, filename, code, typecode, value=None):
if str != bytes and type(filename) == bytes:
filename = filename.decode('utf-8')
+
+ if not isinstance(code, bytes):
+ code = code.encode('latin_1')
+
self.filename = filename
self.code = code
self.type = typecode
@@ -187,25 +191,28 @@ class DSStoreEntry(object):
utf16 = self.filename.encode('utf-16be')
l = 4 + len(utf16) + 8
- if isinstance(self.type, (str, unicode)):
+ if isinstance(self.type, unicode):
+ entry_type = self.type.encode('latin_1')
+ value = self.value
+ elif isinstance(self.type, (bytes, str)):
entry_type = self.type
value = self.value
else:
- entry_type = 'blob'
+ entry_type = b'blob'
value = self.type.encode(self.value)
- if entry_type == 'bool':
+ if entry_type == b'bool':
l += 1
- elif entry_type == 'long' or entry_type == 'shor':
+ elif entry_type == b'long' or entry_type == b'shor':
l += 4
- elif entry_type == 'blob':
+ elif entry_type == b'blob':
l += 4 + len(value)
- elif entry_type == 'ustr':
+ elif entry_type == b'ustr':
utf16 = value.encode('utf-16be')
l += 4 + len(utf16)
- elif entry_type == 'type':
+ elif entry_type == b'type':
l += 4
- elif entry_type == 'comp' or entry_type == 'dutc':
+ elif entry_type == b'comp' or entry_type == b'dutc':
l += 8
else:
raise ValueError('Unknown type code "%s"' % entry_type)
@@ -218,33 +225,38 @@ class DSStoreEntry(object):
w = block.insert
else:
w = block.write
-
- if isinstance(self.type, (str, unicode)):
+
+ if isinstance(self.type, unicode):
+ entry_type = self.type.encode('latin_1')
+ value = self.value
+ elif isinstance(self.type, (bytes, str)):
entry_type = self.type
value = self.value
else:
- entry_type = 'blob'
+ entry_type = b'blob'
value = self.type.encode(self.value)
-
+
utf16 = self.filename.encode('utf-16be')
w(b'>I', len(utf16) // 2)
w(utf16)
- w(b'>4s4s', self.code.encode('utf-8'), entry_type.encode('utf-8'))
+ w(b'>4s4s', self.code, entry_type)
- if entry_type == 'bool':
+ if entry_type == b'bool':
w(b'>?', value)
- elif entry_type == 'long' or entry_type == 'shor':
+ elif entry_type == b'long' or entry_type == b'shor':
w(b'>I', value)
- elif entry_type == 'blob':
+ elif entry_type == b'blob':
w(b'>I', len(value))
w(value)
- elif entry_type == 'ustr':
+ elif entry_type == b'ustr':
utf16 = value.encode('utf-16be')
w(b'>I', len(utf16) // 2)
w(utf16)
- elif entry_type == 'type':
- w(b'>4s', value.encode('utf-8'))
- elif entry_type == 'comp' or entry_type == 'dutc':
+ elif entry_type == b'type':
+ if isinstance(value, unicode):
+ value = value.encode('latin_1')
+ w(b'>4s', value)
+ elif entry_type == b'comp' or entry_type == b'dutc':
w(b'>Q', value)
else:
raise ValueError('Unknown type code "%s"' % entry_type)
@@ -1134,6 +1146,8 @@ class DSStore(object):
# Find implementation
def _find(self, node, filename_lc, code=None):
+ if not isinstance(code, bytes):
+ code = code.encode('latin_1')
with self._get_block(node) as block:
next_node, count = block.read(b'>II')
if next_node:
@@ -1189,14 +1203,17 @@ class DSStore(object):
def __getitem__(self, code):
if code is None:
raise KeyError('no such key - [%s][None]' % self._filename)
-
+
+ if not isinstance(code, bytes):
+ code = code.encode('latin_1')
+
try:
item = next(self._store.find(self._filename, code))
except StopIteration:
raise KeyError('no such key - [%s][%s]' % (self._filename,
code))
- if not isinstance(item.type, (str, unicode)):
+ if not isinstance(item.type, (bytes, str, unicode)):
return item.value
return (item.type, item.value)
@@ -1205,6 +1222,9 @@ class DSStore(object):
if code is None:
raise KeyError('bad key - [%s][None]' % self._filename)
+ if not isinstance(code, bytes):
+ code = code.encode('latin_1')
+
codec = codecs.get(code, None)
if codec:
entry_type = codec
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py
index b35f4029b..512d2221b 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py
+++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/alias.py
@@ -14,6 +14,11 @@ import sys
if sys.platform == 'darwin':
from . import osx
+try:
+ long
+except NameError:
+ long = int
+
from .utils import *
ALIAS_KIND_FILE = 0
@@ -30,6 +35,16 @@ ALIAS_EJECTABLE_DISK = 5
ALIAS_NO_CNID = 0xffffffff
+def encode_utf8(s):
+ if isinstance(s, bytes):
+ return s
+ return s.encode('utf-8')
+
+def decode_utf8(s):
+ if isinstance(s, bytes):
+ return s.decode('utf-8')
+ return s
+
class AppleShareInfo (object):
def __init__(self, zone=None, server=None, user=None):
#: The AppleShare zone
@@ -323,6 +338,8 @@ class Alias (object):
"""Create an :class:`Alias` that points at the specified file."""
if sys.platform != 'darwin':
raise Exception('Not implemented (requires special support)')
+
+ path = encode_utf8(path)
a = Alias()
@@ -337,7 +354,7 @@ class Alias (object):
volinfo = osx.getattrlist(vol_path, attrs, 0)
vol_crtime = volinfo[0]
- vol_name = volinfo[1]
+ vol_name = encode_utf8(volinfo[1])
# Also grab various attributes of the file
attrs = [(osx.ATTR_CMN_OBJTYPE
@@ -357,7 +374,7 @@ class Alias (object):
dirname, filename = os.path.split(path)
- if dirname == '' or dirname == '.':
+ if dirname == b'' or dirname == b'.':
dirname = os.getcwd()
foldername = os.path.basename(dirname)
@@ -382,10 +399,10 @@ class Alias (object):
rel_path = os.path.relpath(path, vol_path)
# Leave off the initial '/' if vol_path is '/' (no idea why)
- if vol_path == '/':
+ if vol_path == b'/':
a.target.posix_path = rel_path
else:
- a.target.posix_path = '/' + rel_path
+ a.target.posix_path = b'/' + rel_path
# Construct the Carbon and CNID paths
carbon_path = []
@@ -398,10 +415,11 @@ class Alias (object):
attrs = [osx.ATTR_CMN_FILEID, 0, 0, 0, 0]
info = osx.getattrlist(os.path.join(vol_path, head), attrs, 0)
cnid_path.append(info[0])
- carbon_tail = tail.replace(':','/')
+ carbon_tail = tail.replace(b':',b'/')
carbon_path.insert(0, carbon_tail)
head, tail = os.path.split(head)
- carbon_path = vol_name + ':' + ':\0'.join(carbon_path)
+
+ carbon_path = vol_name + b':' + b':\0'.join(carbon_path)
a.target.carbon_path = carbon_path
a.target.cnid_path = cnid_path
@@ -413,8 +431,8 @@ class Alias (object):
pos = b.tell()
b.write(struct.pack(b'>4shh', self.appinfo, 0, self.version))
- carbon_volname = self.volume.name.replace(':','/').encode('utf-8')
- carbon_filename = self.target.filename.replace(':','/').encode('utf-8')
+ carbon_volname = encode_utf8(self.volume.name).replace(b':',b'/')
+ carbon_filename = encode_utf8(self.target.filename).replace(b':',b'/')
voldate = (self.volume.creation_date - mac_epoch).total_seconds()
crdate = (self.target.creation_date - mac_epoch).total_seconds()
@@ -422,13 +440,13 @@ class Alias (object):
# (so doing so is ridiculous, and nothing could rely on it).
b.write(struct.pack(b'>h28pI2shI64pII4s4shhI2s10s',
self.target.kind,
- carbon_volname, voldate,
+ carbon_volname, int(voldate),
self.volume.fs_type,
self.volume.disk_type,
self.target.folder_cnid,
carbon_filename,
self.target.cnid,
- crdate,
+ int(crdate),
self.target.creator_code,
self.target.type_code,
self.target.levels_from,
@@ -439,8 +457,8 @@ class Alias (object):
# Excuse the odd order; we're copying Finder
if self.target.folder_name:
- carbon_foldername = self.target.folder_name.replace(':','/')\
- .encode('utf-8')
+ carbon_foldername = encode_utf8(self.target.folder_name)\
+ .replace(b':',b'/')
b.write(struct.pack(b'>hh', TAG_CARBON_FOLDER_NAME,
len(carbon_foldername)))
b.write(carbon_foldername)
@@ -461,7 +479,7 @@ class Alias (object):
b.write(cnid_path)
if self.target.carbon_path:
- carbon_path=self.target.carbon_path.encode('utf-8')
+ carbon_path=encode_utf8(self.target.carbon_path)
b.write(struct.pack(b'>hh', TAG_CARBON_PATH,
len(carbon_path)))
b.write(carbon_path)
@@ -490,7 +508,7 @@ class Alias (object):
b.write(b'\0')
if self.volume.driver_name:
- driver_name = self.volume.driver_name.encode('utf-8')
+ driver_name = encode_utf8(self.volume.driver_name)
b.write(struct.pack(b'>hh', TAG_DRIVER_NAME,
len(driver_name)))
b.write(driver_name)
@@ -511,20 +529,22 @@ class Alias (object):
if len(self.volume.network_mount_info) & 1:
b.write(b'\0')
- utf16 = self.target.filename.replace(':','/').encode('utf-16-be')
+ utf16 = decode_utf8(self.target.filename)\
+ .replace(':','/').encode('utf-16-be')
b.write(struct.pack(b'>hhh', TAG_UNICODE_FILENAME,
len(utf16) + 2,
len(utf16) // 2))
b.write(utf16)
- utf16 = self.volume.name.replace(':','/').encode('utf-16-be')
+ utf16 = decode_utf8(self.volume.name)\
+ .replace(':','/').encode('utf-16-be')
b.write(struct.pack(b'>hhh', TAG_UNICODE_VOLUME_NAME,
len(utf16) + 2,
len(utf16) // 2))
b.write(utf16)
if self.target.posix_path:
- posix_path = self.target.posix_path.encode('utf-8')
+ posix_path = encode_utf8(self.target.posix_path)
b.write(struct.pack(b'>hh', TAG_POSIX_PATH,
len(posix_path)))
b.write(posix_path)
@@ -532,7 +552,7 @@ class Alias (object):
b.write(b'\0')
if self.volume.posix_path:
- posix_path = self.volume.posix_path.encode('utf-8')
+ posix_path = encode_utf8(self.volume.posix_path)
b.write(struct.pack(b'>hh', TAG_POSIX_PATH_TO_MOUNTPOINT,
len(posix_path)))
b.write(posix_path)
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py
index 41b9acf35..409ed8297 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py
+++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/bookmark.py
@@ -4,7 +4,7 @@
# for the old-fashioned alias format. The details of this format were
# reverse engineered; some things are still not entirely clear.
#
-from __future__ import unicode_literals
+from __future__ import unicode_literals, print_function
import struct
import uuid
@@ -13,11 +13,26 @@ import os
import sys
import pprint
-from urlparse import urljoin
+try:
+ from urlparse import urljoin
+except ImportError:
+ from urllib.parse import urljoin
if sys.platform == 'darwin':
from . import osx
+def iteritems(x):
+ return x.iteritems()
+
+try:
+ unicode
+except NameError:
+ unicode = str
+ long = int
+ xrange = range
+ def iteritems(x):
+ return x.items()
+
from .utils import *
BMK_DATA_TYPE_MASK = 0xffffff00
@@ -144,7 +159,7 @@ kBookmarkFileCreationDate = 0x1040
# = 0x1055 # ?
# = 0x1056 # ?
# = 0x1101 # ?
-# = 0x1102 # ?
+# = 0x1102 # ?
kBookmarkTOCPath = 0x2000 # A list of (TOC id, ?) pairs
kBookmarkVolumePath = 0x2002
kBookmarkVolumeURL = 0x2005
@@ -292,23 +307,20 @@ class Bookmark (object):
elif dtype == BMK_NULL:
return None
- print 'Unknown data type %08x' % typecode
+ print('Unknown data type %08x' % typecode)
return (typecode, databytes)
@classmethod
def from_bytes(cls, data):
"""Create a :class:`Bookmark` given byte data."""
- if isinstance(data, bytearray):
- data = bytes(data)
-
if len(data) < 16:
raise ValueError('Not a bookmark file (too short)')
magic,size,dummy,hdrsize = struct.unpack(b'<4sIII', data[0:16])
- if magic != 'book':
- raise ValueError('Not a bookmark file (bad magic)')
+ if magic != b'book':
+ raise ValueError('Not a bookmark file (bad magic) %r' % magic)
if hdrsize < 16:
raise ValueError('Not a bookmark file (header size too short)')
@@ -445,7 +457,7 @@ class Bookmark (object):
ioffset = offset + 8 + len(item) * 8
result = [struct.pack(b'<II', len(item) * 8, BMK_DICT | BMK_ST_ONE)]
enc = []
- for k,v in item.iteritems():
+ for k,v in iteritems(item):
result.append(struct.pack(b'<I', ioffset))
ioffset, ienc = cls._encode_item(k, ioffset)
enc.append(ienc)
@@ -479,8 +491,8 @@ class Bookmark (object):
for tid,toc in self.tocs:
entries = []
- for k,v in toc.iteritems():
- if isinstance(k, basestring):
+ for k,v in iteritems(toc):
+ if isinstance(k, (str, unicode)):
noffset = offset
voffset, enc = self._encode_item(k, offset)
result.append(enc)
@@ -496,7 +508,7 @@ class Bookmark (object):
# binary search to find data
entries.sort()
- tocs.append((tid, b''.join([struct.pack(b'<III',k,o,0)
+ tocs.append((tid, b''.join([struct.pack('<III',k,o,0)
for k,o in entries])))
first_toc_offset = offset
@@ -513,7 +525,7 @@ class Bookmark (object):
0xfffffffe,
tid,
next_offset,
- len(data) / 12))
+ len(data) // 12))
result.append(data)
offset += 20 + len(data)
@@ -536,7 +548,7 @@ class Bookmark (object):
# Find the filesystem
st = osx.statfs(path)
- vol_path = st.f_mntonname
+ vol_path = st.f_mntonname.decode('utf-8')
# Grab its attributes
attrs = [osx.ATTR_CMN_CRTIME,
@@ -583,6 +595,9 @@ class Bookmark (object):
foldername = os.path.basename(dirname)
+ print(repr(path))
+ print(repr(vol_path))
+
rel_path = os.path.relpath(path, vol_path)
# Build the path arrays
@@ -609,6 +624,12 @@ class Bookmark (object):
volprops = Data(struct.pack(b'<QQQ', 0x81 | kCFURLVolumeSupportsPersistentIDs,
0x13ef | kCFURLVolumeSupportsPersistentIDs, 0))
+ print(repr(name_path))
+ print(repr(cnid_path))
+ print(repr(fileprops))
+ print(repr(vol_path))
+ print(repr(vol_name))
+
toc = {
kBookmarkPath: name_path,
kBookmarkCNIDPath: cnid_path,
@@ -638,8 +659,8 @@ class Bookmark (object):
result = ['Bookmark([']
for tid,toc in self.tocs:
result.append('(0x%x, {\n' % tid)
- for k,v in toc.iteritems():
- if isinstance(k, basestring):
+ for k,v in iteritems(toc):
+ if isinstance(k, (str, unicode)):
kf = repr(k)
else:
kf = '0x%04x' % k
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py
index bdd5d09e9..d4af65d75 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py
+++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/osx.py
@@ -434,7 +434,7 @@ def _datetime_from_timespec(ts):
return unix_epoch + td
def _decode_utf8_nul(sz):
- nul = sz.find('\0')
+ nul = sz.find(b'\0')
if nul > -1:
sz = sz[:nul]
return sz.decode('utf-8')
@@ -757,6 +757,8 @@ def _get_errno():
return __error().contents.value
def getattrlist(path, attrs, options):
+ if not isinstance(path, bytes):
+ path = path.encode('utf-8')
attrs = list(attrs)
if attrs[1]:
attrs[1] |= ATTR_VOL_INFO
@@ -805,6 +807,8 @@ def fgetattrlist(fd, attrs, options):
return _decode_attrlist_result(buf, attrs, options)
def statfs(path):
+ if not isinstance(path, bytes):
+ path = path.encode('utf-8')
result = struct_statfs()
ret = _statfs(path, byref(result))
if ret < 0:
diff --git a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json
index 562440cd6..2c4bdccc5 100644
--- a/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json
+++ b/src/3rdparty/python/lib/python2.7/site-packages/mac_alias/qt_attribution.json
@@ -4,8 +4,8 @@
"QDocModule": "qbs",
"QtUsage": "Used in the qbs dmg module for building Apple disk images.",
"Description": "Generate/parse Mac OS Alias records from Python",
- "Homepage": "https://bitbucket.org/al45tair/mac_alias",
- "Version": "2.0.1",
+ "Homepage": "https://github.com/al45tair/mac_alias",
+ "Version": "2.0.4",
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "LICENSE",