33
44from omv .engines .utils .wdir import working_dir
55from sysconfig import get_paths
6- import sys
7-
8- import fileinput
96
107
11- def install_xpp (version = 'latest' ):
128
13- if version is None :
14- version = 'latest'
15- elif not version == 'latest' :
16- raise Exception ('Can currently only install the latest XPP version' )
9+ def install_xpp (version = "latest" ):
10+ if version is None :
11+ version = "latest"
12+ elif not version == "latest" :
13+ raise Exception ("Can currently only install the latest XPP version" )
1714
1815 inform ("Installing XPP" , indent = 2 , verbosity = 1 )
1916 xppinstallpath = os .path .join (os .environ ["HOME" ])
20- xpphomepath = os .path .join (xppinstallpath , ' xppaut' )
17+ xpphomepath = os .path .join (xppinstallpath , " xppaut" )
2118
2219 inform (
2320 "Installing XPP to: %s" % (xpphomepath ),
@@ -27,56 +24,27 @@ def install_xpp(version='latest'):
2724 pypaths = get_paths ()
2825 inform ("Python lib info: %s" % (pypaths ), indent = 2 , verbosity = 1 )
2926
30-
3127 with working_dir (xppinstallpath ):
32- print (
33- check_output (
34- [
35- "git" ,
36- "clone" ,
37- "https://github.com/NeuroML/xppaut"
38- ]
39- )
40- )
28+ print (check_output (["git" , "clone" , "https://github.com/NeuroML/xppaut" ]))
4129
4230 with working_dir (xpphomepath ):
43- print (
44- check_output (
45- [
46- "ls" ,
47- "-alth"
48- ]
49- )
50- )
31+ print (check_output (["ls" , "-alth" ]))
32+
33+ makefile = os .path .join (xpphomepath , "Makefile" )
5134
52- makefile = os .path .join (xpphomepath , 'Makefile' )
53-
54- print (' - Replacing text in %s' % makefile )
55- with open (makefile , 'r' ) as file :
35+ print (" - Replacing text in %s" % makefile )
36+ with open (makefile , "r" ) as file :
5637 filedata = file .read ()
5738
5839 # Replace the target string
59- filedata = filedata .replace ("/usr/local/" , "%s/" % xpphomepath )
40+ filedata = filedata .replace ("/usr/local/" , "%s/" % xpphomepath )
6041
6142 # Write the file out again
62- with open (makefile , 'w' ) as file :
43+ with open (makefile , "w" ) as file :
6344 file .write (filedata )
6445
65- print (
66- check_output (
67- [
68- "make" , "-j4"
69- ]
70- )
71- )
72- print (
73- check_output (
74- [
75- "make" , "install"
76- ]
77- )
78- )
79-
46+ print (check_output (["make" , "-j4" ]))
47+ print (check_output (["make" , "install" ]))
8048
8149
8250if __name__ == "__main__" :
0 commit comments