276
276
# collect up our icons.
277
277
cwd = os.getcwd()
278
278
ico_root = os.path.join(tbzr_root, 'tbzrlib', 'resources')
281
icos = [] # list of (path_root, relative_ico_path)
282
# First always bzr's icon and its in the root of the bzr tree.
283
icos.append(('', 'bzr.ico'))
284
for root, dirs, files in os.walk(''):
285
icos.extend([(ico_root, os.path.join(root, f))
286
for f in files if f.endswith('.ico')])
287
# allocate an icon ID for each file and the full path to the ico
288
icon_resources = [(rid, os.path.join(ico_dir, ico_name))
289
for rid, (ico_dir, ico_name) in enumerate(icos)]
290
# create a string resource with the mapping. Might as well save the
291
# runtime some effort and write a pickle.
292
# Runtime expects unicode objects with forward-slash seps.
293
fse = sys.getfilesystemencoding()
294
map_items = [(f.replace('\\', '/').decode(fse), rid)
295
for rid, (_, f) in enumerate(icos)]
296
ico_map = dict(map_items)
297
# Create a new resource type of 'ICON_MAP', and use ID=1
298
other_resources = [ ("ICON_MAP", 1, pickle.dumps(ico_map))]
279
icos = [] # list of (path_root, relative_ico_path)
280
# First always bzr's icon and its in the root of the bzr tree.
281
icos.append(('', 'bzr.ico'))
282
for root, dirs, files in os.walk(ico_root):
283
icos.extend([(ico_root, os.path.join(root, f)[len(ico_root)+1:])
284
for f in files if f.endswith('.ico')])
285
# allocate an icon ID for each file and the full path to the ico
286
icon_resources = [(rid, os.path.join(ico_dir, ico_name))
287
for rid, (ico_dir, ico_name) in enumerate(icos)]
288
# create a string resource with the mapping. Might as well save the
289
# runtime some effort and write a pickle.
290
# Runtime expects unicode objects with forward-slash seps.
291
fse = sys.getfilesystemencoding()
292
map_items = [(f.replace('\\', '/').decode(fse), rid)
293
for rid, (_, f) in enumerate(icos)]
294
ico_map = dict(map_items)
295
# Create a new resource type of 'ICON_MAP', and use ID=1
296
other_resources = [ ("ICON_MAP", 1, pickle.dumps(ico_map))]
302
298
excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
303
299
win32ui crawler.Crawler""".split())