Skip to content

Commit

Permalink
Update remote_bootstrap.py to Python3
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniogi authored Sep 30, 2024
1 parent cffe6f0 commit 9034cc8
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/extra/remote_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,32 @@

import sys
import os
import commands
import subprocess

def main(argv):
try:
commands.getoutput("cp -rf ../../../../external/DKES/* .")
subprocess.getoutput("cp -rf ../../../../external/DKES/* .")
inputFile = "input.tj0"
if (not os.path.lexists("xvmec2000")):
commands.getoutput("ln -s ../../../../external/xvmec2000 xvmec2000")
#commands.getoutput ("./xvmec2000 " + inputFile)
if (not os.path.exists('wout_tj0.txt')):
if not os.path.lexists("xvmec2000"):
subprocess.getoutput("ln -s ../../../../external/xvmec2000 xvmec2000")
# subprocess.getoutput("./xvmec2000 " + inputFile)
if not os.path.exists('wout_tj0.txt'):
return
if (not os.path.exists('threed1.tj0')):
if not os.path.exists('threed1.tj0'):
return
commands.getoutput('mv wout_tj0.txt INPUT/wout_DAB_0.0.txt')
commands.getoutput('mv threed1.tj0 INPUT/threed1.DAB_0.0')
subprocess.getoutput('mv wout_tj0.txt INPUT/wout_DAB_0.0.txt')
subprocess.getoutput('mv threed1.tj0 INPUT/threed1.DAB_0.0')
print('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f2 -d=| cut -f 1 -d"(" > temp.1')
commands.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f2 -d=| cut -f 1 -d"(" > temp.1')
commands.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f1 -d= > temp.2')
commands.getoutput('paste temp.1 temp.2 > radius.dat')
subprocess.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f2 -d=| cut -f 1 -d"(" > temp.1')
subprocess.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f1 -d= > temp.2')
subprocess.getoutput('paste temp.1 temp.2 > radius.dat')
print("source EXE/dab.sh")
out = commands.getoutput("source EXE/dab.sh")
out = subprocess.getoutput("source EXE/dab.sh")
print(out)
commands.getoutput("source EXE/recoge_res.sh")
subprocess.getoutput("source EXE/recoge_res.sh")

except Exception, e:
print("remote_bootstrap " + str(sys.exc_traceback.tb_lineno) + " " + str(e))
except Exception as e:
print("remote_bootstrap " + str(sys.exc_info()[2].tb_lineno) + " " + str(e))

if __name__ == "__main__":
main(sys.argv[1:])

0 comments on commit 9034cc8

Please sign in to comment.