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