mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Improve output in non verbose mode
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
|
||||
import sys
|
||||
|
||||
VERSION = (3, 0, "0a12")
|
||||
VERSION = (3, 0, "0a13")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -19,8 +19,8 @@ from os import environ
|
||||
from os.path import join, normpath
|
||||
from time import time
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AllowSubstExceptions,
|
||||
DefaultEnvironment, Progress, Variables)
|
||||
from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS,
|
||||
AllowSubstExceptions, DefaultEnvironment, Variables)
|
||||
|
||||
from platformio import util
|
||||
|
||||
@ -65,7 +65,7 @@ commonvars.AddVariables(
|
||||
("UPLOAD_RESETMETHOD",)
|
||||
) # yapf: disable
|
||||
|
||||
DefaultEnvironment(
|
||||
DEFAULT_ENV_OPTIONS = dict(
|
||||
tools=[
|
||||
"ar", "as", "gcc", "g++", "gnulink",
|
||||
"platformio", "pioplatform", "piowinhooks",
|
||||
@ -93,11 +93,15 @@ DefaultEnvironment(
|
||||
],
|
||||
PYTHONEXE=normpath(sys.executable))
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
if env.GetOption("silent"):
|
||||
if not int(ARGUMENTS.get("PIOVERBOSE", 0)):
|
||||
print "Verbose mode can be enabled via `-v, --verbose` option"
|
||||
Progress(env.ProgressHandler)
|
||||
DEFAULT_ENV_OPTIONS['ARCOMSTR'] = "Archiving $TARGET"
|
||||
DEFAULT_ENV_OPTIONS['LINKCOMSTR'] = "Linking $TARGET"
|
||||
DEFAULT_ENV_OPTIONS['RANLIBCOMSTR'] = "Indexing $TARGET"
|
||||
for k in ("ASPPCOMSTR", "CCCOMSTR", "CXXCOMSTR"):
|
||||
DEFAULT_ENV_OPTIONS[k] = "Compiling $TARGET"
|
||||
|
||||
env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS)
|
||||
|
||||
# decode common variables
|
||||
for k in commonvars.keys():
|
||||
|
@ -22,6 +22,7 @@ from os.path import basename, commonprefix, isdir, isfile, join, realpath, sep
|
||||
from platform import system
|
||||
|
||||
import SCons.Scanner
|
||||
from SCons.Script import ARGUMENTS
|
||||
|
||||
from platformio import util
|
||||
from platformio.builder.tools import platformio as piotool
|
||||
@ -465,7 +466,8 @@ def GetLibBuilders(env):
|
||||
f.lower().strip() for f in env.get("PIOFRAMEWORK", "").split(",")
|
||||
]
|
||||
compat_mode = int(env.get("LIB_COMPAT_MODE", 1))
|
||||
verbose = not (env.GetOption("silent") or env.GetOption('clean'))
|
||||
verbose = (int(ARGUMENTS.get("PIOVERBOSE", 0)) and
|
||||
not env.GetOption('clean'))
|
||||
|
||||
def _check_lib_builder(lb):
|
||||
if lb.name in env.get("LIB_IGNORE", []):
|
||||
@ -528,7 +530,7 @@ def BuildDependentLibraries(env, src_dir):
|
||||
title = "<%s>" % lb.name
|
||||
if lb.version:
|
||||
title += " v%s" % lb.version
|
||||
if not env.GetOption("silent"):
|
||||
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
|
||||
title += " (%s)" % lb.path
|
||||
print "%s|-- %s" % (margin, title)
|
||||
if lb.depbuilders:
|
||||
|
@ -21,6 +21,9 @@ from glob import glob
|
||||
from os import environ, remove
|
||||
from os.path import isfile, join
|
||||
|
||||
from SCons.Action import Action
|
||||
from SCons.Script import ARGUMENTS
|
||||
|
||||
from platformio import util
|
||||
|
||||
|
||||
@ -259,13 +262,11 @@ def GetActualLDScript(env):
|
||||
return None
|
||||
|
||||
|
||||
def ProgressHandler(env, node):
|
||||
item = str(node)
|
||||
if "toolchain-" in item or "tool-" in item or \
|
||||
item.endswith((".o", ".h", ".hpp", ".ipp")):
|
||||
return
|
||||
item = item.replace(env['PIOHOME_DIR'], ".platformio")
|
||||
print "Processing %s" % item
|
||||
def VerboseAction(env, act, actstr):
|
||||
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
|
||||
return act
|
||||
else:
|
||||
return Action(act, actstr)
|
||||
|
||||
|
||||
def exists(_):
|
||||
@ -277,5 +278,5 @@ def generate(env):
|
||||
env.AddMethod(DumpIDEData)
|
||||
env.AddMethod(GetCompilerType)
|
||||
env.AddMethod(GetActualLDScript)
|
||||
env.AddMethod(ProgressHandler)
|
||||
env.AddMethod(VerboseAction)
|
||||
return env
|
||||
|
@ -83,7 +83,6 @@ def WaitForNewSerialPort(env, before):
|
||||
|
||||
def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
||||
env = args[0]
|
||||
print "Looking for upload port/disk..."
|
||||
|
||||
def _look_for_mbed_disk():
|
||||
msdlabels = ("mbed", "nucleo", "frdm", "microbit")
|
||||
@ -110,7 +109,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
||||
return port
|
||||
|
||||
if "UPLOAD_PORT" in env:
|
||||
print env.subst("Manually specified: $UPLOAD_PORT")
|
||||
print env.subst("Use manually specified: $UPLOAD_PORT")
|
||||
return
|
||||
|
||||
if env.subst("$PIOFRAMEWORK") == "mbed":
|
||||
@ -131,13 +130,13 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
||||
sys.stderr.write(
|
||||
"Error: Please specify `upload_port` for environment or use "
|
||||
"global `--upload-port` option.\n"
|
||||
"For some development platforms this can be a USB flash "
|
||||
"For some development platforms it can be a USB flash "
|
||||
"drive (i.e. /media/<user>/<device name>)\n")
|
||||
env.Exit(1)
|
||||
|
||||
|
||||
def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621
|
||||
env.AutodetectUploadPort()
|
||||
assert "UPLOAD_PORT" in env
|
||||
progname = env.subst("$PROGNAME")
|
||||
for ext in ("bin", "hex"):
|
||||
fpath = join(env.subst("$BUILD_DIR"), "%s.%s" % (progname, ext))
|
||||
@ -156,7 +155,6 @@ def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621
|
||||
if max_size == 0 or "SIZETOOL" not in env:
|
||||
return
|
||||
|
||||
print "Check program size..."
|
||||
sysenv = environ.copy()
|
||||
sysenv['PATH'] = str(env['ENV']['PATH'])
|
||||
cmd = [env.subst("$SIZETOOL"), "-B", str(target[0])]
|
||||
|
@ -20,6 +20,7 @@ from glob import glob
|
||||
from os import sep, walk
|
||||
from os.path import basename, dirname, isdir, join, realpath
|
||||
|
||||
from SCons.Action import Action
|
||||
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript
|
||||
from SCons.Util import case_sensitive_suffixes
|
||||
|
||||
@ -97,7 +98,8 @@ def BuildProgram(env):
|
||||
join("$BUILD_DIR", env.subst("$PROGNAME")), env['PIOBUILDFILES'])
|
||||
|
||||
if set(["upload", "uploadlazy", "program"]) & set(COMMAND_LINE_TARGETS):
|
||||
env.AddPostAction(program, env.CheckUploadSize)
|
||||
env.AddPostAction(program, Action(env.CheckUploadSize,
|
||||
"Checking program size $TARGET"))
|
||||
|
||||
return program
|
||||
|
||||
|
@ -27,7 +27,6 @@ from platformio.downloader import FileDownloader
|
||||
from platformio.unpacker import FileUnpacker
|
||||
from platformio.vcsclient import VCSClientFactory
|
||||
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
|
||||
|
@ -276,8 +276,7 @@ class PlatformRunMixin(object):
|
||||
"-j %d" % self.get_job_nums(), "--warn=no-no-parallel-support",
|
||||
"-f", join(util.get_source_dir(), "builder", "main.py")
|
||||
]
|
||||
if not self.verbose and "-c" not in targets:
|
||||
cmd.append("--silent")
|
||||
cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0))
|
||||
cmd += targets
|
||||
|
||||
# encode and append variables
|
||||
|
Reference in New Issue
Block a user