22import shutil
33import subprocess as sp
44from pathlib import Path
5- import platform
65
7- from omv .common .inout import inform , trim_path , is_verbose , check_output
8- from omv .engines .engine import OMVEngine , EngineExecutionError
6+ from omv .common .inout import check_output , inform , is_verbose , trim_path
7+ from omv .engines .engine import EngineExecutionError , OMVEngine
98
109
1110class 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
18+ elif shutil .which (JNeuroMLEngine . e_name ) is not None :
19+ jnmlhome = Path (shutil .which (JNeuroMLEngine . e_name )).parent
2020 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" )
21+ jnmlhome = ""
4022
4123 environment_vars = {"JNML_HOME" : jnmlhome }
4224
@@ -45,9 +27,7 @@ def get_environment():
4527 @staticmethod
4628 def get_executable ():
4729 environment_vars = JNeuroMLEngine .get_environment ()
48- jnml = os .path .join (
49- environment_vars ["JNML_HOME" ], "jnml" if os .name != "nt" else "jnml.bat"
50- )
30+ jnml = os .path .join (environment_vars ["JNML_HOME" ], JNeuroMLEngine .e_name )
5131 return jnml
5232
5333 @staticmethod
@@ -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