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')
232
231
if sys.platform == 'win32':
233
232
# pyrex uses the macro WIN32 to detect the platform, even though it should
234
233
# be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
236
235
add_pyrex_extension('bzrlib._walkdirs_win32',
237
236
define_macros=[('WIN32', None)])
238
add_pyrex_extension('bzrlib._readdir_pyx')
238
239
ext_modules.append(Extension('bzrlib._patiencediff_c', ['bzrlib/_patiencediff_c.c']))
253
254
# win32com uses them. Hook this in so win32com.shell is found.
254
255
import modulefinder
257
import cPickle as pickle
256
258
for p in win32com.__path__[1:]:
257
259
modulefinder.AddPackagePath("win32com", p)
258
260
for extra in ["win32com.shell"]:
271
273
sys.path.append(os.path.join(tbzr_root, "shellext", "python"))
273
275
packages.append("tbzrlib")
277
# collect up our icons.
279
ico_root = os.path.join(tbzr_root, 'tbzrlib', 'resources')
280
icos = [] # list of (path_root, relative_ico_path)
281
# First always bzr's icon and its in the root of the bzr tree.
282
icos.append(('', 'bzr.ico'))
283
for root, dirs, files in os.walk(ico_root):
284
icos.extend([(ico_root, os.path.join(root, f)[len(ico_root)+1:])
285
for f in files if f.endswith('.ico')])
286
# allocate an icon ID for each file and the full path to the ico
287
icon_resources = [(rid, os.path.join(ico_dir, ico_name))
288
for rid, (ico_dir, ico_name) in enumerate(icos)]
289
# create a string resource with the mapping. Might as well save the
290
# runtime some effort and write a pickle.
291
# Runtime expects unicode objects with forward-slash seps.
292
fse = sys.getfilesystemencoding()
293
map_items = [(f.replace('\\', '/').decode(fse), rid)
294
for rid, (_, f) in enumerate(icos)]
295
ico_map = dict(map_items)
296
# Create a new resource type of 'ICON_MAP', and use ID=1
297
other_resources = [ ("ICON_MAP", 1, pickle.dumps(ico_map))]
274
299
excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
275
300
win32ui crawler.Crawler""".split())
284
309
# GUI version that is generally used.
285
310
tbzrcache = dict(
286
311
script = os.path.join(tbzr_root, "Scripts", "tbzrcache.py"),
287
icon_resources = [(0,'bzr.ico')],
312
icon_resources = icon_resources,
313
other_resources = other_resources,
289
315
console_targets.append(tbzrcache)