~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Mark Hammond
  • Date: 2008-12-18 22:15:22 UTC
  • mto: (3932.1.1 prepare-1.11)
  • mto: This revision was merged to the branch mainline in revision 3937.
  • Revision ID: mhammond@skippinet.com.au-20081218221522-yizpnx890yywc2uk
remerge setup changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
288
288
 
289
289
 
290
290
def get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
291
 
                         gui_targets):
 
291
                         gui_targets, data_files):
292
292
    packages.append('tbzrcommands')
293
293
 
294
294
    # ModuleFinder can't handle runtime changes to __path__, but
340
340
    excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
341
341
                       win32ui crawler.Crawler""".split())
342
342
 
 
343
    # NOTE: We still create a DLL version of the Python implemented shell
 
344
    # extension for testing purposes - but it is *not* registered by
 
345
    # default - our C++ one is instead.  To discourage people thinking
 
346
    # this DLL is still necessary, its called 'tbzr_old.dll'
343
347
    tbzr = dict(
344
348
        modules=["tbzr"],
345
349
        create_exe = False, # we only want a .dll
 
350
        dest_base = 'tbzr_old',
346
351
    )
347
352
    com_targets.append(tbzr)
348
353
 
349
354
    # tbzrcache executables - a "console" version for debugging and a
350
355
    # GUI version that is generally used.
351
356
    tbzrcache = dict(
352
 
        script = os.path.join(tbzr_root, "Scripts", "tbzrcache.py"),
 
357
        script = os.path.join(tbzr_root, "scripts", "tbzrcache.py"),
353
358
        icon_resources = icon_resources,
354
359
        other_resources = other_resources,
355
360
    )
362
367
 
363
368
    # ditto for the tbzrcommand tool
364
369
    tbzrcommand = dict(
365
 
        script = os.path.join(tbzr_root, "Scripts", "tbzrcommand.py"),
 
370
        script = os.path.join(tbzr_root, "scripts", "tbzrcommand.py"),
366
371
        icon_resources = [(0,'bzr.ico')],
367
372
    )
368
373
    console_targets.append(tbzrcommand)
370
375
    tbzrcommandw["dest_base"]="tbzrcommandw"
371
376
    gui_targets.append(tbzrcommandw)
372
377
    
373
 
    # tbzr tests
374
 
    tbzrtest = dict(
375
 
        script = os.path.join(tbzr_root, "Scripts", "tbzrtest.py"),
376
 
    )
377
 
    console_targets.append(tbzrtest)
378
 
 
379
 
    # A utility to see python output from the shell extension - this will
380
 
    # die when we get a c++ extension
381
 
    # any .py file from pywin32's win32 lib will do (other than
382
 
    # win32traceutil itself that is)
383
 
    import winerror
384
 
    win32_lib_dir = os.path.dirname(winerror.__file__)
385
 
    tracer = dict(script = os.path.join(win32_lib_dir, "win32traceutil.py"),
386
 
                  dest_base="tbzr_tracer")
 
378
    # A utility to see python output from both C++ and Python based shell
 
379
    # extensions
 
380
    tracer = dict(script=os.path.join(tbzr_root, "scripts", "tbzrtrace.py"))
387
381
    console_targets.append(tracer)
388
382
 
 
383
    # The C++ implemented shell extensions.
 
384
    dist_dir = os.path.join(tbzr_root, "shellext", "cpp", "tbzrshellext",
 
385
                            "build", "dist")
 
386
    data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x86.dll')]))
 
387
    data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x64.dll')]))
 
388
 
389
389
 
390
390
def get_qbzr_py2exe_info(includes, excludes, packages):
391
391
    # PyQt4 itself still escapes the plugin detection code for some reason...
550
550
    for root, dirs, files in os.walk('bzrlib/plugins'):
551
551
        if root == 'bzrlib/plugins':
552
552
            plugins = set(dirs)
 
553
            # py2exe may find references to part of the plugin (eg, the tests)
 
554
            # so we tell py2exe to leave the plugins out of the .zip file
 
555
            excludes.extend(["bzrlib.plugins." + d for d in dirs])
553
556
        x = []
554
557
        for i in files:
555
558
            if os.path.splitext(i)[1] not in [".py", ".pyd", ".dll", ".mo"]:
573
576
                       ]
574
577
    gui_targets = []
575
578
    com_targets = []
 
579
    data_files = topics_files + plugins_files
576
580
 
577
581
    if 'qbzr' in plugins:
578
582
        get_qbzr_py2exe_info(includes, excludes, packages)
582
586
        # TortoiseOverlays MSI installer file. It is in the TSVN svn repo and
583
587
        # can be downloaded from (username=guest, blank password):
584
588
        # http://tortoisesvn.tigris.org/svn/tortoisesvn/TortoiseOverlays/version-1.0.4/bin/TortoiseOverlays-1.0.4.11886-win32.msi
585
 
        if not os.path.isfile(os.environ.get('TORTOISE_OVERLAYS_MSI_WIN32',
586
 
                                             '<nofile>')):
587
 
            raise RuntimeError("Please set TORTOISE_OVERLAYS_MSI_WIN32 to the"
588
 
                               " location of the Win32 TortoiseOverlays .msi"
589
 
                               " installer file")
 
589
        # Ditto for TORTOISE_OVERLAYS_MSI_X64, pointing at *-x64.msi.
 
590
        for needed in ('TORTOISE_OVERLAYS_MSI_WIN32',
 
591
                       'TORTOISE_OVERLAYS_MSI_X64'):
 
592
            if not os.path.isfile(os.environ.get(needed, '<nofile>')):
 
593
                raise RuntimeError("Please set %s to the"
 
594
                                   " location of the relevant TortoiseOverlays"
 
595
                                   " .msi installer file" % needed)
590
596
        get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
591
 
                             gui_targets)
 
597
                             gui_targets, data_files)
592
598
    else:
593
599
        # print this warning to stderr as output is redirected, so it is seen
594
600
        # at build time.  Also to stdout so it appears in the log
613
619
          windows=gui_targets,
614
620
          com_server=com_targets,
615
621
          zipfile='lib/library.zip',
616
 
          data_files=topics_files + plugins_files,
 
622
          data_files=data_files,
617
623
          cmdclass={'install_data': install_data_with_bytecompile},
618
624
          )
619
625