325
325
warnings.warn('Unknown Python version.\n'
326
326
'Please check setup.py script for compatibility.')
328
# Although we currently can't enforce it, we consider it an error for
329
# py2exe to report any files are "missing". Such modules we know aren't
330
# used should be listed here.
331
excludes = """Tkinter psyco ElementPath r_hmac
332
ImaginaryModule cElementTree elementtree.ElementTree
333
Crypto.PublicKey._fastmath
334
medusa medusa.filesys medusa.ftp_server
335
tools tools.doc_generate
336
resource validate""".split()
327
338
# email package from std python library use lazy import,
328
339
# so we need to explicitly add all package
329
340
additional_packages.add('email')
341
# And it uses funky mappings to conver to 'Oldname' to 'newname'. As
342
# a result, packages like 'email.Parser' show as missing. Tell py2exe
345
for oldname in getattr(email, '_LOWERNAMES', []):
346
excludes.append("email." + oldname)
347
for oldname in getattr(email, '_MIMENAMES', []):
348
excludes.append("email.MIME" + oldname)
331
350
# text files for help topis
332
351
text_topics = glob.glob('bzrlib/help_topics/en/*.txt')
351
370
mf.run_package('bzrlib/plugins')
352
371
packs, mods = mf.get_result()
353
372
additional_packages.update(packs)
373
includes.extend(mods)
375
console_targets = [target,
376
'tools/win32/bzr_postinstall.py',
381
if "TBZR" in os.environ:
382
# Eg: via SVN: http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.4/bin/TortoiseOverlays-1.0.4.11886-win32.msi
383
if not os.path.isfile(os.environ.get('TOVMSI_WIN32', '<nofile>')):
384
raise RuntimeError, "Please set TOVMSI_WIN32 to the location of " \
385
"the TortoiseOverlays .msi installerfile"
387
packages.append('tbzrcommands')
388
# PyQt4 itself still escapes the plugin detection code for some reason...
389
packages.append('PyQt4')
390
includes.append('sip') # extension module required for Qt.
392
# ModuleFinder can't handle runtime changes to __path__, but
393
# win32com uses them. Hook this in so win32com.shell is found.
396
for p in win32com.__path__[1:]:
397
modulefinder.AddPackagePath("win32com", p)
398
for extra in ["win32com.shell"]:
400
m = sys.modules[extra]
401
for p in m.__path__[1:]:
402
modulefinder.AddPackagePath(extra, p)
404
# TBZR points to the TBZR directory
405
tbzr_root = os.environ["TBZR"]
407
# Ensure tbzrlib itself is on sys.path
408
sys.path.append(tbzr_root)
410
# Ensure our COM "entry-point" is on sys.path
411
sys.path.append(os.path.join(tbzr_root, "shellext", "python"))
413
packages.append("tbzrlib")
414
excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
415
win32ui crawler.Crawler""".split())
419
create_exe = False, # we only want a .dll
421
com_targets.append(tbzr)
423
# tbzrcache executables - a "console" version for debugging and a
424
# GUI version that is generally used.
426
script = os.path.join(tbzr_root, "Scripts", "tbzrcache.py"),
427
icon_resources = [(0,'bzr.ico')],
429
console_targets.append(tbzrcache)
431
# Make a windows version which is the same except for the base name.
432
tbzrcachew = tbzrcache.copy()
433
tbzrcachew["dest_base"]="tbzrcachew"
434
gui_targets.append(tbzrcachew)
436
# ditto for the tbzrcommand tool
438
script = os.path.join(tbzr_root, "Scripts", "tbzrcommand.py"),
439
icon_resources = [(0,'bzr.ico')],
441
console_targets.append(tbzrcommand)
442
tbzrcommandw = tbzrcommand.copy()
443
tbzrcommandw["dest_base"]="tbzrcommandw"
444
gui_targets.append(tbzrcommandw)
448
script = os.path.join(tbzr_root, "Scripts", "tbzrtest.py"),
450
console_targets.append(tbzrtest)
452
# A utility to see python output from the shell extension - this will
453
# die when we get a c++ extension
454
# any .py file from pywin32's win32 lib will do (other than
455
# win32traceutil itself that is)
457
win32_lib_dir = os.path.dirname(winerror.__file__)
458
tracer = dict(script = os.path.join(win32_lib_dir, "win32traceutil.py"),
459
dest_base="tbzr_tracer")
460
console_targets.append(tracer)
463
# print this warning to stderr as output is redirected, so it is seen
464
# at build time. Also to stdout so it appears in the log
465
for f in (sys.stderr, sys.stdout):
467
"Skipping TBZR binaries - please set TBZR to a directory to enable"
355
469
# MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
357
471
options_list = {"py2exe": {"packages": packages + list(additional_packages),
358
"includes": includes + mods,
359
"excludes": ["Tkinter", "medusa", "tools"],
472
"includes": includes,
473
"excludes": excludes,
360
474
"dll_excludes": ["MSWSOCK.dll"],
361
475
"dist_dir": "win32_bzr.exe",
364
480
setup(options=options_list,
366
'tools/win32/bzr_postinstall.py',
481
console=console_targets,
483
com_server=com_targets,
368
484
zipfile='lib/library.zip',
369
485
data_files=topics_files + plugins_files,