~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-07-26 11:51:29 UTC
  • mfrom: (5340.1.4 better_py2exe_optimize)
  • Revision ID: pqm@pqm.ubuntu.com-20100726115129-2uy7vwm0v2ergzk3
(garyvdm, gz) Hack py2exe so that we can have a library.zip built with
        optimize=2, but every thing else has optimize=1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
694
694
                               "optimize": 2,
695
695
                              },
696
696
                   }
 
697
 
 
698
    # We want the libaray.zip to have optimize = 2, but the exe to have
 
699
    # optimize = 1, so that .py files that get compilied at run time
 
700
    # (e.g. user installed plugins) dont have their doc strings removed.
 
701
    class py2exe_no_oo_exe(py2exe.build_exe.py2exe):
 
702
        def build_executable(self, *args, **kwargs):
 
703
            self.optimize = 1
 
704
            py2exe.build_exe.py2exe.build_executable(self, *args, **kwargs)
 
705
            self.optimize = 2
 
706
 
697
707
    if __name__ == '__main__':
698
708
        setup(options=options_list,
699
709
              console=console_targets,
700
710
              windows=gui_targets,
701
711
              zipfile='lib/library.zip',
702
712
              data_files=data_files,
703
 
              cmdclass={'install_data': install_data_with_bytecompile},
 
713
              cmdclass={'install_data': install_data_with_bytecompile,
 
714
                        'py2exe': py2exe_no_oo_exe},
704
715
              )
705
716
 
706
717
else: