Skip to content

Commit 3005681

Browse files
committed
force runtime computation of library path
Signed-off-by: Michael Greenberg <[email protected]>
1 parent 5d68587 commit 3005681

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

libdash/parser.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@
44
from .ast import of_node
55
from ._dash import *
66

7-
FILE_PATH = os.path.dirname(os.path.realpath(os.path.abspath(__file__)))
8-
LIBDASH_LIBRARY_PATH = os.path.join(FILE_PATH, "libdash.so")
97

8+
LIBDASH_LIBRARY_PATH = None
9+
def libdash_library_path():
10+
global LIBDASH_LIBRARY_PATH
11+
12+
if LIBDASH_LIBRARY_PATH is not None:
13+
return LIBDASH_LIBRARY_PATH
14+
15+
FILE_PATH = os.path.dirname(os.path.realpath(os.path.abspath(__file__)))
16+
LIBDASH_LIBRARY_PATH = os.path.join(FILE_PATH, "libdash.so")
17+
return LIBDASH_LIBRARY_PATH
18+
1019
EOF_NLEFT = -99; # libdash/src/input.c
1120

1221
class ParsingException(Exception):
@@ -23,7 +32,7 @@ def parse(inputPath, init=True):
2332
"""
2433
lines = []
2534

26-
libdash = CDLL(LIBDASH_LIBRARY_PATH)
35+
libdash = CDLL(libdash_library_path())
2736

2837
if (init):
2938
initialize(libdash)

0 commit comments

Comments
 (0)