X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fcreate_preset.py;h=d1dbac68a7d2f7640f68e3e71512411b162453f6;hb=57dfb183e24175bc782647d4e6aebe31063f3881;hp=8cdd662b16fa1d8529e4e98eec6a53ef3cd074ea;hpb=42b2956a7b4b1370ed756c55cac1510b5f475598;p=bertos.git diff --git a/wizard/create_preset.py b/wizard/create_preset.py index 8cdd662b..d1dbac68 100755 --- a/wizard/create_preset.py +++ b/wizard/create_preset.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # encoding: utf-8 # -# This file is part of slimqc. +# This file is part of BeRTOS. # # Bertos is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -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)