annotate setup.py @ 20689:401f9b661a2d

doc: show short description of each commands in generated documents Before this patch, short description of each commands is not shown in generated documents (HTML file and UNIX man page). This omitting may prevent users from understanding about commands. This patch show it as the 1st paragraph in the help section of each commands. This style is chosen because: - showing it as the section title in "command - short desc" style disallows referencing by "#command" in HTML file: in "en" locale, hyphen concatenated title is used as the section ID in HTML file for this style - showing it as the 1st paragraph in "command - short desc" style seems to be redundant: "command" appears also just before as the section title - showing it just after synopsis like "hg help command" seems not to be reasonable in UNIX man page This patch just writes short description ("d['desc'][0]") before "::", because it should be already "strip()"-ed in "get_desc()", or empty string for the command without description.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 11 Mar 2014 14:36:40 +0900
parents 7d4d04299927
children 77ab0abb08a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
575
7f5ce4bbdd7b More whitespace cleanups
mpm@selenic.com
parents: 429
diff changeset
1 #
7f5ce4bbdd7b More whitespace cleanups
mpm@selenic.com
parents: 429
diff changeset
2 # This is the mercurial setup script.
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
3 #
4816
c10d3bc05a8d setup.py not executable: change instructions at beginning of file
Christian Ebert <blacktrash@gmx.net>
parents: 4628
diff changeset
4 # '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
5 # 'python setup.py --help' for more options
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
6
14295
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
7 import sys, platform
14973
5656cb5b9028 setup.py: use getattr instead of hasdattr
Augie Fackler <durin42@gmail.com>
parents: 14538
diff changeset
8 if getattr(sys, 'version_info', (0, 0, 0)) < (2, 4, 0, 'final'):
8286
707bc82ba0d7 setup: require Python 2.4
Martin Geisler <mg@lazybytes.net>
parents: 8283
diff changeset
9 raise SystemExit("Mercurial requires Python 2.4 or later.")
1873
205f04b04ec6 Added check for minimal python version to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1777
diff changeset
10
11532
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
11 if sys.version_info[0] >= 3:
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
12 def b(s):
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
13 '''A helper function to emulate 2.6+ bytes literals using string
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
14 literals.'''
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
15 return s.encode('latin1')
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
16 else:
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
17 def b(s):
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
18 '''A helper function to emulate 2.6+ bytes literals using string
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
19 literals.'''
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
20 return s
f3732ab1149f setup.py: Adjustments to make setup.py run in py3k.
Renato Cunha <renatoc@gmail.com>
parents: 11468
diff changeset
21
7558
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
22 # Solaris Python packaging brain damage
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 hashlib
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
25 sha = hashlib.sha1()
16688
cfb6682961b8 cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents: 16683
diff changeset
26 except ImportError:
7558
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
27 try:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
28 import sha
16688
cfb6682961b8 cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents: 16683
diff changeset
29 except ImportError:
7558
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
30 raise SystemExit(
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
31 "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
32
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
33 try:
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
34 import zlib
16688
cfb6682961b8 cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents: 16683
diff changeset
35 except ImportError:
7558
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
36 raise SystemExit(
dc211ad8d681 setup: warn about missing standard Python components
Matt Mackall <mpm@selenic.com>
parents: 7081
diff changeset
37 "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
38
14295
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
39 # The base IronPython distribution (as of 2.7.1) doesn't support bz2
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
40 isironpython = False
10761
16a13fdb4b36 setup: fail if bz2 is not available
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10521
diff changeset
41 try:
16683
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
42 isironpython = (platform.python_implementation()
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
43 .lower().find("ironpython") != -1)
16688
cfb6682961b8 cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents: 16683
diff changeset
44 except AttributeError:
14295
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
45 pass
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
46
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
47 if isironpython:
15492
36f076d03b34 setup: make script executable with python3
Simon Heimberg <simohe@besonet.ch>
parents: 15460
diff changeset
48 sys.stderr.write("warning: IronPython detected (no bz2 support)\n")
14295
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
49 else:
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
50 try:
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
51 import bz2
16688
cfb6682961b8 cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents: 16683
diff changeset
52 except ImportError:
14295
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
53 raise SystemExit(
bb7e3b3e6e11 setup.py: workaround for missing bz2 module in IronPython
Zachary Gramana <zgramana@pottsconsultinggroup.com>
parents: 14243
diff changeset
54 "Couldn't import standard bz2 (incomplete Python install).")
10761
16a13fdb4b36 setup: fail if bz2 is not available
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 10521
diff changeset
55
8547
548fd7a05373 setup.py: subprocess instead of os.popen, sys.stderr.write instead of print
Christian Ebert <blacktrash@gmx.net>
parents: 8494
diff changeset
56 import os, subprocess, 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
57 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
58 import tempfile
11468
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
59 from distutils import log
14538
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
60 from distutils.core import setup, Command, Extension
7722
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
61 from distutils.dist import Distribution
7649
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
62 from distutils.command.build import build
11468
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
63 from distutils.command.build_ext import build_ext
7722
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
64 from distutils.command.build_py import build_py
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
65 from distutils.command.install_scripts import install_scripts
7649
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
66 from distutils.spawn import spawn, find_executable
17121
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
67 from distutils import cygwinccompiler
14538
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
68 from distutils.errors import CCompilerError, DistutilsExecError
12649
6c0e1aee1b19 setup: user-friendly error message if Python headers are missing
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12501
diff changeset
69 from distutils.sysconfig import get_python_inc
13594
64a458707fd4 setup.py: use StrictVersion instead of manual comparison
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 13583
diff changeset
70 from distutils.version import StrictVersion
157
2653740d8118 Install the templates where they can be found by hgweb.py
mpm@selenic.com
parents: 155
diff changeset
71
15494
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
72 convert2to3 = '--c2to3' in sys.argv
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
73 if convert2to3:
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
74 try:
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
75 from distutils.command.build_py import build_py_2to3 as build_py
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
76 from lib2to3.refactor import get_fixers_from_package as getfixers
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
77 except ImportError:
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
78 if sys.version_info[0] < 3:
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
79 raise SystemExit("--c2to3 is only compatible with python3.")
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
80 raise
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
81 sys.path.append('contrib')
15500
d5abe76da61e setup: raise when executing with python3 without c2to3 argument
Simon Heimberg <simohe@besonet.ch>
parents: 15494
diff changeset
82 elif sys.version_info[0] >= 3:
d5abe76da61e setup: raise when executing with python3 without c2to3 argument
Simon Heimberg <simohe@besonet.ch>
parents: 15494
diff changeset
83 raise SystemExit("setup.py with python3 needs --c2to3 (experimental)")
15494
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
84
6513
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
85 scripts = ['hg']
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
86 if os.name == 'nt':
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
87 scripts.append('contrib/win32/hg.bat')
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
88
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
89 # 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
90 # that actually removes its temporary files.
10000
16f49d671c7f setup: cleanup coding style
Martin Geisler <mg@lazybytes.net>
parents: 9999
diff changeset
91 def hasfunction(cc, funcname):
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
92 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
93 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
94 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 # 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
103 # 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
104 # 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
105 # 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
106 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
107 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
108 os.dup2(devnull.fileno(), sys.stderr.fileno())
9124
632df73485ae setup.py: don't pollute the current directory with temporary files
Bryan O'Sullivan <bos@serpentine.com>
parents: 8936
diff changeset
109 objects = cc.compile([fname], output_dir=tmpdir)
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
110 cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
16689
f366d4c2ff34 cleanup: replace naked excepts with except Exception: ...
Brodie Rao <brodie@sf.io>
parents: 16688
diff changeset
111 except Exception:
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
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
121 # py2exe needs to be installed to work
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
122 try:
1294
372971e1c40d Clean up whitespace damage.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1284
diff changeset
123 import py2exe
10400
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
124 py2exeloaded = True
15527
9926aab3d0b5 setup: fix py2exe generation broken by c3a6ec304055 (issue3116)
Pascal Quantin <pascal.quantin@gmail.com>
parents: 15523
diff changeset
125 # import py2exe's patched Distribution class
9926aab3d0b5 setup: fix py2exe generation broken by c3a6ec304055 (issue3116)
Pascal Quantin <pascal.quantin@gmail.com>
parents: 15523
diff changeset
126 from distutils.core import Distribution
1284
59d07a6bd513 Fix Volker's modifications to setup.py for non-Windows systems.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1283
diff changeset
127 except ImportError:
10400
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
128 py2exeloaded = False
1283
f5faab34f32e Support for the distutils extention 'py2exe' added.
Volker.Kleinfeld@gmx.de
parents: 575
diff changeset
129
9807
f359d4f528aa setup: fix f51d1822d6fd refactoring, propagate env to runcmd
Christian Boos <cboos@bct-technology.com>
parents: 9615
diff changeset
130 def runcmd(cmd, env):
16383
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
131 if sys.platform == 'plan9':
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
132 # subprocess kludge to work around issues in half-baked Python
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
133 # ports, notably bichued/python:
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
134 _, out, err = os.popen3(cmd)
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
135 return str(out), str(err)
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
136 else:
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
137 p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
138 stderr=subprocess.PIPE, env=env)
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
139 out, err = p.communicate()
f5dd179bfa4a plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents: 16209
diff changeset
140 return out, err
13636
4bfff063aed6 setup: fix mac build broken by e42d18538e1d
Jon M. Dugan <jdugan@x1024.net>
parents: 13594
diff changeset
141
4bfff063aed6 setup: fix mac build broken by e42d18538e1d
Jon M. Dugan <jdugan@x1024.net>
parents: 13594
diff changeset
142 def runhg(cmd, env):
4bfff063aed6 setup: fix mac build broken by e42d18538e1d
Jon M. Dugan <jdugan@x1024.net>
parents: 13594
diff changeset
143 out, err = runcmd(cmd, env)
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
144 # If root is executing setup.py, but the repository is owned by
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
145 # another user (as in "sudo python setup.py install") we will get
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
146 # trust warnings since the .hg/hgrc file is untrusted. That is
10120
fb890a546d44 setup: ignore 'not importing' warnings during version detection
Steve Borho <steve@borho.org>
parents: 9856
diff changeset
147 # fine, we don't want to load it anyway. Python may warn about
fb890a546d44 setup: ignore 'not importing' warnings during version detection
Steve Borho <steve@borho.org>
parents: 9856
diff changeset
148 # a missing __init__.py in mercurial/locale, we also ignore that.
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
149 err = [e for e in err.splitlines()
18866
930d54b1fd29 setup.py: properly discard trust warning.
Isaac Jurado <diptongo@gmail.com>
parents: 18754
diff changeset
150 if not e.startswith(b('not trusting file')) \
18754
d420ac09f866 setup.py: ignore warnings from obsolete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 18753
diff changeset
151 and not e.startswith(b('warning: Not importing')) \
d420ac09f866 setup.py: ignore warnings from obsolete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 18753
diff changeset
152 and not e.startswith(b('obsolete feature not enabled'))]
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
153 if err:
17926
65a46635fb31 setup: print subprocess stderr if there is any
Bryan O'Sullivan <bryano@fb.com>
parents: 17732
diff changeset
154 print >> sys.stderr, "stderr from '%s':" % (' '.join(cmd))
65a46635fb31 setup: print subprocess stderr if there is any
Bryan O'Sullivan <bryano@fb.com>
parents: 17732
diff changeset
155 print >> sys.stderr, '\n'.join([' ' + e for e in err])
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
156 return ''
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
157 return out
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
158
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
159 version = ''
8548
3ccbe42ff72f setup: read .hg_archival.txt for version info (issue1670)
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 8547
diff changeset
160
15388
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
161 # Execute hg out of this directory with a custom environment which
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
162 # includes the pure Python modules in mercurial/pure. We also take
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
163 # care to not use any hgrc files and do no localization.
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
164 pypath = ['mercurial', os.path.join('mercurial', 'pure')]
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
165 env = {'PYTHONPATH': os.pathsep.join(pypath),
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
166 'HGRCPATH': '',
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
167 'LANGUAGE': 'C'}
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
168 if 'LD_LIBRARY_PATH' in os.environ:
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
169 env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
170 if 'SystemRoot' in os.environ:
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
171 # Copy SystemRoot into the custom environment for Python 2.6
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
172 # under Windows. Otherwise, the subprocess will fail with
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
173 # error 0xc0150004. See: http://bugs.python.org/issue3440
eb6c0d47c3d5 setup: set whole env for running hg even if .hg doesn't exist (issue3073)
Yuya Nishihara <yuya@tcha.org>
parents: 15367
diff changeset
174 env['SystemRoot'] = os.environ['SystemRoot']
15367
b357a972d6cd setup: set env global earlier (3073)
Matt Mackall <mpm@selenic.com>
parents: 15215
diff changeset
175
8547
548fd7a05373 setup.py: subprocess instead of os.popen, sys.stderr.write instead of print
Christian Ebert <blacktrash@gmx.net>
parents: 8494
diff changeset
176 if os.path.isdir('.hg'):
17709
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
177 cmd = [sys.executable, 'hg', 'log', '-r', '.', '--template', '{tags}\n']
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
178 numerictags = [t for t in runhg(cmd, env).split() if t[0].isdigit()]
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
179 hgid = runhg([sys.executable, 'hg', 'id', '-i'], env).strip()
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
180 if numerictags: # tag(s) found
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
181 version = numerictags[-1]
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
182 if hgid.endswith('+'): # propagate the dirty status to the tag
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
183 version += '+'
17709
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
184 else: # no tag found
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
185 cmd = [sys.executable, 'hg', 'parents', '--template',
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
186 '{latesttag}+{latesttagdistance}-']
17709
b7fff47bb128 setup: calculate version more correctly
Bryan O'Sullivan <bryano@fb.com>
parents: 17606
diff changeset
187 version = runhg(cmd, env) + hgid
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
188 if version.endswith('+'):
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
189 version += time.strftime('%Y%m%d')
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
190 elif os.path.exists('.hg_archival.txt'):
10124
08384d8777a4 setup.py: keep Python 2.3 compatibility
Martin Geisler <mg@lazybytes.net>
parents: 10120
diff changeset
191 kw = dict([[t.strip() for t in l.split(':', 1)]
08384d8777a4 setup.py: keep Python 2.3 compatibility
Martin Geisler <mg@lazybytes.net>
parents: 10120
diff changeset
192 for l in open('.hg_archival.txt')])
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
193 if 'tag' in kw:
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
194 version = kw['tag']
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
195 elif 'latesttag' in kw:
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
196 version = '%(latesttag)s+%(latesttagdistance)s-%(node).12s' % kw
8547
548fd7a05373 setup.py: subprocess instead of os.popen, sys.stderr.write instead of print
Christian Ebert <blacktrash@gmx.net>
parents: 8494
diff changeset
197 else:
9615
f51d1822d6fd setup: refactor the version string to a subset of tag+tagdist-hash+date
Gilles Moris <gilles.moris@free.fr>
parents: 9539
diff changeset
198 version = kw.get('node', '')[:12]
7632
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
199
8548
3ccbe42ff72f setup: read .hg_archival.txt for version info (issue1670)
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 8547
diff changeset
200 if version:
9031
3b76321aa0de compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents: 8936
diff changeset
201 f = open("mercurial/__version__.py", "w")
8548
3ccbe42ff72f setup: read .hg_archival.txt for version info (issue1670)
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 8547
diff changeset
202 f.write('# this file is autogenerated by setup.py\n')
3ccbe42ff72f setup: read .hg_archival.txt for version info (issue1670)
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 8547
diff changeset
203 f.write('version = "%s"\n' % version)
3ccbe42ff72f setup: read .hg_archival.txt for version info (issue1670)
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 8547
diff changeset
204 f.close()
3ccbe42ff72f setup: read .hg_archival.txt for version info (issue1670)
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 8547
diff changeset
205
8493
4c030ada58d2 Fix how setup.py identifies the Mercurial version.
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 7826
diff changeset
206
4c030ada58d2 Fix how setup.py identifies the Mercurial version.
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 7826
diff changeset
207 try:
4c030ada58d2 Fix how setup.py identifies the Mercurial version.
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 7826
diff changeset
208 from mercurial import __version__
4c030ada58d2 Fix how setup.py identifies the Mercurial version.
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 7826
diff changeset
209 version = __version__.version
4c030ada58d2 Fix how setup.py identifies the Mercurial version.
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 7826
diff changeset
210 except ImportError:
4c030ada58d2 Fix how setup.py identifies the Mercurial version.
Jeremy Whitlock <jcscoobyrs@gmail.com>
parents: 7826
diff changeset
211 version = 'unknown'
7632
9626819b2e3d refactor version code
Matt Mackall <mpm@selenic.com>
parents: 7558
diff changeset
212
15460
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
213 class hgbuild(build):
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
214 # Insert hgbuildmo first so that files in mercurial/locale/ are found
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
215 # when build_py is run next.
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
216 sub_commands = [('build_mo', None),
16683
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
217
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
218 # We also need build_ext before build_py. Otherwise, when 2to3 is
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
219 # called (in build_py), it will not find osutil & friends,
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
220 # thinking that those modules are global and, consequently, making
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
221 # a mess, now that all module imports are global.
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
222
15494
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
223 ('build_ext', build.has_ext_modules),
15460
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
224 ] + build.sub_commands
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
225
15523
f9da84a950d0 setup: backout 8504699d1aa6
Matt Mackall <mpm@selenic.com>
parents: 15500
diff changeset
226 class hgbuildmo(build):
7649
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
227
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
228 description = "build translations (.mo files)"
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
229
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
230 def run(self):
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
231 if not find_executable('msgfmt'):
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
232 self.warn("could not find msgfmt executable, no translations "
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
233 "will be built")
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
234 return
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
235
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
236 podir = 'i18n'
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
237 if not os.path.isdir(podir):
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
238 self.warn("could not find %s/ directory" % podir)
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
239 return
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
240
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
241 join = os.path.join
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
242 for po in os.listdir(podir):
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
243 if not po.endswith('.po'):
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
244 continue
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
245 pofile = join(podir, po)
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
246 modir = join('locale', po[:-3], 'LC_MESSAGES')
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
247 mofile = join(modir, 'hg.mo')
9999
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
248 mobuildfile = join('mercurial', mofile)
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
249 cmd = ['msgfmt', '-v', '-o', mobuildfile, pofile]
7720
b6c2cb40e664 setup: do not use -c with msgfmt on Solaris (issue1489)
Martin Geisler <mg@daimi.au.dk>
parents: 7712
diff changeset
250 if sys.platform != 'sunos5':
b6c2cb40e664 setup: do not use -c with msgfmt on Solaris (issue1489)
Martin Geisler <mg@daimi.au.dk>
parents: 7712
diff changeset
251 # msgfmt on Solaris does not know about -c
b6c2cb40e664 setup: do not use -c with msgfmt on Solaris (issue1489)
Martin Geisler <mg@daimi.au.dk>
parents: 7712
diff changeset
252 cmd.append('-c')
9999
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
253 self.mkpath(join('mercurial', modir))
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
254 self.make_file([pofile], mobuildfile, spawn, (cmd,))
7649
a489e3a94443 i18n: new build_mo command for setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7648
diff changeset
255
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
256
15458
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
257 class hgdist(Distribution):
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
258 pure = 0
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
259
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
260 global_options = Distribution.global_options + \
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
261 [('pure', None, "use pure (slow) Python "
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
262 "code instead of C extensions"),
15494
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
263 ('c2to3', None, "(experimental!) convert "
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
264 "code with 2to3"),
15458
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
265 ]
7722
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
266
15459
434c48e981b8 setup: has_ext_modules always returns false when pure is specified
Simon Heimberg <simohe@besonet.ch>
parents: 15458
diff changeset
267 def has_ext_modules(self):
434c48e981b8 setup: has_ext_modules always returns false when pure is specified
Simon Heimberg <simohe@besonet.ch>
parents: 15458
diff changeset
268 # self.ext_modules is emptied in hgbuildpy.finalize_options which is
434c48e981b8 setup: has_ext_modules always returns false when pure is specified
Simon Heimberg <simohe@besonet.ch>
parents: 15458
diff changeset
269 # too late for some cases
434c48e981b8 setup: has_ext_modules always returns false when pure is specified
Simon Heimberg <simohe@besonet.ch>
parents: 15458
diff changeset
270 return not self.pure and Distribution.has_ext_modules(self)
434c48e981b8 setup: has_ext_modules always returns false when pure is specified
Simon Heimberg <simohe@besonet.ch>
parents: 15458
diff changeset
271
11468
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
272 class hgbuildext(build_ext):
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
273
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
274 def build_extension(self, ext):
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
275 try:
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
276 build_ext.build_extension(self, ext)
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
277 except CCompilerError:
12501
98f21e4d9633 setup: slight simplification
Martin Geisler <mg@lazybytes.net>
parents: 11533
diff changeset
278 if not getattr(ext, 'optional', False):
11468
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
279 raise
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
280 log.warn("Failed to build optional extension '%s' (skipping)",
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
281 ext.name)
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
282
10000
16f49d671c7f setup: cleanup coding style
Martin Geisler <mg@lazybytes.net>
parents: 9999
diff changeset
283 class hgbuildpy(build_py):
15494
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
284 if convert2to3:
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
285 fixer_names = sorted(set(getfixers("lib2to3.fixes") +
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
286 getfixers("hgfixes")))
7722
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
287
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
288 def finalize_options(self):
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
289 build_py.finalize_options(self)
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
290
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
291 if self.distribution.pure:
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
292 if self.py_modules is None:
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
293 self.py_modules = []
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
294 for ext in self.distribution.ext_modules:
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
295 if ext.name.startswith("mercurial."):
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
296 self.py_modules.append("mercurial.pure.%s" % ext.name[10:])
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
297 self.distribution.ext_modules = []
12649
6c0e1aee1b19 setup: user-friendly error message if Python headers are missing
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12501
diff changeset
298 else:
18905
012780620d4f setup: make error message for missing Python headers more helpful
Mads Kiilerich <mads@kiilerich.com>
parents: 18900
diff changeset
299 h = os.path.join(get_python_inc(), 'Python.h')
012780620d4f setup: make error message for missing Python headers more helpful
Mads Kiilerich <mads@kiilerich.com>
parents: 18900
diff changeset
300 if not os.path.exists(h):
16683
525fdb738975 cleanup: eradicate long lines
Brodie Rao <brodie@sf.io>
parents: 16383
diff changeset
301 raise SystemExit('Python headers are required to build '
18905
012780620d4f setup: make error message for missing Python headers more helpful
Mads Kiilerich <mads@kiilerich.com>
parents: 18900
diff changeset
302 'Mercurial but weren\'t found in %s' % h)
7722
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
303
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
304 def find_modules(self):
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
305 modules = build_py.find_modules(self)
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
306 for module in modules:
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
307 if module[0] == "mercurial.pure":
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
308 if module[1] != "__init__":
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
309 yield ("mercurial", module[1], module[2])
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
310 else:
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
311 yield module
103127a8cbdb add --pure flag to setup.py
Martin Geisler <mg@daimi.au.dk>
parents: 7721
diff changeset
312
14538
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
313 class buildhgextindex(Command):
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
314 description = 'generate prebuilt index of hgext (for frozen package)'
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
315 user_options = []
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
316 _indexfilename = 'hgext/__index__.py'
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
317
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
318 def initialize_options(self):
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
319 pass
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
320
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
321 def finalize_options(self):
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
322 pass
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
323
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
324 def run(self):
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
325 if os.path.exists(self._indexfilename):
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
326 os.unlink(self._indexfilename)
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
327
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
328 # here no extension enabled, disabled() lists up everything
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
329 code = ('import pprint; from mercurial import extensions; '
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
330 'pprint.pprint(extensions.disabled())')
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
331 out, err = runcmd([sys.executable, '-c', code], env)
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
332 if err:
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
333 raise DistutilsExecError(err)
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
334
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
335 f = open(self._indexfilename, 'w')
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
336 f.write('# this file is autogenerated by setup.py\n')
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
337 f.write('docs = ')
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
338 f.write(out)
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
339 f.close()
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
340
17061
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
341 class buildhgexe(build_ext):
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
342 description = 'compile hg.exe from mercurial/exewrapper.c'
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
343
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
344 def build_extensions(self):
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
345 if os.name != 'nt':
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
346 return
17246
bf5bb38bcc7c setup: fix build_hgexe for mingw32 compiler
Adrian Buehlmann <adrian@cadifra.com>
parents: 17121
diff changeset
347 if isinstance(self.compiler, HackedMingw32CCompiler):
bf5bb38bcc7c setup: fix build_hgexe for mingw32 compiler
Adrian Buehlmann <adrian@cadifra.com>
parents: 17121
diff changeset
348 self.compiler.compiler_so = self.compiler.compiler # no -mdll
bf5bb38bcc7c setup: fix build_hgexe for mingw32 compiler
Adrian Buehlmann <adrian@cadifra.com>
parents: 17121
diff changeset
349 self.compiler.dll_libraries = [] # no -lmsrvc90
17732
93d97a212559 exewrapper: adapt for legacy HackableMercurial
Adrian Buehlmann <adrian@cadifra.com>
parents: 17709
diff changeset
350 hv = sys.hexversion
93d97a212559 exewrapper: adapt for legacy HackableMercurial
Adrian Buehlmann <adrian@cadifra.com>
parents: 17709
diff changeset
351 pythonlib = 'python%d%d' % (hv >> 24, (hv >> 16) & 0xff)
93d97a212559 exewrapper: adapt for legacy HackableMercurial
Adrian Buehlmann <adrian@cadifra.com>
parents: 17709
diff changeset
352 f = open('mercurial/hgpythonlib.h', 'wb')
93d97a212559 exewrapper: adapt for legacy HackableMercurial
Adrian Buehlmann <adrian@cadifra.com>
parents: 17709
diff changeset
353 f.write('/* this file is autogenerated by setup.py */\n')
93d97a212559 exewrapper: adapt for legacy HackableMercurial
Adrian Buehlmann <adrian@cadifra.com>
parents: 17709
diff changeset
354 f.write('#define HGPYTHONLIB "%s"\n' % pythonlib)
93d97a212559 exewrapper: adapt for legacy HackableMercurial
Adrian Buehlmann <adrian@cadifra.com>
parents: 17709
diff changeset
355 f.close()
17061
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
356 objects = self.compiler.compile(['mercurial/exewrapper.c'],
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
357 output_dir=self.build_temp)
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
358 dir = os.path.dirname(self.get_ext_fullpath('dummy'))
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
359 target = os.path.join(dir, 'hg')
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
360 self.compiler.link_executable(objects, target,
17732
93d97a212559 exewrapper: adapt for legacy HackableMercurial
Adrian Buehlmann <adrian@cadifra.com>
parents: 17709
diff changeset
361 libraries=[],
17061
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
362 output_dir=self.build_temp)
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
363
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
364 class hginstallscripts(install_scripts):
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
365 '''
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
366 This is a specialization of install_scripts that replaces the @LIBDIR@ with
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
367 the configured directory for modules. If possible, the path is made relative
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
368 to the directory for scripts.
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
369 '''
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
370
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
371 def initialize_options(self):
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
372 install_scripts.initialize_options(self)
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
373
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
374 self.install_lib = None
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
375
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
376 def finalize_options(self):
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
377 install_scripts.finalize_options(self)
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
378 self.set_undefined_options('install',
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
379 ('install_lib', 'install_lib'))
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
380
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
381 def run(self):
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
382 install_scripts.run(self)
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
383
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
384 if (os.path.splitdrive(self.install_dir)[0] !=
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
385 os.path.splitdrive(self.install_lib)[0]):
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
386 # can't make relative paths from one drive to another, so use an
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
387 # absolute path instead
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
388 libdir = self.install_lib
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
389 else:
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
390 common = os.path.commonprefix((self.install_dir, self.install_lib))
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
391 rest = self.install_dir[len(common):]
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
392 uplevel = len([n for n in os.path.split(rest) if n])
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
393
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
394 libdir = uplevel * ('..' + os.sep) + self.install_lib[len(common):]
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
395
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
396 for outfile in self.outfiles:
13400
14f3795a5ed7 explicitly close files
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12865
diff changeset
397 fp = open(outfile, 'rb')
14f3795a5ed7 explicitly close files
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12865
diff changeset
398 data = fp.read()
14f3795a5ed7 explicitly close files
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12865
diff changeset
399 fp.close()
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
400
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
401 # skip binary files
15494
7a7a1c594daf setup: support executing with python3 including 2to3
Simon Heimberg <simohe@besonet.ch>
parents: 15493
diff changeset
402 if b('\0') in data:
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
403 continue
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
404
12676
ef500b2f100b setup.py: write libdir as a python string literal
Patrick Mezard <pmezard@gmail.com>
parents: 12661
diff changeset
405 data = data.replace('@LIBDIR@', libdir.encode('string_escape'))
13400
14f3795a5ed7 explicitly close files
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12865
diff changeset
406 fp = open(outfile, 'wb')
14f3795a5ed7 explicitly close files
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12865
diff changeset
407 fp.write(data)
14f3795a5ed7 explicitly close files
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12865
diff changeset
408 fp.close()
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
409
15460
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
410 cmdclass = {'build': hgbuild,
f9f0731dbc56 setup: subclass build command
Simon Heimberg <simohe@besonet.ch>
parents: 15459
diff changeset
411 'build_mo': hgbuildmo,
11468
1c1126b1d919 setup: ignore failures to build optional inotify extension
Christian Boos <cboos@neuf.fr>
parents: 10905
diff changeset
412 'build_ext': hgbuildext,
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12649
diff changeset
413 'build_py': hgbuildpy,
14538
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
414 'build_hgextindex': buildhgextindex,
17061
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
415 'install_scripts': hginstallscripts,
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
416 'build_hgexe': buildhgexe,
f20e4d76b711 setup: compile hg.exe
Adrian Buehlmann <adrian@cadifra.com>
parents: 16775
diff changeset
417 }
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
418
16775
e6af8676302f httpclient: omit tests for the client since we don't run them anyway
Augie Fackler <raf@durin42.com>
parents: 16689
diff changeset
419 packages = ['mercurial', 'mercurial.hgweb', 'mercurial.httpclient',
15215
c41078b9d0b8 setup: add largefiles to list of packages
Na'Tosha Bard <natosha@unity3d.com>
parents: 15167
diff changeset
420 'hgext', 'hgext.convert', 'hgext.highlight', 'hgext.zeroconf',
c41078b9d0b8 setup: add largefiles to list of packages
Na'Tosha Bard <natosha@unity3d.com>
parents: 15167
diff changeset
421 'hgext.largefiles']
10521
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
422
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
423 pymodules = []
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
424
19724
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
425 common_depends = ['mercurial/util.h']
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
426
10000
16f49d671c7f setup: cleanup coding style
Martin Geisler <mg@lazybytes.net>
parents: 9999
diff changeset
427 extmodules = [
19724
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
428 Extension('mercurial.base85', ['mercurial/base85.c'],
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
429 depends=common_depends),
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
430 Extension('mercurial.bdiff', ['mercurial/bdiff.c'],
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
431 depends=common_depends),
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
432 Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c'],
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
433 depends=common_depends),
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
434 Extension('mercurial.mpatch', ['mercurial/mpatch.c'],
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
435 depends=common_depends),
18900
02ee846b246a scmutil: rewrite dirs in C, use if available
Bryan O'Sullivan <bryano@fb.com>
parents: 18866
diff changeset
436 Extension('mercurial.parsers', ['mercurial/dirs.c',
02ee846b246a scmutil: rewrite dirs in C, use if available
Bryan O'Sullivan <bryano@fb.com>
parents: 18866
diff changeset
437 'mercurial/parsers.c',
19724
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
438 'mercurial/pathencode.c'],
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
439 depends=common_depends),
5396
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
440 ]
5105b119edd2 Add osutil module, containing a listdir function.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5197
diff changeset
441
13734
16118b4859a1 util: add Mac-specific check whether we're in a GUI session (issue2553)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 13637
diff changeset
442 osutil_ldflags = []
16118b4859a1 util: add Mac-specific check whether we're in a GUI session (issue2553)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 13637
diff changeset
443
16118b4859a1 util: add Mac-specific check whether we're in a GUI session (issue2553)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 13637
diff changeset
444 if sys.platform == 'darwin':
16118b4859a1 util: add Mac-specific check whether we're in a GUI session (issue2553)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 13637
diff changeset
445 osutil_ldflags += ['-framework', 'ApplicationServices']
16118b4859a1 util: add Mac-specific check whether we're in a GUI session (issue2553)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 13637
diff changeset
446
10521
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
447 # disable osutil.c under windows + python 2.4 (issue1364)
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
448 if sys.platform == 'win32' and sys.version_info < (2, 5, 0, 'final'):
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
449 pymodules.append('mercurial.pure.osutil')
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
450 else:
13734
16118b4859a1 util: add Mac-specific check whether we're in a GUI session (issue2553)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 13637
diff changeset
451 extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'],
19724
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
452 extra_link_args=osutil_ldflags,
2b2a2e858fb7 setup: check if mercurial/util.h has been modified
Wei, Elson <elson.wei@gmail.com>
parents: 18905
diff changeset
453 depends=common_depends))
6239
39cfcef4f463 Add inotify extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6009
diff changeset
454
17121
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
455 # the -mno-cygwin option has been deprecated for years
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
456 Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
457
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
458 class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
459 def __init__(self, *args, **kwargs):
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
460 Mingw32CCompiler.__init__(self, *args, **kwargs)
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
461 for i in 'compiler compiler_so linker_exe linker_so'.split():
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
462 try:
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
463 getattr(self, i).remove('-mno-cygwin')
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
464 except ValueError:
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
465 pass
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
466
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
467 cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler
d13f47c800fd setup: disable -mno-cygwin if building under mingw32
Bryan O'Sullivan <bryano@fb.com>
parents: 17061
diff changeset
468
9999
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
469 packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo',
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
470 'help/*.txt']}
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
471
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
472 def ordinarypath(p):
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
473 return p and p[0] != '.' and p[-1] != '~'
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
474
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10264
diff changeset
475 for root in ('templates',):
9999
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
476 for curdir, dirs, files in os.walk(os.path.join('mercurial', root)):
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
477 curdir = curdir.split(os.sep, 1)[1]
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
478 dirs[:] = filter(ordinarypath, dirs)
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
479 for f in filter(ordinarypath, files):
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
480 f = os.path.join(curdir, f)
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
481 packagedata['mercurial'].append(f)
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
482
7648
02e358a3a8a7 i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents: 7647
diff changeset
483 datafiles = []
10400
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
484 setupversion = version
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
485 extra = {}
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
486
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
487 if py2exeloaded:
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
488 extra['console'] = [
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
489 {'script':'hg',
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
490 'copyright':'Copyright (C) 2005-2010 Matt Mackall and others',
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
491 'product_version':version}]
14538
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
492 # sub command of 'build' because 'py2exe' does not handle sub_commands
3818c67a501e setup: add command to generate index of extensions
Yuya Nishihara <yuya@tcha.org>
parents: 14324
diff changeset
493 build.sub_commands.insert(0, ('build_hgextindex', None))
10400
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
494
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
495 if os.name == 'nt':
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
496 # Windows binary file versions for exe/dll files must have the
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
497 # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
498 setupversion = version.split('+', 1)[0]
7648
02e358a3a8a7 i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents: 7647
diff changeset
499
13583
e42d18538e1d fix compiling of extensions for OS X and XCode 4.0
Alexander Solovyov <alexander@solovyov.net>
parents: 13400
diff changeset
500 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
e42d18538e1d fix compiling of extensions for OS X and XCode 4.0
Alexander Solovyov <alexander@solovyov.net>
parents: 13400
diff changeset
501 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
e42d18538e1d fix compiling of extensions for OS X and XCode 4.0
Alexander Solovyov <alexander@solovyov.net>
parents: 13400
diff changeset
502 # distutils.sysconfig
16187
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
503 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
504 if version:
16209
5536770b3c88 setup.py: don't call splitlines twice on the output of xcodebuild (issue3277)
Brendan Cully <brendan@kublai.com>
parents: 16187
diff changeset
505 version = version[0]
16187
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
506 xcode4 = (version.startswith('Xcode') and
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
507 StrictVersion(version.split()[1]) >= StrictVersion('4.0'))
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
508 else:
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
509 # xcodebuild returns empty on OS X Lion with XCode 4.3 not
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
510 # installed, but instead with only command-line tools. Assume
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
511 # that only happens on >= Lion, thus no PPC support.
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
512 xcode4 = True
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
513
82ce91a9fd94 setup: handle output from Apple's Xcode 4.3 better (issue3277)
Greg Ward <greg@gerg.ca>
parents: 15527
diff changeset
514 if xcode4:
14324
d3a49a52f117 Hardcoding ARCHFLAGS breaks the build against fink's python
Brendan Cully <brendan@kublai.com>
parents: 14295
diff changeset
515 os.environ['ARCHFLAGS'] = ''
13583
e42d18538e1d fix compiling of extensions for OS X and XCode 4.0
Alexander Solovyov <alexander@solovyov.net>
parents: 13400
diff changeset
516
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
517 setup(name='mercurial',
10400
fb203201ce30 setup.py: fixing version info for Windows hg.exe (py2exe)
Adrian Buehlmann <adrian@cadifra.com>
parents: 10282
diff changeset
518 version=setupversion,
18753
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
519 author='Matt Mackall and many others',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
520 author_email='mercurial@selenic.com',
8936
1de6e7e1bb9f change wiki/bts URLs to point to new hostname
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8648
diff changeset
521 url='http://mercurial.selenic.com/',
18753
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
522 download_url='http://mercurial.selenic.com/release/',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
523 description=('Fast scalable distributed SCM (revision control, version '
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
524 'control) system'),
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
525 long_description=('Mercurial is a distributed SCM tool written in Python.'
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
526 ' It is used by a number of large projects that require'
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
527 ' fast, reliable distributed revision control, such as '
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
528 'Mozilla.'),
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
529 license='GNU GPLv2 or any later version',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
530 classifiers=[
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
531 'Development Status :: 6 - Mature',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
532 'Environment :: Console',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
533 'Intended Audience :: Developers',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
534 'Intended Audience :: System Administrators',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
535 'License :: OSI Approved :: GNU General Public License (GPL)',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
536 'Natural Language :: Danish',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
537 'Natural Language :: English',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
538 'Natural Language :: German',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
539 'Natural Language :: Italian',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
540 'Natural Language :: Japanese',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
541 'Natural Language :: Portuguese (Brazilian)',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
542 'Operating System :: Microsoft :: Windows',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
543 'Operating System :: OS Independent',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
544 'Operating System :: POSIX',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
545 'Programming Language :: C',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
546 'Programming Language :: Python',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
547 'Topic :: Software Development :: Version Control',
3f59cb1ccc73 setup.py: add metadata to register package to PyPI
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 17926
diff changeset
548 ],
6513
66e87c11447d Add a batch file driver for Windows
Paul Moore <p.f.moore@gmail.com>
parents: 6389
diff changeset
549 scripts=scripts,
6239
39cfcef4f463 Add inotify extension
Bryan O'Sullivan <bos@serpentine.com>
parents: 6009
diff changeset
550 packages=packages,
10521
bde1bb250fc2 Do not use osutil.c with python 2.4 and Windows (issue1364)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10400
diff changeset
551 py_modules=pymodules,
10000
16f49d671c7f setup: cleanup coding style
Martin Geisler <mg@lazybytes.net>
parents: 9999
diff changeset
552 ext_modules=extmodules,
7648
02e358a3a8a7 i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents: 7647
diff changeset
553 data_files=datafiles,
9999
f91e5630ce7e setup: install translation files as package data
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 9998
diff changeset
554 package_data=packagedata,
3238
3dba9ec89164 Applied coding style to setup.py
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2402
diff changeset
555 cmdclass=cmdclass,
15458
c3a6ec304055 setup: subclass distribution instead of overwriting original
Simon Heimberg <simohe@besonet.ch>
parents: 15388
diff changeset
556 distclass=hgdist,
20687
7d4d04299927 setup.py: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents: 20644
diff changeset
557 options={'py2exe': {'packages': ['hgext', 'email']},
7d4d04299927 setup.py: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents: 20644
diff changeset
558 'bdist_mpkg': {'zipdist': True,
7d4d04299927 setup.py: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents: 20644
diff changeset
559 'license': 'COPYING',
7d4d04299927 setup.py: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents: 20644
diff changeset
560 'readme': 'contrib/macosx/Readme.html',
7d4d04299927 setup.py: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents: 20644
diff changeset
561 'welcome': 'contrib/macosx/Welcome.html',
7d4d04299927 setup.py: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents: 20644
diff changeset
562 },
7d4d04299927 setup.py: move from dict() construction to {} literals
Augie Fackler <raf@durin42.com>
parents: 20644
diff changeset
563 },
3893
070628929e1f Fix setup.py warning
Matt Mackall <mpm@selenic.com>
parents: 3892
diff changeset
564 **extra)