228
228
add_pyrex_extension('bzrlib._btree_serializer_c')
229
add_pyrex_extension('bzrlib._dirstate_helpers_c')
230
229
add_pyrex_extension('bzrlib._knit_load_data_c')
231
add_pyrex_extension('bzrlib._readdir_pyx')
232
230
if sys.platform == 'win32':
231
add_pyrex_extension('bzrlib._dirstate_helpers_c',
233
234
# pyrex uses the macro WIN32 to detect the platform, even though it should
234
235
# be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
236
237
add_pyrex_extension('bzrlib._walkdirs_win32',
237
238
define_macros=[('WIN32', None)])
240
add_pyrex_extension('bzrlib._dirstate_helpers_c')
241
add_pyrex_extension('bzrlib._readdir_pyx')
238
242
ext_modules.append(Extension('bzrlib._patiencediff_c', ['bzrlib/_patiencediff_c.c']))
253
257
# win32com uses them. Hook this in so win32com.shell is found.
254
258
import modulefinder
260
import cPickle as pickle
256
261
for p in win32com.__path__[1:]:
257
262
modulefinder.AddPackagePath("win32com", p)
258
263
for extra in ["win32com.shell"]:
271
276
sys.path.append(os.path.join(tbzr_root, "shellext", "python"))
273
278
packages.append("tbzrlib")
280
# collect up our icons.
282
ico_root = os.path.join(tbzr_root, 'tbzrlib', 'resources')
283
icos = [] # list of (path_root, relative_ico_path)
284
# First always bzr's icon and its in the root of the bzr tree.
285
icos.append(('', 'bzr.ico'))
286
for root, dirs, files in os.walk(ico_root):
287
icos.extend([(ico_root, os.path.join(root, f)[len(ico_root)+1:])
288
for f in files if f.endswith('.ico')])
289
# allocate an icon ID for each file and the full path to the ico
290
icon_resources = [(rid, os.path.join(ico_dir, ico_name))
291
for rid, (ico_dir, ico_name) in enumerate(icos)]
292
# create a string resource with the mapping. Might as well save the
293
# runtime some effort and write a pickle.
294
# Runtime expects unicode objects with forward-slash seps.
295
fse = sys.getfilesystemencoding()
296
map_items = [(f.replace('\\', '/').decode(fse), rid)
297
for rid, (_, f) in enumerate(icos)]
298
ico_map = dict(map_items)
299
# Create a new resource type of 'ICON_MAP', and use ID=1
300
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)
326
355
excludes.append('PyQt4.elementtree.ElementTree')
327
356
includes.append('sip') # extension module required for Qt.
328
357
packages.append('pygments') # colorizer for qbzr
358
packages.append('docutils') # html formatting
329
359
# but we can avoid many Qt4 Dlls.
330
360
dll_excludes.extend(
331
361
"""QtAssistantClient4.dll QtCLucene4.dll QtDesigner4.dll
484
514
plugins = set(dirs)
487
if os.path.splitext(i)[1] not in [".py", ".pyd", ".dll"]:
517
if os.path.splitext(i)[1] not in [".py", ".pyd", ".dll", ".mo"]:
489
519
if i == '__init__.py' and root == 'bzrlib/plugins':