forked from platformio/platformio-core
Allow to disable progress bar for package/library downloader and uploader
This commit is contained in:
@ -18,8 +18,8 @@ PlatformIO 2.0
|
||||
and allowed to `change default upload reset method <http://docs.platformio.org/en/latest/platforms/espressif.html#custom-reset-method>`_
|
||||
for Espressif development platform
|
||||
(`issue #444 <https://github.com/platformio/platformio/issues/444>`_)
|
||||
* Allowed to force output of color ANSI-codes even if the output is a ``pipe``
|
||||
(not a ``tty``)
|
||||
* Allowed to force output of color ANSI-codes or to disable progress bar even
|
||||
if the output is a ``pipe`` (not a ``tty``) using `Environment variables <http://docs.platformio.org/en/latest/envvars.html>`__
|
||||
(`issue #465 <https://github.com/platformio/platformio/issues/465>`_)
|
||||
* Set 1Mb SPIFFS for Espressif boards by default
|
||||
(`issue #458 <https://github.com/platformio/platformio/issues/458>`_)
|
||||
|
@ -34,16 +34,21 @@ operations/commands.
|
||||
PlatformIO handles ``CI`` variable which is setup by
|
||||
`Continuous Integration <http://en.wikipedia.org/wiki/Continuous_integration>`_
|
||||
(Travis, Circle and etc.) systems.
|
||||
Currently, PlatformIO uses it to disable prompts.
|
||||
|
||||
In other words, ``CI=true`` automatically setup
|
||||
:envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=false <PLATFORMIO_SETTING_ENABLE_PROMPTS>`.
|
||||
PlatformIO uses it to disable prompts and progress bars. In other words,
|
||||
``CI=true`` automatically setup :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS` to
|
||||
``false`` and :envvar:`PLATFORMIO_DISABLE_PROGRESSBAR` to ``true``.
|
||||
|
||||
.. envvar:: PLATFORMIO_FORCE_COLOR
|
||||
|
||||
Force to output color ANSI-codes even if the output is a ``pipe`` (not a ``tty``).
|
||||
The possible values are ``true`` and ``false``. Default is ``PLATFORMIO_FORCE_COLOR=false``.
|
||||
|
||||
.. envvar:: PLATFORMIO_DISABLE_PROGRESSBAR
|
||||
|
||||
Disable progress bar for package/library downloader and uploader. This is
|
||||
useful when calling PlatformIO from subprocess and output is a ``pipe`` (not a ``tty``).
|
||||
The possible values are ``true`` and ``false``. Default is ``PLATFORMIO_DISABLE_PROGRESSBAR=false``.
|
||||
|
||||
.. envvar:: PLATFORMIO_HOME_DIR
|
||||
|
||||
Allows to override :ref:`projectconf` option :ref:`projectconf_pio_home_dir`.
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import sys
|
||||
|
||||
VERSION = (2, 8, "0.dev0")
|
||||
VERSION = (2, 8, "0.dev1")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -183,3 +183,10 @@ def get_session_var(name, default=None):
|
||||
def set_session_var(name, value):
|
||||
assert name in SESSION_VARS
|
||||
SESSION_VARS[name] = value
|
||||
|
||||
|
||||
def is_disabled_progressbar():
|
||||
# tmp hook
|
||||
if get_session_var("caller_id") == "atom":
|
||||
return True
|
||||
return is_ci() or getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true"
|
||||
|
@ -114,7 +114,10 @@ class InoToCPPConverter(object):
|
||||
def ConvertInoToCpp(env):
|
||||
|
||||
def delete_tmpcpp_file(file_):
|
||||
remove(file_)
|
||||
try:
|
||||
remove(file_)
|
||||
except WindowsError:
|
||||
pass
|
||||
|
||||
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
|
||||
env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
|
||||
|
@ -20,7 +20,7 @@ from time import mktime
|
||||
import click
|
||||
import requests
|
||||
|
||||
from platformio import util
|
||||
from platformio import app, util
|
||||
from platformio.exception import (FDSHASumMismatch, FDSizeMismatch,
|
||||
FDUnrecognizedStatusCode)
|
||||
|
||||
@ -63,7 +63,7 @@ class FileDownloader(object):
|
||||
f = open(self._destination, "wb")
|
||||
chunks = int(ceil(self.get_size() / float(self.CHUNK_SIZE)))
|
||||
|
||||
if util.is_ci():
|
||||
if app.is_disabled_progressbar():
|
||||
click.echo("Downloading...")
|
||||
for _ in range(0, chunks):
|
||||
f.write(next(itercontent))
|
||||
|
@ -20,7 +20,7 @@ from zipfile import ZipFile
|
||||
|
||||
import click
|
||||
|
||||
from platformio import util
|
||||
from platformio import app, util
|
||||
from platformio.exception import UnsupportedArchiveType
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ class FileUnpacker(object):
|
||||
raise UnsupportedArchiveType(archpath)
|
||||
|
||||
def start(self):
|
||||
if util.is_ci():
|
||||
if app.is_disabled_progressbar():
|
||||
click.echo("Unpacking...")
|
||||
for item in self._unpacker.get_items():
|
||||
self._unpacker.extract_item(item, self._dest_dir)
|
||||
|
Reference in New Issue
Block a user