13 |
13 |
14 libdir = '@LIBDIR@' |
14 libdir = '@LIBDIR@' |
15 |
15 |
16 if libdir != '@' 'LIBDIR' '@': |
16 if libdir != '@' 'LIBDIR' '@': |
17 if not os.path.isabs(libdir): |
17 if not os.path.isabs(libdir): |
18 libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), |
18 libdir = os.path.join( |
19 libdir) |
19 os.path.dirname(os.path.realpath(__file__)), libdir |
|
20 ) |
20 libdir = os.path.abspath(libdir) |
21 libdir = os.path.abspath(libdir) |
21 sys.path.insert(0, libdir) |
22 sys.path.insert(0, libdir) |
22 |
23 |
23 from hgdemandimport import tracing |
24 from hgdemandimport import tracing |
|
25 |
24 with tracing.log('hg script'): |
26 with tracing.log('hg script'): |
25 # enable importing on demand to reduce startup time |
27 # enable importing on demand to reduce startup time |
26 try: |
28 try: |
27 if sys.version_info[0] < 3 or sys.version_info >= (3, 6): |
29 if sys.version_info[0] < 3 or sys.version_info >= (3, 6): |
28 import hgdemandimport; hgdemandimport.enable() |
30 import hgdemandimport |
|
31 |
|
32 hgdemandimport.enable() |
29 except ImportError: |
33 except ImportError: |
30 sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" % |
34 sys.stderr.write( |
31 ' '.join(sys.path)) |
35 "abort: couldn't find mercurial libraries in [%s]\n" |
|
36 % ' '.join(sys.path) |
|
37 ) |
32 sys.stderr.write("(check your install and PYTHONPATH)\n") |
38 sys.stderr.write("(check your install and PYTHONPATH)\n") |
33 sys.exit(-1) |
39 sys.exit(-1) |
34 |
40 |
35 from mercurial import dispatch |
41 from mercurial import dispatch |
|
42 |
36 dispatch.run() |
43 dispatch.run() |