Skip to content

Commit

Permalink
tools, Documentation: Adjust pyjailhouse import boilerplate documenta…
Browse files Browse the repository at this point in the history
…tion

Move the comment when local imports must have happened before the line
that prevent them. Also fix the Python syntax in the example boilerplate
code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information
jan-kiszka committed Sep 9, 2018
1 parent c122226 commit d84d30b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
7 changes: 3 additions & 4 deletions Documentation/pyjailhouse.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ For the example, the following wouldn't work inside of boz.py:
**Boilerplate code, with sys.path[0] warning** **Boilerplate code, with sys.path[0] warning**


` `
# Imports from directory containing this must be done before the following
sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "" sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + ""
from pyjailhouse import from pyjailhouse import *
# Imports from directory containing this must be done above `
# import statement, see python documentation on sys.path[0]
`
3 changes: 1 addition & 2 deletions tools/jailhouse-cell-linux
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ import os
import struct import struct
import sys import sys


# Imports from directory containing this must be done before the following
sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.." sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.."
from pyjailhouse.cell import JailhouseCell from pyjailhouse.cell import JailhouseCell
# Imports from directory containing this must be done above
# import statement, see python documentation on sys.path[0]


libexecdir = None libexecdir = None


Expand Down
3 changes: 1 addition & 2 deletions tools/jailhouse-config-create
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ except ImportError:
print("This script requires the mako library to run.") print("This script requires the mako library to run.")
sys.exit(1) sys.exit(1)


# Imports from directory containing this must be done before the following
sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.." sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.."
import pyjailhouse.sysfs_parser as sysfs_parser import pyjailhouse.sysfs_parser as sysfs_parser
# Imports from directory containing this must be done above
# import statement, see python documentation on sys.path[0]


datadir = None datadir = None


Expand Down
3 changes: 1 addition & 2 deletions tools/jailhouse-hardware-check
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ import os
import struct import struct
import sys import sys


# Imports from directory containing this must be done before the following
sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.." sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.."
import pyjailhouse.sysfs_parser as sysfs_parser import pyjailhouse.sysfs_parser as sysfs_parser
# Imports from directory containing this must be done above
# import statement, see python documentation on sys.path[0]


# just a dummy to make python2 happy # just a dummy to make python2 happy
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
Expand Down

0 comments on commit d84d30b

Please sign in to comment.