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