228
228
add_pyrex_extension('bzrlib._btree_serializer_c')
229
229
add_pyrex_extension('bzrlib._dirstate_helpers_c')
230
230
add_pyrex_extension('bzrlib._knit_load_data_c')
231
add_pyrex_extension('bzrlib._readdir_pyx')
231
232
if sys.platform == 'win32':
232
233
# pyrex uses the macro WIN32 to detect the platform, even though it should
233
234
# be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
252
253
# win32com uses them. Hook this in so win32com.shell is found.
253
254
import modulefinder
256
import cPickle as pickle
255
257
for p in win32com.__path__[1:]:
256
258
modulefinder.AddPackagePath("win32com", p)
257
259
for extra in ["win32com.shell"]:
270
272
sys.path.append(os.path.join(tbzr_root, "shellext", "python"))
272
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))]
273
298
excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
274
299
win32ui crawler.Crawler""".split())
283
308
# GUI version that is generally used.
284
309
tbzrcache = dict(
285
310
script = os.path.join(tbzr_root, "Scripts", "tbzrcache.py"),
286
icon_resources = [(0,'bzr.ico')],
311
icon_resources = icon_resources,
312
other_resources = other_resources,
288
314
console_targets.append(tbzrcache)