浏览代码

Added run_local_modelverse Python script

Yentl Van Tendeloo 9 年之前
父节点
当前提交
8edcac92cf
共有 4 个文件被更改,包括 13 次插入27 次删除
  1. 7 7
      bootstrap/bootstrap.py
  2. 0 7
      run_local_modelverse.bat
  3. 0 13
      run_local_modelverse.sh
  4. 6 0
      scripts/run_local_modelverse.py

+ 7 - 7
bootstrap/bootstrap.py

@@ -199,8 +199,8 @@ class Writer(object):
             self.file_b.write(text)
 
 try:
-    with open("bootstrap.m", "w") as fa:
-        with open("minimal.m", "w") as fb:
+    with open("bootstrap/bootstrap.m", "w") as fa:
+        with open("bootstrap/minimal.m", "w") as fb:
             f = Writer(fa, fb)
             # Create the root first
             f.write("Node root()\n")
@@ -293,10 +293,10 @@ try:
                 sys.path.append("interface/HUTN/")
                 from hutn_compiler.compiler import main as compile_code
 
-                with open("bootstrap.al", "w") as f:
+                with open("bootstrap/bootstrap.al", "w") as f:
                     f.write(code)
-                code = compile_code("bootstrap.al", "interface/HUTN/grammars/actionlanguage.g", "BS", ["--debug"])
-                os.remove("bootstrap.al")
+                code = compile_code("bootstrap/bootstrap.al", "interface/HUTN/grammars/actionlanguage.g", "BS", ["--debug"])
+                os.remove("bootstrap/bootstrap.al")
                 return code.replace("auto_initial_IP", target)
 
             # Create code for initial user
@@ -316,6 +316,6 @@ try:
             f.write("Edge _user_IP(__hierarchy, IP_new)\n", both=False)
             f.write("Edge __user_IP(_user_IP, __IP_str)\n", both=False)
 except:
-    os.remove("bootstrap.m")
-    os.remove("minimal.m")
+    os.remove("bootstrap/bootstrap.m")
+    os.remove("bootstrap/minimal.m")
     raise

+ 0 - 7
run_local_modelverse.bat

@@ -1,7 +0,0 @@
-set port=%1
-cd hybrid_server
-python python_sccd_compiler\sccdc.py -p threads server.xml
-
-python run_mvk_server.py %port%
-cd ..
-pause

+ 0 - 13
run_local_modelverse.sh

@@ -1,13 +0,0 @@
-#!/bin/bash
-set -e
-trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
-
-port=$1
-source library.sh
-
-echo "Compiling MvK server"
-cd hybrid_server
-${python} python_sccd_compiler/sccdc.py -p threads server.xml
-
-echo "Starting MvK"
-${python} run_mvk_server.py $port

+ 6 - 0
scripts/run_local_modelverse.py

@@ -0,0 +1,6 @@
+import subprocess
+import sys
+
+# sys.executable to use the same Python interpreter used to invoke this command
+subprocess.check_call([sys.executable, "python_sccd_compiler/sccdc.py", "-p", "threads", "server.xml"], cwd="hybrid_server")
+subprocess.call([sys.executable, "run_mvk_server.py", sys.argv[1]], cwd="hybrid_server")