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