8 from argparse
import ArgumentParser
11 parser = ArgumentParser()
12 parser.add_argument(
"config_file")
13 parser.add_argument(
"--id", nargs=
'?', default=
"tmp")
14 args = parser.parse_args()
16 output_dir = os.path.abspath(
"tmp")
20 from sumatra.projects
import load_project
21 output_dir = os.path.join(os.path.abspath(load_project().data_store.root), args.id)
25 current_path = os.path.dirname(os.path.realpath(__file__))
27 if not os.path.exists(output_dir):
28 os.makedirs(output_dir)
30 config_file = os.path.abspath(argv[1])
32 output_file = os.path.join(output_dir, os.path.split(config_file)[-1])
34 build_path = os.path.abspath(os.path.join(current_path,
"..",
"..",
"build-app"))
35 project_path = os.path.abspath(os.path.join(current_path,
".."))
37 if not os.path.exists(build_path):
38 os.makedirs(build_path)
39 devnull = open(
'/dev/null',
'w')
40 subprocess.call([
"qmake", project_path,
"CONFIG+=nogui CONFIG+=notests CONFIG+=notools"], cwd=build_path, stdout=devnull)
41 subprocess.call([
"make",
"-j",
"8"], cwd=build_path, stdout=devnull)
43 app_path = os.path.join(build_path,
"app")
44 lib_path = os.path.join(build_path,
"src")
46 env = dict(os.environ)
47 env[
'LD_LIBRARY_PATH'] = lib_path
49 run_argument = [
"./hartree-fock", config_file, output_dir]
50 proc = subprocess.call(run_argument, cwd=app_path, env=env)