Skip to content

Commit 99ed5ca

Browse files
committed
feat: use jnml from PyNeuroML
Depends on: NeuroML/pyNeuroML#450
1 parent f347645 commit 99ed5ca

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

omv/engines/getjnml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
def install_jnml(version):
11+
"""Install JNeuroML from GitHub tar."""
1112
if not version:
1213
version = "v0.14.0"
1314

omv/engines/jneuroml.py

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,21 @@
22
import shutil
33
import subprocess as sp
44
from pathlib import Path
5-
import platform
65

76
from omv.common.inout import inform, trim_path, is_verbose, check_output
87
from omv.engines.engine import OMVEngine, EngineExecutionError
98

109

1110
class JNeuroMLEngine(OMVEngine):
1211
name = "jNeuroML"
12+
e_name = "jnml"
1313

1414
@staticmethod
1515
def get_environment():
1616
if "JNML_HOME" in os.environ:
1717
jnmlhome = os.environ["JNML_HOME"]
18-
elif shutil.which("jnml") is not None:
19-
jnmlhome = Path(shutil.which("jnml")).parent
20-
else:
21-
osname = platform.system()
22-
if osname == "Linux":
23-
try:
24-
jnmlhome = os.path.join(
25-
os.environ["XDG_DATA_HOME"], "jnml/jNeuroMLJar"
26-
)
27-
except KeyError:
28-
localsharepath = os.path.join(os.environ["HOME"], ".local/share")
29-
if os.path.isdir(localsharepath):
30-
jnmlhome = os.path.join(
31-
os.environ["HOME"], ".local/share/jnml/jNeuroMLJar"
32-
)
33-
else:
34-
jnmlhome = os.path.join(os.environ["HOME"], "jnml/jNeuroMLJar")
35-
36-
elif osname == "Darwin":
37-
jnmlhome = os.path.join(os.environ["HOME"], "Library/jnml/jNeuroMLJar")
38-
else:
39-
jnmlhome = os.path.join(os.environ["HOME"], "jnml/jNeuroMLJar")
18+
elif shutil.which(JNeuroMLEngine.e_name) is not None:
19+
jnmlhome = Path(shutil.which(JNeuroMLEngine.e_name)).parent
4020

4121
environment_vars = {"JNML_HOME": jnmlhome}
4222

@@ -46,7 +26,7 @@ def get_environment():
4626
def get_executable():
4727
environment_vars = JNeuroMLEngine.get_environment()
4828
jnml = os.path.join(
49-
environment_vars["JNML_HOME"], "jnml" if os.name != "nt" else "jnml.bat"
29+
environment_vars["JNML_HOME"], JNeuroMLEngine.e_name if os.name != "nt" else "jnml.bat"
5030
)
5131
return jnml
5232

@@ -59,7 +39,6 @@ def is_installed():
5939
"Checking whether %s is installed..." % JNeuroMLEngine.name,
6040
indent=1,
6141
)
62-
FNULL = open(os.devnull, "w")
6342
jnml = JNeuroMLEngine.get_executable()
6443
r = check_output(
6544
[jnml, "-v"], verbosity=2, env=JNeuroMLEngine.get_environment()
@@ -76,10 +55,10 @@ def is_installed():
7655

7756
@staticmethod
7857
def install(version):
79-
from omv.engines.getjnml import install_jnml
58+
from omv.engines.getpyneuroml import install_pynml
8059

81-
inform("Will fetch and install jNeuroML jar", indent=2)
82-
install_jnml(version)
60+
inform("Will install PyNeuroML for jnml", indent=2)
61+
install_pynml(version)
8362

8463
if not JNeuroMLEngine.is_installed():
8564
inform("Failure to install, exiting", indent=1)

0 commit comments

Comments
 (0)