~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Robert Collins
  • Date: 2010-06-26 01:07:16 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100626010716-jowzrldm4ntsaki2
Make bzrlib startup use a trace context manager.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import os
10
10
import os.path
11
11
import sys
12
 
import copy
13
12
 
14
13
if sys.version_info < (2, 4):
15
14
    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.4+\n")
414
413
 
415
414
def get_qbzr_py2exe_info(includes, excludes, packages, data_files):
416
415
    # PyQt4 itself still escapes the plugin detection code for some reason...
417
 
    includes.append('PyQt4.QtCore')
418
 
    includes.append('PyQt4.QtGui')
 
416
    packages.append('PyQt4')
 
417
    excludes.append('PyQt4.elementtree.ElementTree')
 
418
    excludes.append('PyQt4.uic.port_v3')
419
419
    includes.append('sip') # extension module required for Qt.
420
420
    packages.append('pygments') # colorizer for qbzr
421
421
    packages.append('docutils') # html formatting
422
422
    includes.append('win32event')  # for qsubprocess stuff
 
423
    # but we can avoid many Qt4 Dlls.
 
424
    dll_excludes.extend(
 
425
        """QtAssistantClient4.dll QtCLucene4.dll QtDesigner4.dll
 
426
        QtHelp4.dll QtNetwork4.dll QtOpenGL4.dll QtScript4.dll
 
427
        QtSql4.dll QtTest4.dll QtWebKit4.dll QtXml4.dll
 
428
        qscintilla2.dll""".split())
423
429
    # the qt binaries might not be on PATH...
424
430
    # They seem to install to a place like C:\Python25\PyQt4\*
425
431
    # Which is not the same as C:\Python25\Lib\site-packages\PyQt4
532
538
            #                time before living with docstring stripping
533
539
            optimize = 1
534
540
            compile_names = [f for f in self.outfiles if f.endswith('.py')]
535
 
            # Round mtime to nearest even second so that installing on a FAT
536
 
            # filesystem bytecode internal and script timestamps will match
537
 
            for f in compile_names:
538
 
                mtime = os.stat(f).st_mtime
539
 
                remainder = mtime % 2
540
 
                if remainder:
541
 
                    mtime -= remainder
542
 
                    os.utime(f, (mtime, mtime))
543
541
            byte_compile(compile_names,
544
542
                         optimize=optimize,
545
543
                         force=self.force, prefix=self.install_dir,
558
556
                                     company_name = "Canonical Ltd.",
559
557
                                     comments = META_INFO['description'],
560
558
                                    )
561
 
    gui_target = copy.copy(target)
562
 
    gui_target.dest_base = "bzrw"
563
559
 
564
560
    packages = BZRLIB['packages']
565
561
    packages.remove('bzrlib')
650
646
    console_targets = [target,
651
647
                       'tools/win32/bzr_postinstall.py',
652
648
                       ]
653
 
    gui_targets = [gui_target]
 
649
    gui_targets = []
654
650
    data_files = topics_files + plugins_files
655
651
 
656
652
    if 'qbzr' in plugins:
695
691
                               "dll_excludes": dll_excludes,
696
692
                               "dist_dir": "win32_bzr.exe",
697
693
                               "optimize": 2,
698
 
                               "custom_boot_script":
699
 
                                        "tools/win32/py2exe_boot_common.py",
700
694
                              },
701
695
                   }
702
 
 
703
 
    # We want the libaray.zip to have optimize = 2, but the exe to have
704
 
    # optimize = 1, so that .py files that get compilied at run time
705
 
    # (e.g. user installed plugins) dont have their doc strings removed.
706
 
    class py2exe_no_oo_exe(py2exe.build_exe.py2exe):
707
 
        def build_executable(self, *args, **kwargs):
708
 
            self.optimize = 1
709
 
            py2exe.build_exe.py2exe.build_executable(self, *args, **kwargs)
710
 
            self.optimize = 2
711
 
 
712
696
    if __name__ == '__main__':
713
697
        setup(options=options_list,
714
698
              console=console_targets,
715
699
              windows=gui_targets,
716
700
              zipfile='lib/library.zip',
717
701
              data_files=data_files,
718
 
              cmdclass={'install_data': install_data_with_bytecompile,
719
 
                        'py2exe': py2exe_no_oo_exe},
 
702
              cmdclass={'install_data': install_data_with_bytecompile},
720
703
              )
721
704
 
722
705
else: