Mercurial > hg-stable
annotate hg @ 7672:523c7816c33a
Give a useful message about PYTHONPATH if startup fails
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 19 Jan 2009 16:19:09 -0600 |
parents | a3fe91b4f6eb |
children | 46293a0c7e9f |
rev | line source |
---|---|
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
1 #!/usr/bin/env python |
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
2 # |
1698 | 3 # mercurial - scalable distributed SCM |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
4 # |
4635
63b9d2deed48
Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3877
diff
changeset
|
5 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
6 # |
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
7 # This software may be used and distributed according to the terms |
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
8 # of the GNU General Public License, incorporated herein by reference. |
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
9 |
5197
55860a45bbf2
Enable demandimport only in scripts, not in importable modules (issue605)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5178
diff
changeset
|
10 # enable importing on demand to reduce startup time |
7672
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
11 try: |
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
12 from mercurial import demandimport; demandimport.enable() |
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
13 except ImportError: |
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
14 import sys |
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
15 sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" % |
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
16 ' '.join(sys.path)) |
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
17 sys.stderr.write("(check your install and PYTHONPATH)\n") |
523c7816c33a
Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents:
5531
diff
changeset
|
18 sys.exit(-1) |
5197
55860a45bbf2
Enable demandimport only in scripts, not in importable modules (issue605)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5178
diff
changeset
|
19 |
5531
a3fe91b4f6eb
Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents:
5197
diff
changeset
|
20 import sys |
a3fe91b4f6eb
Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents:
5197
diff
changeset
|
21 import mercurial.util |
5178
18a9fbb5cd78
dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents:
4635
diff
changeset
|
22 import mercurial.dispatch |
5531
a3fe91b4f6eb
Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents:
5197
diff
changeset
|
23 |
a3fe91b4f6eb
Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents:
5197
diff
changeset
|
24 for fp in (sys.stdin, sys.stdout, sys.stderr): |
a3fe91b4f6eb
Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents:
5197
diff
changeset
|
25 mercurial.util.set_binary(fp) |
a3fe91b4f6eb
Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents:
5197
diff
changeset
|
26 |
5178
18a9fbb5cd78
dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents:
4635
diff
changeset
|
27 mercurial.dispatch.run() |