setup.py
author Matt Mackall <mpm@selenic.com>
Wed, 31 Dec 2008 17:59:58 -0600
changeset 7558 dc211ad8d681
parent 7081 2fdbf2ccd03a
child 7632 9626819b2e3d
permissions -rw-r--r--
setup: warn about missing standard Python components
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     1
#!/usr/bin/env python
575
7f5ce4bbdd7b More whitespace cleanups
mpm@selenic.com
parents: 429
diff changeset
     2
#
7f5ce4bbdd7b More whitespace cleanups
mpm@selenic.com
parents: 429
diff changeset
     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
#
4816
c10d3bc05a8d setup.py not executable: change instructions at beginning of file
Christian Ebert <blacktrash@gmx.net>
parents: 4628
diff changeset
     5
# 'python setup.py install', or
c10d3bc05a8d setup.py not executable: change instructions at beginning of file
Christian Ebert <blacktrash@gmx.net>
parents: 4628
diff changeset
     6
# 'python setup.py --help' for more options
0
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'):
7008
8fee8ff13d37 use Exception(args)-style raising consistently (py3k compatibility)
Peter Ruibal <peter.ruibal@intel.com>
parents: 6948
diff changeset
    10
    raise SystemExit("Mercurial requires python 2.3 or later.")
1873
205f04b04ec6 Added check for minimal python version to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1777
diff changeset
    11
7558
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    12
# Solaris Python packaging brain damage
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    13
try:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    14
    import hashlib
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    15
    sha = hashlib.sha1()
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    16
except:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    17
    try:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    18
        import sha
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    19
    except:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    20
        raise SystemExit(
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    21
            "Couldn't import standard hashlib (incomplete Python install).")
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    22
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    23
try:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    24
    import zlib
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    25
except:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    26
    raise SystemExit(
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    27
        "Couldn't import standard zlib (incomplete Python install).")
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
    28
3239
7a3edd3f7c3e Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3238
diff changeset
    29
import os
6251
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    30
import shutil
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    31
import tempfile
72
4a6ab4d80dc4 Add an O(m + nlog n) patching extension
mpm@selenic.com
parents: 67
diff changeset
    32
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
    33
from distutils.command.install_data import install_data
6245
0d0939b2d272 setup.py: skip inotify if there's no inotify_add_watch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6241
diff changeset
    34
from distutils.ccompiler import new_compiler
157
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
    35
423
25afb21d97ba Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 241
diff changeset
    36
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
    37
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
    38
extra = {}
6513
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
    39
scripts = ['hg']
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
    40
if os.name == 'nt':
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
    41
    scripts.append('contrib/win32/hg.bat')
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
    42
6251
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    43
# simplified version of distutils.ccompiler.CCompiler.has_function
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    44
# that actually removes its temporary files.
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    45
def has_function(cc, funcname):
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    46
    tmpdir = tempfile.mkdtemp(prefix='hg-install-')
6373
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    47
    devnull = oldstderr = None
6251
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    48
    try:
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    49
        try:
6373
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    50
            fname = os.path.join(tmpdir, 'funcname.c')
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    51
            f = open(fname, 'w')
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    52
            f.write('int main(void) {\n')
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    53
            f.write('    %s();\n' % funcname)
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    54
            f.write('}\n')
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    55
            f.close()
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    56
            # Redirect stderr to /dev/null to hide any error messages
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    57
            # from the compiler.
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    58
            # This will have to be changed if we ever have to check
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    59
            # for a function on Windows.
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    60
            devnull = open('/dev/null', 'w')
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    61
            oldstderr = os.dup(sys.stderr.fileno())
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    62
            os.dup2(devnull.fileno(), sys.stderr.fileno())
6251
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    63
            objects = cc.compile([fname])
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    64
            cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    65
        except:
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    66
            return False
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    67
        return True
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    68
    finally:
6373
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    69
        if oldstderr is not None:
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    70
            os.dup2(oldstderr, sys.stderr.fileno())
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    71
        if devnull is not None:
7010e4557963 setup.py: hide compiler error messages while searching for inotify
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6251
diff changeset
    72
            devnull.close()
6251
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    73
        shutil.rmtree(tmpdir)
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
    74
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
    75
# py2exe needs to be installed to work
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
    76
try:
1294
372971e1c40d Clean up whitespace damage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1284
diff changeset
    77
    import py2exe
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
    78
1422
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    79
    # 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
    80
    try:
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    81
        import modulefinder
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    82
        import win32com
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    83
        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
    84
            modulefinder.AddPackagePath("win32com", p)
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    85
        pn = "win32com.shell"
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    86
        __import__(pn)
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    87
        m = sys.modules[pn]
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    88
        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
    89
            modulefinder.AddPackagePath(pn, p)
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    90
    except ImportError:
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    91
        pass
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
    92
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
    93
    extra['console'] = ['hg']
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
    94
1284
59d07a6bd513 Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1283
diff changeset
    95
except ImportError:
3890
2eec996f2fb9 Fix demandload bits of setup.py py2exe support
Matt Mackall <mpm@selenic.com>
parents: 3887
diff changeset
    96
    pass
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
    97
427
36e644d28edf Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 423
diff changeset
    98
# 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
    99
version = ''
36e644d28edf Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 423
diff changeset
   100
157
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
   101
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
   102
    def finalize_options(self):
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
   103
        self.set_undefined_options('install',
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
   104
                                   ('install_lib', 'install_dir'))
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
   105
        install_data.finalize_options(self)
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
   106
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
   107
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
   108
cmdclass = {'install_data': install_package_data}
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   109
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   110
ext_modules=[
6389
0231f763ebc8 manifest: improve parsing performance by 8x via a new C extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6373
diff changeset
   111
    Extension('mercurial.base85', ['mercurial/base85.c']),
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   112
    Extension('mercurial.bdiff', ['mercurial/bdiff.c']),
6389
0231f763ebc8 manifest: improve parsing performance by 8x via a new C extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6373
diff changeset
   113
    Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']),
0231f763ebc8 manifest: improve parsing performance by 8x via a new C extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6373
diff changeset
   114
    Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
0231f763ebc8 manifest: improve parsing performance by 8x via a new C extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6373
diff changeset
   115
    Extension('mercurial.parsers', ['mercurial/parsers.c']),
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   116
    ]
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   117
6948
359e93ceee3a fix double indentation and trailing whitespace
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6938
diff changeset
   118
packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert',
7081
2fdbf2ccd03a Add hgext.zeroconf to the package list so it gets installed by setup.py.
Augie Fackler <durin42@gmail.com>
parents: 7056
diff changeset
   119
            'hgext.highlight', 'hgext.zeroconf', ]
6239
39cfcef4f463 Add inotify extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6009
diff changeset
   120
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   121
try:
7056
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
   122
    import msvcrt
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
   123
    ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
   124
except ImportError:
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
   125
    pass
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
   126
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
   127
try:
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   128
    import posix
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   129
    ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
6241
a718e66836e8 setup.py: os.uname is not available on Windows
Bryan O'Sullivan <bos@serpentine.com>
parents: 6239
diff changeset
   130
a718e66836e8 setup.py: os.uname is not available on Windows
Bryan O'Sullivan <bos@serpentine.com>
parents: 6239
diff changeset
   131
    if sys.platform == 'linux2' and os.uname()[2] > '2.6':
6245
0d0939b2d272 setup.py: skip inotify if there's no inotify_add_watch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6241
diff changeset
   132
        # The inotify extension is only usable with Linux 2.6 kernels.
0d0939b2d272 setup.py: skip inotify if there's no inotify_add_watch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6241
diff changeset
   133
        # You also need a reasonably recent C library.
0d0939b2d272 setup.py: skip inotify if there's no inotify_add_watch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6241
diff changeset
   134
        cc = new_compiler()
6251
87053f0b0fad setup.py: use a simplified custom version of CCompiler.has_function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6245
diff changeset
   135
        if has_function(cc, 'inotify_add_watch'):
6245
0d0939b2d272 setup.py: skip inotify if there's no inotify_add_watch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6241
diff changeset
   136
            ext_modules.append(Extension('hgext.inotify.linux._inotify',
0d0939b2d272 setup.py: skip inotify if there's no inotify_add_watch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6241
diff changeset
   137
                                         ['hgext/inotify/linux/_inotify.c']))
0d0939b2d272 setup.py: skip inotify if there's no inotify_add_watch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6241
diff changeset
   138
            packages.extend(['hgext.inotify', 'hgext.inotify.linux'])
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   139
except ImportError:
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   140
    pass
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   141
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
   142
setup(name='mercurial',
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   143
      version=mercurial.version.get_version(),
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   144
      author='Matt Mackall',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   145
      author_email='mpm@selenic.com',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   146
      url='http://selenic.com/mercurial',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   147
      description='Scalable distributed SCM',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   148
      license='GNU GPL',
6513
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
   149
      scripts=scripts,
6239
39cfcef4f463 Add inotify extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6009
diff changeset
   150
      packages=packages,
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
   151
      ext_modules=ext_modules,
3239
7a3edd3f7c3e Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3238
diff changeset
   152
      data_files=[(os.path.join('mercurial', root),
7a3edd3f7c3e Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3238
diff changeset
   153
                   [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
   154
                  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
   155
      cmdclass=cmdclass,
6789
c1c202e2d45d Force email package to be loaded in py2exe
Paul Moore <p.f.moore@gmail.com>
parents: 6373
diff changeset
   156
      options=dict(py2exe=dict(packages=['hgext', 'email']),
4628
02956be66a58 Fix for including hgext in Windows compiled version.
Lee Cantey <lcantey@gmail.com>
parents: 4519
diff changeset
   157
                   bdist_mpkg=dict(zipdist=True,
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   158
                                   license='COPYING',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   159
                                   readme='contrib/macosx/Readme.html',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
   160
                                   welcome='contrib/macosx/Welcome.html')),
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
   161
      **extra)