197
197
except DistutilsPlatformError, e:
198
198
if not self.allow_python_fallback:
199
199
log.warn('\n Cannot build extensions.\n'
200
' Use --allow-python-fallback to use slower'
201
' python implementations instead.\n')
200
' Use "build_ext --allow-python-fallback" to use'
201
' slower python implementations instead.\n')
204
204
log.warn('\n Extensions cannot be built.\n'
209
209
build_ext.build_extension(self, ext)
210
210
except CCompilerError:
211
211
if not self.allow_python_fallback:
212
log.warn('\n Failed to build "%s".\n'
213
' Use --allow-python-fallback to use slower'
214
' python implementations instead.\n'
212
log.warn('\n Cannot build extensions.\n'
213
' Use "build_ext --allow-python-fallback" to use'
214
' slower python implementations instead.\n'
217
217
log.warn('\n Building of "%s" extension failed.\n'
291
291
def get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
292
gui_targets, data_files):
293
293
packages.append('tbzrcommands')
295
295
# ModuleFinder can't handle runtime changes to __path__, but
341
341
excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
342
342
win32ui crawler.Crawler""".split())
344
# NOTE: We still create a DLL version of the Python implemented shell
345
# extension for testing purposes - but it is *not* registered by
346
# default - our C++ one is instead. To discourage people thinking
347
# this DLL is still necessary, its called 'tbzr_old.dll'
345
349
modules=["tbzr"],
346
350
create_exe = False, # we only want a .dll
351
dest_base = 'tbzr_old',
348
353
com_targets.append(tbzr)
350
355
# tbzrcache executables - a "console" version for debugging and a
351
356
# GUI version that is generally used.
352
357
tbzrcache = dict(
353
script = os.path.join(tbzr_root, "Scripts", "tbzrcache.py"),
358
script = os.path.join(tbzr_root, "scripts", "tbzrcache.py"),
354
359
icon_resources = icon_resources,
355
360
other_resources = other_resources,
364
369
# ditto for the tbzrcommand tool
365
370
tbzrcommand = dict(
366
script = os.path.join(tbzr_root, "Scripts", "tbzrcommand.py"),
371
script = os.path.join(tbzr_root, "scripts", "tbzrcommand.py"),
367
372
icon_resources = [(0,'bzr.ico')],
369
374
console_targets.append(tbzrcommand)
371
376
tbzrcommandw["dest_base"]="tbzrcommandw"
372
377
gui_targets.append(tbzrcommandw)
376
script = os.path.join(tbzr_root, "Scripts", "tbzrtest.py"),
378
console_targets.append(tbzrtest)
380
# A utility to see python output from the shell extension - this will
381
# die when we get a c++ extension
382
# any .py file from pywin32's win32 lib will do (other than
383
# win32traceutil itself that is)
385
win32_lib_dir = os.path.dirname(winerror.__file__)
386
tracer = dict(script = os.path.join(win32_lib_dir, "win32traceutil.py"),
387
dest_base="tbzr_tracer")
379
# A utility to see python output from both C++ and Python based shell
381
tracer = dict(script=os.path.join(tbzr_root, "scripts", "tbzrtrace.py"))
388
382
console_targets.append(tracer)
384
# The C++ implemented shell extensions.
385
dist_dir = os.path.join(tbzr_root, "shellext", "cpp", "tbzrshellext",
387
data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x86.dll')]))
388
data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x64.dll')]))
391
391
def get_qbzr_py2exe_info(includes, excludes, packages):
392
392
# PyQt4 itself still escapes the plugin detection code for some reason...
408
408
os.environ["PATH"] = path + os.pathsep + qt_dir
411
def get_svn_py2exe_info(includes, excludes, packages):
412
packages.append('subvertpy')
411
415
if 'bdist_wininst' in sys.argv:
551
555
for root, dirs, files in os.walk('bzrlib/plugins'):
552
556
if root == 'bzrlib/plugins':
553
557
plugins = set(dirs)
558
# We ship plugins as normal files on the file-system - however,
559
# the build process can cause *some* of these plugin files to end
560
# up in library.zip. Thus, we saw (eg) "plugins/svn/test" in
561
# library.zip, and then saw import errors related to that as the
562
# rest of the svn plugin wasn't. So we tell py2exe to leave the
563
# plugins out of the .zip file
564
excludes.extend(["bzrlib.plugins." + d for d in dirs])
556
567
if os.path.splitext(i)[1] not in [".py", ".pyd", ".dll", ".mo"]:
588
data_files = topics_files + plugins_files
578
590
if 'qbzr' in plugins:
579
591
get_qbzr_py2exe_info(includes, excludes, packages)
594
get_svn_py2exe_info(includes, excludes, packages)
581
596
if "TBZR" in os.environ:
582
597
# TORTOISE_OVERLAYS_MSI_WIN32 must be set to the location of the
583
598
# TortoiseOverlays MSI installer file. It is in the TSVN svn repo and
584
599
# can be downloaded from (username=guest, blank password):
585
600
# http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.4/bin/TortoiseOverlays-1.0.4.11886-win32.msi
586
if not os.path.isfile(os.environ.get('TORTOISE_OVERLAYS_MSI_WIN32',
588
raise RuntimeError("Please set TORTOISE_OVERLAYS_MSI_WIN32 to the"
589
" location of the Win32 TortoiseOverlays .msi"
601
# Ditto for TORTOISE_OVERLAYS_MSI_X64, pointing at *-x64.msi.
602
for needed in ('TORTOISE_OVERLAYS_MSI_WIN32',
603
'TORTOISE_OVERLAYS_MSI_X64'):
604
if not os.path.isfile(os.environ.get(needed, '<nofile>')):
605
raise RuntimeError("Please set %s to the"
606
" location of the relevant TortoiseOverlays"
607
" .msi installer file" % needed)
591
608
get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
609
gui_targets, data_files)
594
611
# print this warning to stderr as output is redirected, so it is seen
595
612
# at build time. Also to stdout so it appears in the log
600
617
# MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
602
dll_excludes.append("MSWSOCK.dll")
619
dll_excludes.extend(["MSWSOCK.dll", "MSVCP60.dll", "powrprof.dll"])
603
620
options_list = {"py2exe": {"packages": packages + list(additional_packages),
604
621
"includes": includes,
605
622
"excludes": excludes,
614
631
windows=gui_targets,
615
632
com_server=com_targets,
616
633
zipfile='lib/library.zip',
617
data_files=topics_files + plugins_files,
634
data_files=data_files,
618
635
cmdclass={'install_data': install_data_with_bytecompile},