Skip to content

Commit 2a23166

Browse files
committed
feat: look for jnml in standard places
1 parent 21e730b commit 2a23166

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

omv/engines/jneuroml.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import os
2+
import shutil
23
import subprocess as sp
4+
from pathlib import Path
5+
import platform
36

47
from omv.common.inout import inform, trim_path, is_verbose, check_output
58
from omv.engines.engine import OMVEngine, EngineExecutionError
@@ -14,8 +17,19 @@ def get_environment():
1417

1518
if 'JNML_HOME' in os.environ:
1619
jnmlhome = os.environ['JNML_HOME']
20+
elif shutil.which("jnml") is not None:
21+
jnmlhome = Path(shutil.which("jnml")).parent
1722
else:
18-
jnmlhome = os.path.join(os.environ['HOME'],'jnml/jNeuroMLJar')
23+
osname = platform.system()
24+
if osname == "Linux":
25+
try:
26+
jnmlhome = os.path.join(os.environ['XDG_DATA_HOME'],'jnml/jNeuroMLJar')
27+
except KeyError as e:
28+
jnmlhome = os.path.join(os.environ['HOME'],'.local/share/jnml/jNeuroMLJar')
29+
elif osname == "Darwin":
30+
jnmlhome = os.path.join(os.environ['HOME'],'Library/jnml/jNeuroMLJar')
31+
else:
32+
jnmlhome = os.path.join(os.environ['HOME'],'jnml/jNeuroMLJar')
1933

2034
environment_vars = {'JNML_HOME': jnmlhome}
2135

0 commit comments

Comments
 (0)