setup.py
78 lines
| 2.5 KiB
| text/x-python
|
PythonLexer
mpm@selenic.com
|
r0 | #!/usr/bin/env python | ||
mpm@selenic.com
|
r575 | # | ||
# This is the mercurial setup script. | ||||
mpm@selenic.com
|
r0 | # | ||
# './setup.py install', or | ||||
# './setup.py --help' for more options | ||||
Thomas Arendsen Hein
|
r1873 | import sys | ||
Thomas Arendsen Hein
|
r3590 | if not hasattr(sys, 'version_info') or sys.version_info < (2, 3, 0, 'final'): | ||
Thomas Arendsen Hein
|
r1873 | raise SystemExit, "Mercurial requires python 2.3 or later." | ||
Thomas Arendsen Hein
|
r3239 | import os | ||
mpm@selenic.com
|
r72 | from distutils.core import setup, Extension | ||
mpm@selenic.com
|
r157 | from distutils.command.install_data import install_data | ||
Thomas Arendsen Hein
|
r423 | import mercurial.version | ||
Matt Mackall
|
r3892 | import mercurial.demandimport | ||
mercurial.demandimport.enable = lambda: None | ||||
Thomas Arendsen Hein
|
r423 | |||
Matt Mackall
|
r3893 | extra = {} | ||
Volker.Kleinfeld@gmx.de
|
r1283 | # py2exe needs to be installed to work | ||
try: | ||||
Bryan O'Sullivan
|
r1294 | import py2exe | ||
Volker.Kleinfeld@gmx.de
|
r1283 | |||
Volker Kleinfeld
|
r1422 | # Help py2exe to find win32com.shell | ||
try: | ||||
import modulefinder | ||||
import win32com | ||||
for p in win32com.__path__[1:]: # Take the path to win32comext | ||||
modulefinder.AddPackagePath("win32com", p) | ||||
pn = "win32com.shell" | ||||
__import__(pn) | ||||
m = sys.modules[pn] | ||||
for p in m.__path__[1:]: | ||||
modulefinder.AddPackagePath(pn, p) | ||||
except ImportError: | ||||
pass | ||||
Matt Mackall
|
r3893 | extra['console'] = ['hg'] | ||
Bryan O'Sullivan
|
r1284 | except ImportError: | ||
Matt Mackall
|
r3890 | pass | ||
Volker.Kleinfeld@gmx.de
|
r1283 | |||
Thomas Arendsen Hein
|
r427 | # specify version string, otherwise 'hg identify' will be used: | ||
version = '' | ||||
mpm@selenic.com
|
r157 | class install_package_data(install_data): | ||
def finalize_options(self): | ||||
self.set_undefined_options('install', | ||||
('install_lib', 'install_dir')) | ||||
install_data.finalize_options(self) | ||||
mpm@selenic.com
|
r0 | |||
Thomas Arendsen Hein
|
r1977 | mercurial.version.remember_version(version) | ||
cmdclass = {'install_data': install_package_data} | ||||
Thomas Arendsen Hein
|
r3238 | |||
Thomas Arendsen Hein
|
r1977 | setup(name='mercurial', | ||
Thomas Arendsen Hein
|
r3238 | version=mercurial.version.get_version(), | ||
author='Matt Mackall', | ||||
author_email='mpm@selenic.com', | ||||
url='http://selenic.com/mercurial', | ||||
description='Scalable distributed SCM', | ||||
license='GNU GPL', | ||||
Thomas Arendsen Hein
|
r4519 | packages=['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert'], | ||
Thomas Arendsen Hein
|
r3238 | ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']), | ||
Brendan Cully
|
r3283 | Extension('mercurial.bdiff', ['mercurial/bdiff.c']), | ||
Extension('mercurial.base85', ['mercurial/base85.c'])], | ||||
Thomas Arendsen Hein
|
r3239 | data_files=[(os.path.join('mercurial', root), | ||
[os.path.join(root, file_) for file_ in files]) | ||||
for root, dirs, files in os.walk('templates')], | ||||
Thomas Arendsen Hein
|
r3238 | cmdclass=cmdclass, | ||
scripts=['hg', 'hgmerge'], | ||||
Lee Cantey
|
r4628 | options=dict(py2exe=dict(packages=['hgext']), | ||
bdist_mpkg=dict(zipdist=True, | ||||
Thomas Arendsen Hein
|
r3238 | license='COPYING', | ||
readme='contrib/macosx/Readme.html', | ||||
welcome='contrib/macosx/Welcome.html')), | ||||
Matt Mackall
|
r3893 | **extra) | ||