Correct a little bug about empty configurations
[bertos.git] / wizard / bertos_utils.py
index 933d9ed5175fec2bfe8fd5a12fac10a96a93533e..4a17beb91eb209ab914dab8e96356b4a395adb11 100644 (file)
@@ -52,9 +52,10 @@ def createBertosProject(project_info):
     cfgdir = prjdir + "/cfg"
     shutil.rmtree(cfgdir, True)
     os.mkdir(cfgdir)
-    for key, value in project_info.info("CONFIGURATIONS").items():
-        string = open(sources_dir + "/" + key, "r").read()
-        for parameter, infos in value.items():
+    for configuration, information in project_info.info("CONFIGURATIONS").items():
+        string = open(sources_dir + "/" + configuration, "r").read()
+        for start, parameter in information["paramlist"]:
+            infos = information[parameter]
             value = infos["value"]
             if "type" in infos["informations"] and infos["informations"]["type"] == "autoenabled":
                 value = "1"
@@ -63,7 +64,7 @@ def createBertosProject(project_info):
             if "long" in infos["informations"].keys() and infos["informations"]["long"]:
                 value += "L"
             string = sub(string, parameter, value)
-        f = open(cfgdir + "/" + os.path.basename(key), "w")
+        f = open(cfgdir + "/" + os.path.basename(configuration), "w")
         f.write(string)
         f.close()
     ## Destinatio mk file
@@ -442,9 +443,11 @@ def loadConfigurationInfos(path):
             "value_list": the name of the enum for enum parameters
     """
     configuration_infos = {}
+    configuration_infos["paramlist"] = []
     for comment, define, start in getDefinitionBlocks(open(path, "r").read()):
         name, value = formatParamNameValue(define)
         brief, description, informations = getDescriptionInformations(comment)
+        configuration_infos["paramlist"].append((start, name))
         configuration_infos[name] = {}
         configuration_infos[name]["value"] = value
         configuration_infos[name]["informations"] = informations