Skip to content

Commit bff7fd9

Browse files
author
Christopher Doris
committed
allow exe option to be found in the path
1 parent 1232ce6 commit bff7fd9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pysrc/juliacall/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ def path_option(name, default=None, check_exists=False, **kw):
9696
raise ValueError(f'{s}: path does not exist')
9797
return os.path.abspath(path), s
9898
return default, s
99+
100+
def executable_option(name, default=None, **kw):
101+
import shutil
102+
_path, s = option(name, **kw)
103+
if _path is not None:
104+
path = shutil.which(_path)
105+
if path is None:
106+
raise ValueError(f'{s}: executable not found')
107+
return os.path.abspath(path), s
108+
return default, s
99109

100110
def int_option(name, *, accept_auto=False, **kw):
101111
val, s = option(name, **kw)
@@ -148,7 +158,7 @@ def args_from_config(config):
148158
CONFIG['opt_startup_file'] = choice('startup_file', ['yes', 'no'])[0]
149159
CONFIG['opt_heap_size_hint'] = option('heap_size_hint')[0]
150160
CONFIG['project'] = path_option('project', check_exists=True)[0]
151-
CONFIG['exepath'] = path_option('exe', check_exists=True)[0]
161+
CONFIG['exepath'] = executable_option('exe')[0]
152162

153163
# Stop if we already initialised
154164
if CONFIG['inited']:

0 commit comments

Comments
 (0)