setup.py
changeset 2346 925610b2d90a
parent 2324 7cbe8cd69d6b
child 2402 82cef38fea56
equal deleted inserted replaced
2345:4f7745fc9823 2346:925610b2d90a
    11 
    11 
    12 import glob
    12 import glob
    13 from distutils.core import setup, Extension
    13 from distutils.core import setup, Extension
    14 from distutils.command.install_data import install_data
    14 from distutils.command.install_data import install_data
    15 
    15 
       
    16 # mercurial.packagescan must be the first mercurial module imported
       
    17 import mercurial.packagescan
    16 import mercurial.version
    18 import mercurial.version
    17 
    19 
    18 # py2exe needs to be installed to work
    20 # py2exe needs to be installed to work
    19 try:
    21 try:
    20     import py2exe
    22     import py2exe
    34         pass
    36         pass
    35 
    37 
    36     # Due to the use of demandload py2exe is not finding the modules.
    38     # Due to the use of demandload py2exe is not finding the modules.
    37     # packagescan.getmodules creates a list of modules included in
    39     # packagescan.getmodules creates a list of modules included in
    38     # the mercurial package plus depdent modules.
    40     # the mercurial package plus depdent modules.
    39     import mercurial.packagescan
       
    40     from py2exe.build_exe import py2exe as build_exe
    41     from py2exe.build_exe import py2exe as build_exe
    41 
    42 
    42     class py2exe_for_demandload(build_exe):
    43     class py2exe_for_demandload(build_exe):
    43         """ overwrites the py2exe command class for getting the build
    44         """ overwrites the py2exe command class for getting the build
    44         directory and for setting the 'includes' option."""
    45         directory and for setting the 'includes' option."""
    52             # Sets the 'includes' option with the list of needed modules
    53             # Sets the 'includes' option with the list of needed modules
    53             if not self.includes:
    54             if not self.includes:
    54                 self.includes = []
    55                 self.includes = []
    55             else:
    56             else:
    56                 self.includes = self.includes.split(',')
    57                 self.includes = self.includes.split(',')
    57             self.includes += mercurial.packagescan.getmodules(self.build_lib,
    58             mercurial.packagescan.scan(self.build_lib,'mercurial')
    58                                                               'mercurial')
    59             mercurial.packagescan.scan(self.build_lib,'mercurial/hgweb')
    59             self.includes += mercurial.packagescan.getmodules(self.build_lib,
    60             mercurial.packagescan.scan(self.build_lib,'hgext')
    60                                                               'mercurial/hgweb')
    61             self.includes += mercurial.packagescan.getmodules()
    61             self.includes += mercurial.packagescan.getmodules(self.build_lib,
       
    62                                                               'hgext')
       
    63             build_exe.finalize_options(self)
    62             build_exe.finalize_options(self)
    64 except ImportError:
    63 except ImportError:
    65     py2exe_for_demandload = None
    64     py2exe_for_demandload = None
    66 
    65 
    67 
    66