Skip to content

Commit 1126b56

Browse files
author
Christopher Doris
committed
robustly get default bindir [skip ci]
1 parent ca70baf commit 1126b56

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pysrc/juliacall/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ def args_from_config():
137137

138138
# Find the Julia library
139139
cmd = [exepath, '--project='+project, '--startup-file=no', '-O0', '--compile=min',
140-
'-e', 'import Libdl; print(abspath(Libdl.dlpath("libjulia")))']
141-
CONFIG['libpath'] = libpath = subprocess.run(cmd, check=True, capture_output=True, encoding='utf8').stdout
140+
'-e', 'import Libdl; print(abspath(Libdl.dlpath("libjulia")), "\\0", Sys.BINDIR)']
141+
libpath, default_bindir = subprocess.run(cmd, check=True, capture_output=True, encoding='utf8').stdout.split('\0')
142142
assert os.path.exists(libpath)
143+
assert os.path.exists(default_bindir)
144+
CONFIG['libpath'] = libpath
143145

144146
# Initialise Julia
145147
d = os.getcwd()
@@ -164,7 +166,7 @@ def args_from_config():
164166
jl_init.argtypes = [c.c_char_p, c.c_char_p]
165167
jl_init.restype = None
166168
jl_init(
167-
(os.path.dirname(exepath) if bindir is None else bindir).encode('utf8'),
169+
(default_bindir if bindir is None else bindir).encode('utf8'),
168170
None if sysimg is None else sysimg.encode('utf8'),
169171
)
170172

0 commit comments

Comments
 (0)