comparison setup.py @ 2323:c58a403aa830

setup.py: install packagescan before any mercurial modules is imported Further the installation of packagescan over demandload is moved to the packagescan module. I added as well few more comments in the packagescan module to avoid the wrong use of package scan in the future. Reason: mercurial.packagescan acts as fake mercurial.demandload during a py2exe run. Unfortunatly the import of mercurial.version in setup.py is done before mercurial.packagescan is installed. This results in few imports without mercurial.packagescan in charge and therefore not all dependend modules are detected when running mercurial.packagescan.getmodules later e.g. winerror is missed.
author Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
date Fri, 19 May 2006 08:54:28 -0700
parents 7eb694a1c1af
children 7cbe8cd69d6b
comparison
equal deleted inserted replaced
2298:4be9a79b49b1 2323:c58a403aa830
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,'hgext')
59 self.includes += mercurial.packagescan.getmodules(self.build_lib, 60 self.includes += mercurial.packagescan.getmodules()
60 'hgext')
61 build_exe.finalize_options(self) 61 build_exe.finalize_options(self)
62 except ImportError: 62 except ImportError:
63 py2exe_for_demandload = None 63 py2exe_for_demandload = None
64 64
65 65