##// END OF EJS Templates
hg: add support for HGUNICODEPEDANTRY environment variable...
Augie Fackler -
r21812:73e4a02e default
parent child Browse files
Show More
@@ -1,38 +1,43 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # mercurial - scalable distributed SCM
3 # mercurial - scalable distributed SCM
4 #
4 #
5 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
5 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
6 #
6 #
7 # This software may be used and distributed according to the terms of the
7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version.
8 # GNU General Public License version 2 or any later version.
9
9
10 import os
10 import os
11 import sys
11 import sys
12
12
13 if os.environ.get('HGUNICODEPEDANTRY', False):
14 reload(sys)
15 sys.setdefaultencoding("undefined")
16
17
13 libdir = '@LIBDIR@'
18 libdir = '@LIBDIR@'
14
19
15 if libdir != '@' 'LIBDIR' '@':
20 if libdir != '@' 'LIBDIR' '@':
16 if not os.path.isabs(libdir):
21 if not os.path.isabs(libdir):
17 libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
22 libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
18 libdir)
23 libdir)
19 libdir = os.path.abspath(libdir)
24 libdir = os.path.abspath(libdir)
20 sys.path.insert(0, libdir)
25 sys.path.insert(0, libdir)
21
26
22 # enable importing on demand to reduce startup time
27 # enable importing on demand to reduce startup time
23 try:
28 try:
24 from mercurial import demandimport; demandimport.enable()
29 from mercurial import demandimport; demandimport.enable()
25 except ImportError:
30 except ImportError:
26 import sys
31 import sys
27 sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
32 sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
28 ' '.join(sys.path))
33 ' '.join(sys.path))
29 sys.stderr.write("(check your install and PYTHONPATH)\n")
34 sys.stderr.write("(check your install and PYTHONPATH)\n")
30 sys.exit(-1)
35 sys.exit(-1)
31
36
32 import mercurial.util
37 import mercurial.util
33 import mercurial.dispatch
38 import mercurial.dispatch
34
39
35 for fp in (sys.stdin, sys.stdout, sys.stderr):
40 for fp in (sys.stdin, sys.stdout, sys.stderr):
36 mercurial.util.setbinary(fp)
41 mercurial.util.setbinary(fp)
37
42
38 mercurial.dispatch.run()
43 mercurial.dispatch.run()
General Comments 0
You need to be logged in to leave comments. Login now