Mercurial > hg-stable
annotate setup.py @ 2324:7cbe8cd69d6b
merge with crew.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 19 May 2006 08:57:12 -0700 |
parents | c58a403aa830 b832b6eb65ab |
children | 82cef38fea56 |
rev | line source |
---|---|
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
1 #!/usr/bin/env python |
575 | 2 # |
3 # This is the mercurial setup script. | |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
4 # |
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
5 # './setup.py install', or |
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
6 # './setup.py --help' for more options |
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
7 |
1873
205f04b04ec6
Added check for minimal python version to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1777
diff
changeset
|
8 import sys |
205f04b04ec6
Added check for minimal python version to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1777
diff
changeset
|
9 if not hasattr(sys, 'version_info') or sys.version_info < (2, 3): |
205f04b04ec6
Added check for minimal python version to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1777
diff
changeset
|
10 raise SystemExit, "Mercurial requires python 2.3 or later." |
205f04b04ec6
Added check for minimal python version to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1777
diff
changeset
|
11 |
157
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
12 import glob |
72 | 13 from distutils.core import setup, Extension |
157
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
14 from distutils.command.install_data import install_data |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
15 |
2323
c58a403aa830
setup.py: install packagescan before any mercurial modules is imported
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1977
diff
changeset
|
16 # mercurial.packagescan must be the first mercurial module imported |
c58a403aa830
setup.py: install packagescan before any mercurial modules is imported
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1977
diff
changeset
|
17 import mercurial.packagescan |
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
18 import mercurial.version |
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
19 |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
20 # py2exe needs to be installed to work |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
21 try: |
1294
372971e1c40d
Clean up whitespace damage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1284
diff
changeset
|
22 import py2exe |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
23 |
1422
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
24 # Help py2exe to find win32com.shell |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
25 try: |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
26 import modulefinder |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
27 import win32com |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
28 for p in win32com.__path__[1:]: # Take the path to win32comext |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
29 modulefinder.AddPackagePath("win32com", p) |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
30 pn = "win32com.shell" |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
31 __import__(pn) |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
32 m = sys.modules[pn] |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
33 for p in m.__path__[1:]: |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
34 modulefinder.AddPackagePath(pn, p) |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
35 except ImportError: |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
36 pass |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
37 |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
38 # Due to the use of demandload py2exe is not finding the modules. |
1294
372971e1c40d
Clean up whitespace damage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1284
diff
changeset
|
39 # packagescan.getmodules creates a list of modules included in |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
40 # the mercurial package plus depdent modules. |
1294
372971e1c40d
Clean up whitespace damage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1284
diff
changeset
|
41 from py2exe.build_exe import py2exe as build_exe |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
42 |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
43 class py2exe_for_demandload(build_exe): |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
44 """ overwrites the py2exe command class for getting the build |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
45 directory and for setting the 'includes' option.""" |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
46 def initialize_options(self): |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
47 self.build_lib = None |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
48 build_exe.initialize_options(self) |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
49 def finalize_options(self): |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
50 # Get the build directory, ie. where to search for modules. |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
51 self.set_undefined_options('build', |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
52 ('build_lib', 'build_lib')) |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
53 # Sets the 'includes' option with the list of needed modules |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
54 if not self.includes: |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
55 self.includes = [] |
1421
a7631cf1326a
Option -i broken in py2exe_for_demandload
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1301
diff
changeset
|
56 else: |
a7631cf1326a
Option -i broken in py2exe_for_demandload
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1301
diff
changeset
|
57 self.includes = self.includes.split(',') |
2323
c58a403aa830
setup.py: install packagescan before any mercurial modules is imported
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1977
diff
changeset
|
58 mercurial.packagescan.scan(self.build_lib,'mercurial') |
2324 | 59 mercurial.packagescan.scan(self.build_lib,'mercurial/hgweb') |
2323
c58a403aa830
setup.py: install packagescan before any mercurial modules is imported
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1977
diff
changeset
|
60 mercurial.packagescan.scan(self.build_lib,'hgext') |
c58a403aa830
setup.py: install packagescan before any mercurial modules is imported
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1977
diff
changeset
|
61 self.includes += mercurial.packagescan.getmodules() |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
62 build_exe.finalize_options(self) |
1284
59d07a6bd513
Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1283
diff
changeset
|
63 except ImportError: |
59d07a6bd513
Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1283
diff
changeset
|
64 py2exe_for_demandload = None |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
65 |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
66 |
427
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
67 # specify version string, otherwise 'hg identify' will be used: |
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
68 version = '' |
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
69 |
157
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
70 class install_package_data(install_data): |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
71 def finalize_options(self): |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
72 self.set_undefined_options('install', |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
73 ('install_lib', 'install_dir')) |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
74 install_data.finalize_options(self) |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
75 |
1977
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
76 mercurial.version.remember_version(version) |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
77 cmdclass = {'install_data': install_package_data} |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
78 py2exe_opts = {} |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
79 if py2exe_for_demandload is not None: |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
80 cmdclass['py2exe'] = py2exe_for_demandload |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
81 py2exe_opts['console'] = ['hg'] |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
82 setup(name='mercurial', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
83 version=mercurial.version.get_version(), |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
84 author='Matt Mackall', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
85 author_email='mpm@selenic.com', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
86 url='http://selenic.com/mercurial', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
87 description='Scalable distributed SCM', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
88 license='GNU GPL', |
2311
b832b6eb65ab
Moving hgweb.py into it's own module in preparation for breaking it up.
Eric Hopper <hopper@omnifarious.org>
parents:
1977
diff
changeset
|
89 packages=['mercurial', 'mercurial.hgweb', 'hgext'], |
1977
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
90 ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']), |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
91 Extension('mercurial.bdiff', ['mercurial/bdiff.c'])], |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
92 data_files=[('mercurial/templates', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
93 ['templates/map'] + |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
94 glob.glob('templates/map-*') + |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
95 glob.glob('templates/*.tmpl')), |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
96 ('mercurial/templates/static', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
97 glob.glob('templates/static/*'))], |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
98 cmdclass=cmdclass, |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
99 scripts=['hg', 'hgmerge'], |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
100 options=dict(bdist_mpkg=dict(zipdist=True, |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
101 license='COPYING', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
102 readme='contrib/macosx/Readme.html', |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
103 welcome='contrib/macosx/Welcome.html')), |
7eb694a1c1af
Don't forget version at the end of setup.py, write it only if changed.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1873
diff
changeset
|
104 **py2exe_opts) |