author | Matt Mackall <mpm@selenic.com> |
Thu, 14 Dec 2006 17:32:00 -0600 | |
changeset 3888 | 660504812daf |
parent 3887 | 57b797601b61 |
child 3890 | 2eec996f2fb9 |
permissions | -rw-r--r-- |
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 |
3590
231e61de692c
Check for at least having a final release of python 2.3.0 in setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3283
diff
changeset
|
9 |
if not hasattr(sys, 'version_info') or sys.version_info < (2, 3, 0, 'final'): |
1873
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 |
|
3239
7a3edd3f7c3e
Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3238
diff
changeset
|
12 |
import os |
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 |
|
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
16 |
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
|
17 |
|
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
18 |
# py2exe needs to be installed to work |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
19 |
try: |
1294
372971e1c40d
Clean up whitespace damage.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1284
diff
changeset
|
20 |
import py2exe |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
21 |
|
1422
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
22 |
# 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
|
23 |
try: |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
24 |
import modulefinder |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
25 |
import win32com |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
26 |
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
|
27 |
modulefinder.AddPackagePath("win32com", p) |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
28 |
pn = "win32com.shell" |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
29 |
__import__(pn) |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
30 |
m = sys.modules[pn] |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
31 |
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
|
32 |
modulefinder.AddPackagePath(pn, p) |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
33 |
except ImportError: |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
34 |
pass |
a7e8408ac79c
py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents:
1421
diff
changeset
|
35 |
|
1284
59d07a6bd513
Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1283
diff
changeset
|
36 |
except ImportError: |
59d07a6bd513
Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1283
diff
changeset
|
37 |
py2exe_for_demandload = None |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
38 |
|
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
39 |
|
427
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
40 |
# 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
|
41 |
version = '' |
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
42 |
|
157
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
43 |
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
|
44 |
def finalize_options(self): |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
45 |
self.set_undefined_options('install', |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
46 |
('install_lib', 'install_dir')) |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
47 |
install_data.finalize_options(self) |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
48 |
|
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
py2exe_opts['console'] = ['hg'] |
3238
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
55 |
|
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
|
56 |
setup(name='mercurial', |
3238
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
57 |
version=mercurial.version.get_version(), |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
58 |
author='Matt Mackall', |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
59 |
author_email='mpm@selenic.com', |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
60 |
url='http://selenic.com/mercurial', |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
61 |
description='Scalable distributed SCM', |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
62 |
license='GNU GPL', |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
63 |
packages=['mercurial', 'mercurial.hgweb', 'hgext'], |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
64 |
ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']), |
3283 | 65 |
Extension('mercurial.bdiff', ['mercurial/bdiff.c']), |
66 |
Extension('mercurial.base85', ['mercurial/base85.c'])], |
|
3239
7a3edd3f7c3e
Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3238
diff
changeset
|
67 |
data_files=[(os.path.join('mercurial', root), |
7a3edd3f7c3e
Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3238
diff
changeset
|
68 |
[os.path.join(root, file_) for file_ in files]) |
7a3edd3f7c3e
Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3238
diff
changeset
|
69 |
for root, dirs, files in os.walk('templates')], |
3238
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
70 |
cmdclass=cmdclass, |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
71 |
scripts=['hg', 'hgmerge'], |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
72 |
options=dict(bdist_mpkg=dict(zipdist=True, |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
73 |
license='COPYING', |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
74 |
readme='contrib/macosx/Readme.html', |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
75 |
welcome='contrib/macosx/Welcome.html')), |
3dba9ec89164
Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2402
diff
changeset
|
76 |
**py2exe_opts) |