Mercurial > hg > config
annotate python/example/install_and_exec.py @ 694:ebca6d85213a
File "/usr/lib/python3/dist-packages/IPython/config/__init__.py", line 16, in <module>
from .application import *
File "/usr/lib/python3/dist-packages/IPython/config/application.py", line 31, in <module>
from IPython.config.configurable import SingletonConfigurable
File "/usr/lib/python3/dist-packages/IPython/config/configurable.py", line 33, in <module>
from IPython.utils.text import indent, wrap_paragraphs
File "/usr/lib/python3/dist-packages/IPython/utils/text.py", line 28, in <module>
from IPython.external.path import path
File "/usr/lib/python3/dist-packages/IPython/external/path/__init__.py", line 2, in <module>
from path import *
File "/home/jhammel/python/path.py", line 25
print root(path)
^
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 09 Jul 2014 16:26:49 -0700 |
parents | 9cb40c01c10a |
children |
rev | line source |
---|---|
650
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
3 |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
4 """ |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
5 illustrates installation and execution following installation |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
6 """ |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
7 |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
8 import os |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
9 import subprocess |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
10 import sys |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
11 |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
12 here = os.path.dirname(os.path.realpath(__file__)) |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
13 |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
14 try: |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
15 import gnupg |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
16 print ("gnupg installed") |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
17 except ImportError: |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
18 print ("gnupg not installed") |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
19 subprocess.check_call(['pip', 'install', 'gnupg']) |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
20 args = [sys.executable] + sys.argv |
9cb40c01c10a
illustrate downloading a package and rerunning via exec
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
21 os.execl(sys.executable, *args) |