Browse Source

Consistently create the same bootstrap file across platforms (Windows/Linux)

Yentl Van Tendeloo 5 years ago
parent
commit
08ddb3905b
2 changed files with 2 additions and 5 deletions
  1. BIN
      bootstrap/bootstrap.m.gz
  2. 2 5
      bootstrap/bootstrap.py

BIN
bootstrap/bootstrap.m.gz


+ 2 - 5
bootstrap/bootstrap.py

@@ -182,10 +182,9 @@ def bootstrap():
                 total_alc = []
                 binding_alc = 'Void function initialize_MMs():\n\tinitialize_SCD("models/SimpleClassDiagrams")\n'
 
-                bootstrap_models = sorted(glob.glob("bootstrap/*.mvc"))
+                bootstrap_models = sorted([i.replace("\\", "/") for i in glob.glob("bootstrap/*.mvc")])
                 for bootstrap_model in bootstrap_models:
                     # Compile the subfile
-                    bootstrap_model = bootstrap_model.replace("\\", "/")
                     model_name = bootstrap_model.rsplit(".mvc", 1)[0].rsplit("/", 1)[1]
                     print("[MVC] %s" % model_name)
                     alc = compile_code_MO(bootstrap_model, model_name)
@@ -202,11 +201,10 @@ def bootstrap():
                     mm.write(new_metamodels_alc)
 
                 # Compile all files and add to structure manually
-                bootstrap_files = sorted(glob.glob("bootstrap/*.alc") + glob.glob("bootstrap/.*.alc"))
+                bootstrap_files = sorted([i.replace("\\", "/") for i in (glob.glob("bootstrap/*.alc") + glob.glob("bootstrap/.*.alc"))])
                 all_code = ""
                 for bootstrap_file in bootstrap_files:
                     # Compile the subfile
-                    bootstrap_file = bootstrap_file.replace("\\", "/")
                     print("[ALC] %s" % bootstrap_file)
                     all_code += "".join([i.replace(" = ?\n", "\n") for i in open(bootstrap_file, 'r').readlines() if not i.startswith("include ")])
                     f.write(compile_code_AL(bootstrap_file, "initial_IP", prepend=bootstrap_file, main=bootstrap_file==main_file), both=False)
@@ -230,7 +228,6 @@ def bootstrap():
 
                 first = True
                 for bootstrap_file in [primitive_file] + [i for i in bootstrap_files if i not in [main_file, primitive_file]]:
-                    bootstrap_file = bootstrap_file.replace("\\", "/")
                     f.write('Node _if_%s(if)\n' % counter, both=False)
                     f.write('Dict (_if_%s, "cond", true)\n' % counter, both=False)
                     f.write('Dict (_if_%s, "then", %s_initial_IP)\n' % (counter, bootstrap_file), both=False)