253
253
# win32com uses them. Hook this in so win32com.shell is found.
254
254
import modulefinder
256
import cPickle as pickle
256
257
for p in win32com.__path__[1:]:
257
258
modulefinder.AddPackagePath("win32com", p)
258
259
for extra in ["win32com.shell"]:
271
272
sys.path.append(os.path.join(tbzr_root, "shellext", "python"))
273
274
packages.append("tbzrlib")
276
# collect up our icons.
278
ico_root = os.path.join(tbzr_root, 'tbzrlib', 'resources')
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))]
274
298
excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
275
299
win32ui crawler.Crawler""".split())
284
308
# GUI version that is generally used.
285
309
tbzrcache = dict(
286
310
script = os.path.join(tbzr_root, "Scripts", "tbzrcache.py"),
287
icon_resources = [(0,'bzr.ico')],
311
icon_resources = icon_resources,
312
other_resources = other_resources,
289
314
console_targets.append(tbzrcache)