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