Show More
@@ -1,43 +1,54 b'' | |||
|
1 | 1 | #!/usr/bin/env python3 |
|
2 | 2 | # |
|
3 | 3 | # mercurial - scalable distributed SCM |
|
4 | 4 | # |
|
5 | 5 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
6 | 6 | # |
|
7 | 7 | # This software may be used and distributed according to the terms of the |
|
8 | 8 | # GNU General Public License version 2 or any later version. |
|
9 | 9 | from __future__ import absolute_import |
|
10 | 10 | |
|
11 | 11 | import os |
|
12 | 12 | import sys |
|
13 | 13 | |
|
14 | 14 | libdir = '@LIBDIR@' |
|
15 | 15 | |
|
16 | 16 | if libdir != '@' 'LIBDIR' '@': |
|
17 | 17 | if not os.path.isabs(libdir): |
|
18 | 18 | libdir = os.path.join( |
|
19 | 19 | os.path.dirname(os.path.realpath(__file__)), libdir |
|
20 | 20 | ) |
|
21 | 21 | libdir = os.path.abspath(libdir) |
|
22 | 22 | sys.path.insert(0, libdir) |
|
23 | 23 | |
|
24 | # Make `pip install --user ...` packages available to the official Windows | |
|
25 | # build. Most py2 packaging installs directly into the system python | |
|
26 | # environment, so no changes are necessary for other platforms. The Windows | |
|
27 | # py2 package uses py2exe, which lacks a `site` module. Hardcode it according | |
|
28 | # to the documentation. | |
|
29 | if getattr(sys, 'frozen', None) == 'console_exe': | |
|
30 | vi = sys.version_info | |
|
31 | sys.path.append(os.path.join(os.environ['APPDATA'], 'Python', | |
|
32 | 'Python%d%d' % (vi[0], vi[1]), | |
|
33 | 'site-packages')) | |
|
34 | ||
|
24 | 35 | from hgdemandimport import tracing |
|
25 | 36 | |
|
26 | 37 | with tracing.log('hg script'): |
|
27 | 38 | # enable importing on demand to reduce startup time |
|
28 | 39 | try: |
|
29 | 40 | if sys.version_info[0] < 3 or sys.version_info >= (3, 6): |
|
30 | 41 | import hgdemandimport |
|
31 | 42 | |
|
32 | 43 | hgdemandimport.enable() |
|
33 | 44 | except ImportError: |
|
34 | 45 | sys.stderr.write( |
|
35 | 46 | "abort: couldn't find mercurial libraries in [%s]\n" |
|
36 | 47 | % ' '.join(sys.path) |
|
37 | 48 | ) |
|
38 | 49 | sys.stderr.write("(check your install and PYTHONPATH)\n") |
|
39 | 50 | sys.exit(-1) |
|
40 | 51 | |
|
41 | 52 | from mercurial import dispatch |
|
42 | 53 | |
|
43 | 54 | dispatch.run() |
General Comments 0
You need to be logged in to leave comments.
Login now