Show More
@@ -1,87 +1,91 | |||||
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 | # 'python setup.py install', or |
|
5 | # 'python setup.py install', or | |
6 | # 'python setup.py --help' for more options |
|
6 | # 'python setup.py --help' for more options | |
7 |
|
7 | |||
8 | import sys |
|
8 | import sys | |
9 | if not hasattr(sys, 'version_info') or sys.version_info < (2, 3, 0, 'final'): |
|
9 | if not hasattr(sys, 'version_info') or sys.version_info < (2, 3, 0, 'final'): | |
10 | raise SystemExit, "Mercurial requires python 2.3 or later." |
|
10 | raise SystemExit, "Mercurial requires python 2.3 or later." | |
11 |
|
11 | |||
12 | import os |
|
12 | import os | |
13 | from distutils.core import setup, Extension |
|
13 | from distutils.core import setup, Extension | |
14 | from distutils.command.install_data import install_data |
|
14 | from distutils.command.install_data import install_data | |
15 |
|
15 | |||
16 | import mercurial.version |
|
16 | import mercurial.version | |
17 |
|
17 | |||
18 | extra = {} |
|
18 | extra = {} | |
19 |
|
19 | |||
20 | # py2exe needs to be installed to work |
|
20 | # py2exe needs to be installed to work | |
21 | try: |
|
21 | try: | |
22 | import py2exe |
|
22 | import py2exe | |
23 |
|
23 | |||
24 | # Help py2exe to find win32com.shell |
|
24 | # Help py2exe to find win32com.shell | |
25 | try: |
|
25 | try: | |
26 | import modulefinder |
|
26 | import modulefinder | |
27 | import win32com |
|
27 | import win32com | |
28 | for p in win32com.__path__[1:]: # Take the path to win32comext |
|
28 | for p in win32com.__path__[1:]: # Take the path to win32comext | |
29 | modulefinder.AddPackagePath("win32com", p) |
|
29 | modulefinder.AddPackagePath("win32com", p) | |
30 | pn = "win32com.shell" |
|
30 | pn = "win32com.shell" | |
31 | __import__(pn) |
|
31 | __import__(pn) | |
32 | m = sys.modules[pn] |
|
32 | m = sys.modules[pn] | |
33 | for p in m.__path__[1:]: |
|
33 | for p in m.__path__[1:]: | |
34 | modulefinder.AddPackagePath(pn, p) |
|
34 | modulefinder.AddPackagePath(pn, p) | |
35 | except ImportError: |
|
35 | except ImportError: | |
36 | pass |
|
36 | pass | |
37 |
|
37 | |||
38 | extra['console'] = ['hg'] |
|
38 | extra['console'] = ['hg'] | |
39 |
|
39 | |||
40 | except ImportError: |
|
40 | except ImportError: | |
41 | pass |
|
41 | pass | |
42 |
|
42 | |||
|
43 | if os.name in ['nt']: | |||
|
44 | extra['scripts'] = ['hg'] | |||
|
45 | else: | |||
|
46 | extra['scripts'] = ['hg', 'hgmerge'] | |||
|
47 | ||||
43 | # specify version string, otherwise 'hg identify' will be used: |
|
48 | # specify version string, otherwise 'hg identify' will be used: | |
44 | version = '' |
|
49 | version = '' | |
45 |
|
50 | |||
46 | class install_package_data(install_data): |
|
51 | class install_package_data(install_data): | |
47 | def finalize_options(self): |
|
52 | def finalize_options(self): | |
48 | self.set_undefined_options('install', |
|
53 | self.set_undefined_options('install', | |
49 | ('install_lib', 'install_dir')) |
|
54 | ('install_lib', 'install_dir')) | |
50 | install_data.finalize_options(self) |
|
55 | install_data.finalize_options(self) | |
51 |
|
56 | |||
52 | mercurial.version.remember_version(version) |
|
57 | mercurial.version.remember_version(version) | |
53 | cmdclass = {'install_data': install_package_data} |
|
58 | cmdclass = {'install_data': install_package_data} | |
54 |
|
59 | |||
55 | ext_modules=[ |
|
60 | ext_modules=[ | |
56 | Extension('mercurial.mpatch', ['mercurial/mpatch.c']), |
|
61 | Extension('mercurial.mpatch', ['mercurial/mpatch.c']), | |
57 | Extension('mercurial.bdiff', ['mercurial/bdiff.c']), |
|
62 | Extension('mercurial.bdiff', ['mercurial/bdiff.c']), | |
58 | Extension('mercurial.base85', ['mercurial/base85.c']), |
|
63 | Extension('mercurial.base85', ['mercurial/base85.c']), | |
59 | Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']) |
|
64 | Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']) | |
60 | ] |
|
65 | ] | |
61 |
|
66 | |||
62 | try: |
|
67 | try: | |
63 | import posix |
|
68 | import posix | |
64 | ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) |
|
69 | ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) | |
65 | except ImportError: |
|
70 | except ImportError: | |
66 | pass |
|
71 | pass | |
67 |
|
72 | |||
68 | setup(name='mercurial', |
|
73 | setup(name='mercurial', | |
69 | version=mercurial.version.get_version(), |
|
74 | version=mercurial.version.get_version(), | |
70 | author='Matt Mackall', |
|
75 | author='Matt Mackall', | |
71 | author_email='mpm@selenic.com', |
|
76 | author_email='mpm@selenic.com', | |
72 | url='http://selenic.com/mercurial', |
|
77 | url='http://selenic.com/mercurial', | |
73 | description='Scalable distributed SCM', |
|
78 | description='Scalable distributed SCM', | |
74 | license='GNU GPL', |
|
79 | license='GNU GPL', | |
75 | packages=['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert'], |
|
80 | packages=['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert'], | |
76 | ext_modules=ext_modules, |
|
81 | ext_modules=ext_modules, | |
77 | data_files=[(os.path.join('mercurial', root), |
|
82 | data_files=[(os.path.join('mercurial', root), | |
78 | [os.path.join(root, file_) for file_ in files]) |
|
83 | [os.path.join(root, file_) for file_ in files]) | |
79 | for root, dirs, files in os.walk('templates')], |
|
84 | for root, dirs, files in os.walk('templates')], | |
80 | cmdclass=cmdclass, |
|
85 | cmdclass=cmdclass, | |
81 | scripts=['hg', 'hgmerge'], |
|
|||
82 | options=dict(py2exe=dict(packages=['hgext']), |
|
86 | options=dict(py2exe=dict(packages=['hgext']), | |
83 | bdist_mpkg=dict(zipdist=True, |
|
87 | bdist_mpkg=dict(zipdist=True, | |
84 | license='COPYING', |
|
88 | license='COPYING', | |
85 | readme='contrib/macosx/Readme.html', |
|
89 | readme='contrib/macosx/Readme.html', | |
86 | welcome='contrib/macosx/Welcome.html')), |
|
90 | welcome='contrib/macosx/Welcome.html')), | |
87 | **extra) |
|
91 | **extra) |
General Comments 0
You need to be logged in to leave comments.
Login now