From 99270f8f255b37c9acc07f056f8b433bc117c55e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 4 Jun 2018 14:10:58 +0300 Subject: [PATCH] Use upcoming "checkprogsize" target from PIO Core 3.6 to update max upload size --- builder/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/builder/main.py b/builder/main.py index c6ce54a..9b0b786 100644 --- a/builder/main.py +++ b/builder/main.py @@ -218,7 +218,14 @@ AlwaysBuild(env.Alias("nobuild", target_firm)) target_buildprog = env.Alias("buildprog", target_firm, target_firm) # update max upload size based on CSV file -if set(["checkprogsize", "upload"]) & set(COMMAND_LINE_TARGETS): +if env.get("PIOMAINPROG"): + env.AddPreAction( + "checkprogsize", + env.VerboseAction( + lambda source, target, env: _update_max_upload_size(env), + "Retrieving maximum program size $SOURCES")) +# remove after PIO Core 3.6 release +elif set(["checkprogsize", "upload"]) & set(COMMAND_LINE_TARGETS): _update_max_upload_size(env) #