From 18442c7e57ddd53a5485f67ee9e1f4bbce4368fc Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 9 Aug 2021 16:27:22 +0200 Subject: [PATCH] next try for IDF 4.4 map file building #12837 @arendst @sillyfrog give it a try. I am a Python noob... The `map_name` generating is problematic. Better would be to use last entry of the string `src_dir`. --- pio-tools/name-firmware.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pio-tools/name-firmware.py b/pio-tools/name-firmware.py index e82857d1e..53376db8b 100644 --- a/pio-tools/name-firmware.py +++ b/pio-tools/name-firmware.py @@ -1,4 +1,5 @@ Import('env') +Import('projenv') import os import shutil @@ -31,7 +32,21 @@ def bin_map_copy(source, target, env): if os.path.isfile("firmware.map"): shutil.move("firmware.map", map_file) - map_new_loc = str(target[0]).split(os.path.sep)[0] + os.path.sep + str(target[0]).split(os.path.sep)[1] + os.path.sep + str(target[0]).split(os.path.sep)[2] + os.path.sep + "Tasmota.map" + #map_new_loc = str(target[0]).split(os.path.sep)[0] + os.path.sep + str(target[0]).split(os.path.sep)[1] + os.path.sep + str(target[0]).split(os.path.sep)[2] + os.path.sep + "Tasmota.map" + # PIO env variables see: https://github.com/platformio/platformio-core/blob/develop/platformio/builder/main.py#L108:L128 + proj_build_dir = env["PROJECT_BUILD_DIR"] + #build_dir = env["BUILD_DIR"] + pio_env = env["PIOENV"] + src_dir = env["PROJECT_SRC_DIR"] + map_name = str(src_dir).split(os.path.sep)[2] + map_new_loc = proj_build_dir + os.path.sep + pio_env + os.path.sep + map_name + ".map" + #print("proj_build_dir: {}".format(proj_build_dir)) + #print("pioenv: {}".format(pio_env)) + #print("src_dir: {}".format(src_dir)) + #print("build_dir: {}".format(build_dir)) + #print("map_name: {}".format(map_name)) + #print("map_new_loc: {}".format(map_new_loc)) + # move Tasmota.map to map/.map if os.path.isfile(map_new_loc): shutil.move(map_new_loc, map_file)