Skip to content

Commit 8c4a621

Browse files
committed
Improve output in non verbose mode
1 parent 1e39f33 commit 8c4a621

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

builder/main.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import re
2222
from os.path import join
2323

24-
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
25-
DefaultEnvironment)
24+
from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild,
25+
Builder, Default, DefaultEnvironment)
2626

2727

2828
def _get_flash_size(env):
@@ -151,7 +151,7 @@ def _get_board_f_flash(env):
151151
ASFLAGS=env.get("CCFLAGS", [])[:]
152152
)
153153

154-
if not env.GetOption("silent"):
154+
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
155155
env.Prepend(UPLOADERFLAGS=["-vv"])
156156

157157

@@ -189,14 +189,14 @@ def _fetch_spiffs_size(target, source, env):
189189
env.Append(
190190
BUILDERS=dict(
191191
DataToBin=Builder(
192-
action=" ".join([
192+
action=env.VerboseAction(" ".join([
193193
'"$MKSPIFFSTOOL"',
194194
"-c", "$SOURCES",
195195
"-p", "${int(SPIFFS_PAGE, 16)}",
196196
"-b", "${int(SPIFFS_BLOCK, 16)}",
197197
"-s", "${int(SPIFFS_END, 16) - int(SPIFFS_START, 16)}",
198198
"$TARGET"
199-
]),
199+
]), "Building SPIFFS image from '$SOURCES' directory to $TARGET"),
200200
emitter=_fetch_spiffs_size,
201201
source_factory=env.Dir,
202202
suffix=".bin"
@@ -223,7 +223,7 @@ def _fetch_spiffs_size(target, source, env):
223223

224224
BUILDERS=dict(
225225
ElfToBin=Builder(
226-
action=" ".join([
226+
action=env.VerboseAction(" ".join([
227227
'"$OBJCOPY"',
228228
"-eo",
229229
'"%s"' % join("$FRAMEWORK_ARDUINOESP8266_DIR",
@@ -241,7 +241,7 @@ def _fetch_spiffs_size(target, source, env):
241241
"-bs", ".data",
242242
"-bs", ".rodata",
243243
"-bc", "-ec"
244-
]),
244+
]), "Building $TARGET"),
245245
suffix=".bin"
246246
)
247247
)
@@ -270,7 +270,7 @@ def _fetch_spiffs_size(target, source, env):
270270

271271
BUILDERS=dict(
272272
ElfToBin=Builder(
273-
action=" ".join([
273+
action=env.VerboseAction(" ".join([
274274
'"$OBJCOPY"',
275275
"-eo", "$SOURCES",
276276
"-bo", "${TARGETS[0]}",
@@ -284,7 +284,7 @@ def _fetch_spiffs_size(target, source, env):
284284
"-eo", "$SOURCES",
285285
"-es", ".irom0.text", "${TARGETS[1]}",
286286
"-ec", "-v"
287-
]),
287+
]), "Building $TARGET"),
288288
suffix=".bin"
289289
)
290290
)
@@ -345,7 +345,9 @@ def _fetch_spiffs_size(target, source, env):
345345
# Target: Print binary size
346346
#
347347

348-
target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
348+
target_size = env.Alias(
349+
"size", target_elf,
350+
env.VerboseAction("$SIZEPRINTCMD", "Calculating size $SOURCE"))
349351
AlwaysBuild(target_size)
350352

351353
#
@@ -354,7 +356,8 @@ def _fetch_spiffs_size(target, source, env):
354356

355357
target_upload = env.Alias(
356358
["upload", "uploadlazy", "uploadfs"], target_firm,
357-
[env.AutodetectUploadPort, "$UPLOADCMD"])
359+
[env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."),
360+
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")])
358361
env.AlwaysBuild(target_upload)
359362

360363
#

0 commit comments

Comments
 (0)