Skip to content

Commit 36f24bf

Browse files
committed
Clean up osh parser code
1 parent d78c8da commit 36f24bf

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

shellwhat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.2.0"
1+
__version__ = "1.2.1"

shellwhat/parsers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class OshNode(AstNode):
99
def get_text(self, full_text=None):
1010
if self.text:
1111
return self.text
12-
else:
13-
raise RuntimeError("The parser wasn't able to match text to this node")
12+
raise RuntimeError("The parser wasn't able to match text to this node")
1413

1514
def get_position(self):
1615
return self.position
@@ -21,6 +20,10 @@ class OshParser(AstModule):
2120

2221
@classmethod
2322
def parse(cls, code, strict=True):
23+
shared_libs_mount_point = os.environ.get(
24+
"SHARED_PYTHON_PATH", "/var/lib/python/site-packages"
25+
)
26+
PYTHONPATH = "{}/python2".format(shared_libs_mount_point)
2427
try:
2528
res = check_output(
2629
PARSER_OSH_STUB + [code],
@@ -66,7 +69,6 @@ def parse(cls, *args, **kwargs):
6669
# Determine which parser to use and how it is called.
6770
# By default, the DummyParser is used.
6871
parse_opt = os.environ.get("SHELLWHAT_PARSER", "osh")
69-
PYTHONPATH = "/var/lib/python/site-packages/python2"
7072
if parse_opt == "osh":
7173
DEFAULT_PARSER = OshParser
7274
PARSER_OSH_STUB = ["python2", "-m", "osh"]

0 commit comments

Comments
 (0)