author | Volker.Kleinfeld@gmx.de |
Tue, 20 Sep 2005 19:25:14 -0700 | |
changeset 1283 | f5faab34f32e |
parent 575 | 7f5ce4bbdd7b |
child 1284 | 59d07a6bd513 |
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 |
|
157
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
8 |
import glob |
72 | 9 |
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
|
10 |
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
|
11 |
|
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
12 |
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
|
13 |
|
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
14 |
# py2exe needs to be installed to work |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
15 |
try: |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
16 |
import py2exe |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
17 |
|
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
18 |
# Due to the use of demandload py2exe is not finding the modules. |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
19 |
# packagescan.getmodules creates a list of modules included in |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
20 |
# the mercurial package plus depdent modules. |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
21 |
import mercurial.packagescan |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
22 |
from py2exe.build_exe import py2exe as build_exe |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
23 |
|
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
24 |
class py2exe_for_demandload(build_exe): |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
25 |
""" 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
|
26 |
directory and for setting the 'includes' option.""" |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
27 |
def initialize_options(self): |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
28 |
self.build_lib = None |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
29 |
build_exe.initialize_options(self) |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
30 |
def finalize_options(self): |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
31 |
# 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
|
32 |
self.set_undefined_options('build', |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
33 |
('build_lib', 'build_lib')) |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
34 |
# 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
|
35 |
if not self.includes: |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
36 |
self.includes = [] |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
37 |
self.includes += mercurial.packagescan.getmodules(self.build_lib,'mercurial') |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
38 |
build_exe.finalize_options(self) |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
39 |
except ImportError: pass |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
40 |
|
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
41 |
|
427
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
42 |
# 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
|
43 |
version = '' |
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
44 |
|
157
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
45 |
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
|
46 |
def finalize_options(self): |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
47 |
self.set_undefined_options('install', |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
48 |
('install_lib', 'install_dir')) |
2653740d8118
Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents:
155
diff
changeset
|
49 |
install_data.finalize_options(self) |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
50 |
|
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
51 |
try: |
427
36e644d28edf
Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
423
diff
changeset
|
52 |
mercurial.version.remember_version(version) |
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
53 |
setup(name='mercurial', |
429 | 54 |
version=mercurial.version.get_version(), |
55 |
author='Matt Mackall', |
|
56 |
author_email='mpm@selenic.com', |
|
57 |
url='http://selenic.com/mercurial', |
|
58 |
description='scalable distributed SCM', |
|
59 |
license='GNU GPL', |
|
60 |
packages=['mercurial'], |
|
61 |
ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']), |
|
62 |
Extension('mercurial.bdiff', ['mercurial/bdiff.c'])], |
|
63 |
data_files=[('mercurial/templates', |
|
64 |
['templates/map'] + |
|
65 |
glob.glob('templates/map-*') + |
|
575 | 66 |
glob.glob('templates/*.tmpl'))], |
1283
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
67 |
cmdclass = { 'install_data' : install_package_data, |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
68 |
'py2exe' : py2exe_for_demandload}, |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
69 |
scripts=['hg', 'hgmerge'], |
f5faab34f32e
Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents:
575
diff
changeset
|
70 |
console = ['hg']) |
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
71 |
finally: |
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
241
diff
changeset
|
72 |
mercurial.version.forget_version() |