From: duplo Date: Tue, 16 Nov 2010 13:59:15 +0000 (+0000) Subject: Add support for #183 fix in preset creation. X-Git-Tag: 2.7.0~379 X-Git-Url: https://codewiz.org/gitweb?p=bertos.git;a=commitdiff_plain;h=72dfeaad6330cf262e4f1b0d5680c90a85de3b76 Add support for #183 fix in preset creation. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4557 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/create_preset.py b/wizard/create_preset.py index 3928855c..e2c818ac 100755 --- a/wizard/create_preset.py +++ b/wizard/create_preset.py @@ -137,19 +137,26 @@ 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 + +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)