X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fcreate_preset.py;h=d1dbac68a7d2f7640f68e3e71512411b162453f6;hb=48f658cb2360654d8ae4e17adf660dbea5a9e72e;hp=3928855c7b729c168a45a491e9fc9f593dff97a0;hpb=81e3a60fa8f5d52bddc4c1d536afd5425db89349;p=bertos.git diff --git a/wizard/create_preset.py b/wizard/create_preset.py index 3928855c..d1dbac68 100755 --- a/wizard/create_preset.py +++ b/wizard/create_preset.py @@ -137,19 +137,28 @@ s["BERTOS_PATH"] = bertos_path s["PROJECT_HW_PATH"] = hw_path s["PROJECT_SRC_PATH"] = "." s["PRESET"] = True -pprint.pprint(s) -p = open(preset_dir + "/project.bertos", "w") -pickle.dump(s, p) - -#Create a .spec file in order to make this preset visible in the Wizard -open(preset_dir + "/.spec", "w").write("name = '%s preset'" % pname) +# Calculate relative paths useful to discover where are the sources (and the hw +# files) relatively to the BeRTOS Makefile bertos_path = os.path.abspath(preset_dir + "/" + bertos_path) hw_path = os.path.abspath(preset_dir + "/" + hw_path) src_path = os.path.relpath(preset_dir, bertos_path) hw_path = os.path.relpath(hw_path, bertos_path) +# Src path and hw path relatively to the BeRTOS Makefile. +s["PROJECT_SRC_PATH_FROM_MAKEFILE"] = src_path +s["PROJECT_HW_PATH_FROM_MAKEFILE"] = hw_path +toolchain = s["TOOLCHAIN"]["path"] +s["TOOLCHAIN"]["path"] = os.path.basename(toolchain) + +pprint.pprint(s) +p = open(preset_dir + "/project.bertos", "w") +pickle.dump(s, p) + +#Create a .spec file in order to make this preset visible in the Wizard +open(preset_dir + "/.spec", "w").write("name = '%s preset'" % pname) + #Update project makefiles adapting them to the new directory layout mk = open(preset_dir + "/" + pname + ".mk").read() mk = re.sub(r"(%s_SRC_PATH\s*=\s*).*" % pname, r"\1%s" % src_path, mk)