6 os.environ[
'PLUTO_DIR']
8 print 'PLUTO_DIR not defined. Setting it to the Current Directory'
9 pluto_directory = os.getcwd()
12 pluto_directory = os.environ[
'PLUTO_DIR']
14 sys.path.append(pluto_directory +
'/Tools/Python/')
17 from make_problem
import MakeProblem
21 work_dir = os.getcwd()
23 interface_opts = [
'Setup problem',
'Change makefile',
24 'Auto-update',
'Save Setup',
'Quit']
28 interface_optval = interface_opts[-1]
30 while interface_optval != interface_opts[-1]:
31 menu.SetTitle(
"Python setup (Aug 2015)",
"Working dir: "+work_dir+
"\nPLUTO dir : "+pluto_dir)
35 if interface_optval == interface_opts[0]:
36 if not os.path.exists(work_dir+
'/init.c'):
37 shutil.copy(pluto_dir+
'/Src/Templates/init.c',work_dir+
'/init.c')
39 if not os.path.exists(work_dir+
'/pluto.ini'):
40 shutil.copy(pluto_dir+
'/Src/Templates/pluto.ini',work_dir+
'/pluto.ini')
44 if interface_optval == interface_opts[1]:
47 if interface_optval == interface_opts[2]:
50 menu.Print (
"Configuration up to date",sleep=0.75)
53 if interface_optval == interface_opts[3]:
60 if __name__ ==
"__main__":
62 print "\n> Checking system architecture\n"
64 for x
in sys.argv[1:]:
65 if (x ==
"--get-arch"):
69 if (x ==
"--with-chombo" or x ==
"--with-chombo:"):
70 print "Enabling Chombo support for AMR"
71 cmset = set([
'--with-fd',
'--with-sb',
'--with-fargo']) & set(sys.argv)
73 print '! Incompatible modules, ',x,
' + '.join(y
for y
in cmset)
77 elif (x ==
"--with-sb"):
78 print "Enabling support for shearing box module"
79 if '--with-fd' in sys.argv:
80 print '! Incompatible modules, ',x,
' + --with-fd'
83 elif (x ==
"--with-fd"):
84 print "Enabling support for finite difference module"
86 elif (x ==
"--with-fargo"):
87 print "Enabling support for FARGO scheme"
89 elif (x ==
"--no-curses"):
92 elif (x ==
"--auto-update"):
95 elif (x ==
"--help" or x ==
"-help"):
96 print "Usage: python $PLUTO_DIR/setup.py [options]\n"
97 print "Here [options] can be:\n"
98 print " --with-sb enable the shearing box module."
99 print " --with-fd enable the finite difference module."
100 print " --with-fargo enable the FARGO-MHD module"
101 print " --with-chombo enable support for adaptive mesh refinement."
102 print " (AMR) module using the Chombo library."
103 print " --no-curses disable ncurses library and use a"
104 print " simpler text-based menu."
108 print "! Unrecognized option '",x,
"'"
111 print '\n> Loading PLUTO Interface...'