Show More
@@ -1,78 +1,80 | |||
|
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 | else: | |
|
38 | self.includes = self.includes.split(',') | |
|
37 | 39 | self.includes += mercurial.packagescan.getmodules(self.build_lib, |
|
38 | 40 | 'mercurial') |
|
39 | 41 | self.includes += mercurial.packagescan.getmodules(self.build_lib, |
|
40 | 42 | 'hgext') |
|
41 | 43 | build_exe.finalize_options(self) |
|
42 | 44 | except ImportError: |
|
43 | 45 | py2exe_for_demandload = None |
|
44 | 46 | |
|
45 | 47 | |
|
46 | 48 | # specify version string, otherwise 'hg identify' will be used: |
|
47 | 49 | version = '' |
|
48 | 50 | |
|
49 | 51 | class install_package_data(install_data): |
|
50 | 52 | def finalize_options(self): |
|
51 | 53 | self.set_undefined_options('install', |
|
52 | 54 | ('install_lib', 'install_dir')) |
|
53 | 55 | install_data.finalize_options(self) |
|
54 | 56 | |
|
55 | 57 | try: |
|
56 | 58 | mercurial.version.remember_version(version) |
|
57 | 59 | cmdclass = {'install_data': install_package_data} |
|
58 | 60 | if py2exe_for_demandload is not None: |
|
59 | 61 | cmdclass['py2exe'] = py2exe_for_demandload |
|
60 | 62 | setup(name='mercurial', |
|
61 | 63 | version=mercurial.version.get_version(), |
|
62 | 64 | author='Matt Mackall', |
|
63 | 65 | author_email='mpm@selenic.com', |
|
64 | 66 | url='http://selenic.com/mercurial', |
|
65 | 67 | description='scalable distributed SCM', |
|
66 | 68 | license='GNU GPL', |
|
67 | 69 | packages=['mercurial', 'hgext'], |
|
68 | 70 | ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']), |
|
69 | 71 | Extension('mercurial.bdiff', ['mercurial/bdiff.c'])], |
|
70 | 72 | data_files=[('mercurial/templates', |
|
71 | 73 | ['templates/map'] + |
|
72 | 74 | glob.glob('templates/map-*') + |
|
73 | 75 | glob.glob('templates/*.tmpl'))], |
|
74 | 76 | cmdclass=cmdclass, |
|
75 | 77 | scripts=['hg', 'hgmerge'], |
|
76 | 78 | console = ['hg']) |
|
77 | 79 | finally: |
|
78 | 80 | mercurial.version.forget_version() |
General Comments 0
You need to be logged in to leave comments.
Login now