##// END OF EJS Templates
Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan -
r1284:59d07a6b default
parent child Browse files
Show More
@@ -1,72 +1,75
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # This is the mercurial setup script.
3 # This is the mercurial setup script.
4 #
4 #
5 # './setup.py install', or
5 # './setup.py install', or
6 # './setup.py --help' for more options
6 # './setup.py --help' for more options
7
7
8 import glob
8 import glob
9 from distutils.core import setup, Extension
9 from distutils.core import setup, Extension
10 from distutils.command.install_data import install_data
10 from distutils.command.install_data import install_data
11
11
12 import mercurial.version
12 import mercurial.version
13
13
14 # py2exe needs to be installed to work
14 # py2exe needs to be installed to work
15 try:
15 try:
16 import py2exe
16 import py2exe
17
17
18 # Due to the use of demandload py2exe is not finding the modules.
18 # Due to the use of demandload py2exe is not finding the modules.
19 # packagescan.getmodules creates a list of modules included in
19 # packagescan.getmodules creates a list of modules included in
20 # the mercurial package plus depdent modules.
20 # the mercurial package plus depdent modules.
21 import mercurial.packagescan
21 import mercurial.packagescan
22 from py2exe.build_exe import py2exe as build_exe
22 from py2exe.build_exe import py2exe as build_exe
23
23
24 class py2exe_for_demandload(build_exe):
24 class py2exe_for_demandload(build_exe):
25 """ overwrites the py2exe command class for getting the build
25 """ overwrites the py2exe command class for getting the build
26 directory and for setting the 'includes' option."""
26 directory and for setting the 'includes' option."""
27 def initialize_options(self):
27 def initialize_options(self):
28 self.build_lib = None
28 self.build_lib = None
29 build_exe.initialize_options(self)
29 build_exe.initialize_options(self)
30 def finalize_options(self):
30 def finalize_options(self):
31 # Get the build directory, ie. where to search for modules.
31 # Get the build directory, ie. where to search for modules.
32 self.set_undefined_options('build',
32 self.set_undefined_options('build',
33 ('build_lib', 'build_lib'))
33 ('build_lib', 'build_lib'))
34 # Sets the 'includes' option with the list of needed modules
34 # Sets the 'includes' option with the list of needed modules
35 if not self.includes:
35 if not self.includes:
36 self.includes = []
36 self.includes = []
37 self.includes += mercurial.packagescan.getmodules(self.build_lib,'mercurial')
37 self.includes += mercurial.packagescan.getmodules(self.build_lib,'mercurial')
38 build_exe.finalize_options(self)
38 build_exe.finalize_options(self)
39 except ImportError: pass
39 except ImportError:
40 py2exe_for_demandload = None
40
41
41
42
42 # specify version string, otherwise 'hg identify' will be used:
43 # specify version string, otherwise 'hg identify' will be used:
43 version = ''
44 version = ''
44
45
45 class install_package_data(install_data):
46 class install_package_data(install_data):
46 def finalize_options(self):
47 def finalize_options(self):
47 self.set_undefined_options('install',
48 self.set_undefined_options('install',
48 ('install_lib', 'install_dir'))
49 ('install_lib', 'install_dir'))
49 install_data.finalize_options(self)
50 install_data.finalize_options(self)
50
51
51 try:
52 try:
52 mercurial.version.remember_version(version)
53 mercurial.version.remember_version(version)
54 cmdclass = {'install_data': install_package_data}
55 if py2exe_for_demandload is not None:
56 cmdclass['py2exe'] = py2exe_for_demandload
53 setup(name='mercurial',
57 setup(name='mercurial',
54 version=mercurial.version.get_version(),
58 version=mercurial.version.get_version(),
55 author='Matt Mackall',
59 author='Matt Mackall',
56 author_email='mpm@selenic.com',
60 author_email='mpm@selenic.com',
57 url='http://selenic.com/mercurial',
61 url='http://selenic.com/mercurial',
58 description='scalable distributed SCM',
62 description='scalable distributed SCM',
59 license='GNU GPL',
63 license='GNU GPL',
60 packages=['mercurial'],
64 packages=['mercurial'],
61 ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
65 ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
62 Extension('mercurial.bdiff', ['mercurial/bdiff.c'])],
66 Extension('mercurial.bdiff', ['mercurial/bdiff.c'])],
63 data_files=[('mercurial/templates',
67 data_files=[('mercurial/templates',
64 ['templates/map'] +
68 ['templates/map'] +
65 glob.glob('templates/map-*') +
69 glob.glob('templates/map-*') +
66 glob.glob('templates/*.tmpl'))],
70 glob.glob('templates/*.tmpl'))],
67 cmdclass = { 'install_data' : install_package_data,
71 cmdclass=cmdclass,
68 'py2exe' : py2exe_for_demandload},
69 scripts=['hg', 'hgmerge'],
72 scripts=['hg', 'hgmerge'],
70 console = ['hg'])
73 console = ['hg'])
71 finally:
74 finally:
72 mercurial.version.forget_version()
75 mercurial.version.forget_version()
General Comments 0
You need to be logged in to leave comments. Login now