##// END OF EJS Templates
Applied coding style to setup.py
Thomas Arendsen Hein -
r3238:3dba9ec8 default
parent child Browse files
Show More
@@ -1,104 +1,106
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 sys
9 9 if not hasattr(sys, 'version_info') or sys.version_info < (2, 3):
10 10 raise SystemExit, "Mercurial requires python 2.3 or later."
11 11
12 12 import glob
13 13 from distutils.core import setup, Extension
14 14 from distutils.command.install_data import install_data
15 15
16 16 # mercurial.packagescan must be the first mercurial module imported
17 17 import mercurial.packagescan
18 18 import mercurial.version
19 19
20 20 # py2exe needs to be installed to work
21 21 try:
22 22 import py2exe
23 23
24 24 # Help py2exe to find win32com.shell
25 25 try:
26 26 import modulefinder
27 27 import win32com
28 28 for p in win32com.__path__[1:]: # Take the path to win32comext
29 29 modulefinder.AddPackagePath("win32com", p)
30 30 pn = "win32com.shell"
31 31 __import__(pn)
32 32 m = sys.modules[pn]
33 33 for p in m.__path__[1:]:
34 34 modulefinder.AddPackagePath(pn, p)
35 35 except ImportError:
36 36 pass
37 37
38 38 # Due to the use of demandload py2exe is not finding the modules.
39 39 # packagescan.getmodules creates a list of modules included in
40 40 # the mercurial package plus depdent modules.
41 41 from py2exe.build_exe import py2exe as build_exe
42 42
43 43 class py2exe_for_demandload(build_exe):
44 44 """ overwrites the py2exe command class for getting the build
45 45 directory and for setting the 'includes' option."""
46 46 def initialize_options(self):
47 47 self.build_lib = None
48 48 build_exe.initialize_options(self)
49 49 def finalize_options(self):
50 50 # Get the build directory, ie. where to search for modules.
51 51 self.set_undefined_options('build',
52 52 ('build_lib', 'build_lib'))
53 53 # Sets the 'includes' option with the list of needed modules
54 54 if not self.includes:
55 55 self.includes = []
56 56 else:
57 57 self.includes = self.includes.split(',')
58 mercurial.packagescan.scan(self.build_lib,'mercurial')
59 mercurial.packagescan.scan(self.build_lib,'mercurial.hgweb')
60 mercurial.packagescan.scan(self.build_lib,'hgext')
58 mercurial.packagescan.scan(self.build_lib, 'mercurial')
59 mercurial.packagescan.scan(self.build_lib, 'mercurial.hgweb')
60 mercurial.packagescan.scan(self.build_lib, 'hgext')
61 61 self.includes += mercurial.packagescan.getmodules()
62 62 build_exe.finalize_options(self)
63 63 except ImportError:
64 64 py2exe_for_demandload = None
65 65
66 66
67 67 # specify version string, otherwise 'hg identify' will be used:
68 68 version = ''
69 69
70 70 class install_package_data(install_data):
71 71 def finalize_options(self):
72 72 self.set_undefined_options('install',
73 73 ('install_lib', 'install_dir'))
74 74 install_data.finalize_options(self)
75 75
76 76 mercurial.version.remember_version(version)
77 77 cmdclass = {'install_data': install_package_data}
78 78 py2exe_opts = {}
79 79 if py2exe_for_demandload is not None:
80 80 cmdclass['py2exe'] = py2exe_for_demandload
81 81 py2exe_opts['console'] = ['hg']
82
82 83 setup(name='mercurial',
83 version=mercurial.version.get_version(),
84 author='Matt Mackall',
85 author_email='mpm@selenic.com',
86 url='http://selenic.com/mercurial',
87 description='Scalable distributed SCM',
88 license='GNU GPL',
89 packages=['mercurial', 'mercurial.hgweb', 'hgext'],
90 ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
91 Extension('mercurial.bdiff', ['mercurial/bdiff.c'])],
92 data_files=[('mercurial/templates',
93 ['templates/map'] +
94 glob.glob('templates/map-*') +
95 glob.glob('templates/*.tmpl')),
96 ('mercurial/templates/static',
97 glob.glob('templates/static/*'))],
98 cmdclass=cmdclass,
99 scripts=['hg', 'hgmerge'],
100 options=dict(bdist_mpkg=dict(zipdist=True,
101 license='COPYING',
102 readme='contrib/macosx/Readme.html',
103 welcome='contrib/macosx/Welcome.html')),
104 **py2exe_opts)
84 version=mercurial.version.get_version(),
85 author='Matt Mackall',
86 author_email='mpm@selenic.com',
87 url='http://selenic.com/mercurial',
88 description='Scalable distributed SCM',
89 license='GNU GPL',
90 packages=['mercurial', 'mercurial.hgweb', 'hgext'],
91 ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
92 Extension('mercurial.bdiff', ['mercurial/bdiff.c'])],
93 data_files=[
94 ('mercurial/templates',
95 ['templates/map'] +
96 glob.glob('templates/map-*') +
97 glob.glob('templates/*.tmpl')),
98 ('mercurial/templates/static', glob.glob('templates/static/*')),
99 ],
100 cmdclass=cmdclass,
101 scripts=['hg', 'hgmerge'],
102 options=dict(bdist_mpkg=dict(zipdist=True,
103 license='COPYING',
104 readme='contrib/macosx/Readme.html',
105 welcome='contrib/macosx/Welcome.html')),
106 **py2exe_opts)
General Comments 0
You need to be logged in to leave comments. Login now