annotate setup.py @ 7647:f7256cd9beff

recover when no version information is available
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 15 Jan 2009 11:41:59 +0100
parents 9626819b2e3d
children 02e358a3a8a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
7632
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
29 import os, time
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
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
36 extra = {}
6513
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
37 scripts = ['hg']
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
38 if os.name == 'nt':
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
39 scripts.append('contrib/win32/hg.bat')
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
40
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
41 # 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
42 # 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
43 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
44 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
45 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
46 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
47 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
48 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
49 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
50 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
51 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
52 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
53 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
54 # 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
55 # 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
56 # 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
57 # 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
58 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
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 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
72
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
73 # py2exe needs to be installed to work
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
74 try:
1294
372971e1c40d Clean up whitespace damage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1284
diff changeset
75 import py2exe
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
76
1422
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
77 # 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
78 try:
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
79 import modulefinder
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
80 import win32com
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
81 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
82 modulefinder.AddPackagePath("win32com", p)
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
83 pn = "win32com.shell"
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
84 __import__(pn)
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
85 m = sys.modules[pn]
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
86 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
87 modulefinder.AddPackagePath(pn, p)
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
88 except ImportError:
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
89 pass
a7e8408ac79c py2exe is not able to handle win32com.shell
Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
parents: 1421
diff changeset
90
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
91 extra['console'] = ['hg']
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
92
1284
59d07a6bd513 Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1283
diff changeset
93 except ImportError:
3890
2eec996f2fb9 Fix demandload bits of setup.py py2exe support
Matt Mackall <mpm@selenic.com>
parents: 3887
diff changeset
94 pass
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
95
7632
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
96 try:
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
97 l = os.popen('hg id -it').read().split()
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
98 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
99 l.pop()
7647
f7256cd9beff recover when no version information is available
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7632
diff changeset
100 version = l and l[-1] or 'unknown' # latest tag or revision number
7632
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
101 if version.endswith('+'):
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
102 version += time.strftime('%Y%m%d')
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
103
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
104 except OSError:
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
105 version = "unknown"
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
106
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
107 f = file("mercurial/__version__.py", "w")
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
108 f.write('# this file is autogenerated by setup.py\n')
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
109 f.write('version = "%s"\n' % version)
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
110 f.close()
427
36e644d28edf Make it possible to specify a version number in setup.py.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 423
diff changeset
111
157
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
112 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
113 def finalize_options(self):
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
114 self.set_undefined_options('install',
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
115 ('install_lib', 'install_dir'))
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
116 install_data.finalize_options(self)
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
117
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
118 cmdclass = {'install_data': install_package_data}
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
119
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
120 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
121 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
122 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
123 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
124 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
125 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
126 ]
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
127
6948
359e93ceee3a fix double indentation and trailing whitespace
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6938
diff changeset
128 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
129 'hgext.highlight', 'hgext.zeroconf', ]
6239
39cfcef4f463 Add inotify extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6009
diff changeset
130
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
131 try:
7056
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
132 import msvcrt
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
133 ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
134 except ImportError:
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
135 pass
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
136
2c1f18b88b6a osutil: implementation for Win32
Petr Kodl <petrkodl@gmail.com>
parents: 7008
diff changeset
137 try:
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
138 import posix
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
139 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
140
a718e66836e8 setup.py: os.uname is not available on Windows
Bryan O'Sullivan <bos@serpentine.com>
parents: 6239
diff changeset
141 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
142 # 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
143 # 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
144 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
145 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
146 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
147 ['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
148 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
149 except ImportError:
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
150 pass
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
151
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
152 setup(name='mercurial',
7632
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
153 version=version,
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
154 author='Matt Mackall',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
155 author_email='mpm@selenic.com',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
156 url='http://selenic.com/mercurial',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
157 description='Scalable distributed SCM',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
158 license='GNU GPL',
6513
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
159 scripts=scripts,
6239
39cfcef4f463 Add inotify extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6009
diff changeset
160 packages=packages,
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
161 ext_modules=ext_modules,
3239
7a3edd3f7c3e Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3238
diff changeset
162 data_files=[(os.path.join('mercurial', root),
7a3edd3f7c3e Install all files/subdirectories below templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3238
diff changeset
163 [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
164 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
165 cmdclass=cmdclass,
6789
c1c202e2d45d Force email package to be loaded in py2exe
Paul Moore <p.f.moore@gmail.com>
parents: 6373
diff changeset
166 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
167 bdist_mpkg=dict(zipdist=True,
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
168 license='COPYING',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
169 readme='contrib/macosx/Readme.html',
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
170 welcome='contrib/macosx/Welcome.html')),
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
171 **extra)