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')
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))]
274
302
excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
275
303
win32ui crawler.Crawler""".split())
284
312
# GUI version that is generally used.
285
313
tbzrcache = dict(
286
314
script = os.path.join(tbzr_root, "Scripts", "tbzrcache.py"),
287
icon_resources = [(0,'bzr.ico')],
315
icon_resources = icon_resources,
316
other_resources = other_resources,
289
318
console_targets.append(tbzrcache)