diff --git a/docs b/docs index 01219b63..459f0135 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 01219b63ed20f829f6dc92a60adaa88ee1fc32b8 +Subproject commit 459f01352ae3eea3b5adfab9ff389f45768fc4ce diff --git a/platformio/commands/boards.py b/platformio/commands/boards.py index f93607d4..b51103ca 100644 --- a/platformio/commands/boards.py +++ b/platformio/commands/boards.py @@ -13,6 +13,7 @@ # limitations under the License. import json +import shutil import click from tabulate import tabulate @@ -40,7 +41,7 @@ def cli(query, installed, json_output): # pylint: disable=R0912 grpboards[board["platform"]] = [] grpboards[board["platform"]].append(board) - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() for (platform, boards) in sorted(grpboards.items()): click.echo("") click.echo("Platform: ", nl=False) diff --git a/platformio/commands/check/command.py b/platformio/commands/check/command.py index 082373f3..2d4bb109 100644 --- a/platformio/commands/check/command.py +++ b/platformio/commands/check/command.py @@ -17,6 +17,7 @@ import json import os +import shutil from collections import Counter from os.path import dirname, isfile from time import time @@ -193,7 +194,7 @@ def print_processing_header(tool, envname, envdump): "Checking %s > %s (%s)" % (click.style(envname, fg="cyan", bold=True), tool, "; ".join(envdump)) ) - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() click.secho("-" * terminal_width, bold=True) diff --git a/platformio/commands/run/command.py b/platformio/commands/run/command.py index db4b4121..5684f119 100644 --- a/platformio/commands/run/command.py +++ b/platformio/commands/run/command.py @@ -14,6 +14,7 @@ import operator import os +import shutil from multiprocessing import cpu_count from time import time @@ -200,7 +201,7 @@ def print_processing_header(env, config, verbose=False): "Processing %s (%s)" % (click.style(env, fg="cyan", bold=True), "; ".join(env_dump)) ) - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() click.secho("-" * terminal_width, bold=True) diff --git a/platformio/commands/test/command.py b/platformio/commands/test/command.py index bc503093..c4b90499 100644 --- a/platformio/commands/test/command.py +++ b/platformio/commands/test/command.py @@ -16,6 +16,7 @@ import fnmatch import os +import shutil from time import time import click @@ -192,7 +193,7 @@ def print_processing_header(test, env): click.style(env, fg="cyan", bold=True), ) ) - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() click.secho("-" * terminal_width, bold=True) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 3ef47015..ba370032 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os import getenv -from os.path import join +import os +import shutil from time import time import click @@ -75,19 +75,19 @@ def on_platformio_exception(e): def set_caller(caller=None): - caller = caller or getenv("PLATFORMIO_CALLER") + caller = caller or os.getenv("PLATFORMIO_CALLER") if caller: return app.set_session_var("caller_id", caller) - if getenv("VSCODE_PID") or getenv("VSCODE_NLS_CONFIG"): + if os.getenv("VSCODE_PID") or os.getenv("VSCODE_NLS_CONFIG"): caller = "vscode" - elif getenv("GITPOD_INSTANCE_ID") or getenv("GITPOD_WORKSPACE_URL"): + elif os.getenv("GITPOD_INSTANCE_ID") or os.getenv("GITPOD_WORKSPACE_URL"): caller = "gitpod" elif is_container(): - if getenv("C9_UID"): + if os.getenv("C9_UID"): caller = "C9" - elif getenv("USER") == "cabox": + elif os.getenv("USER") == "cabox": caller = "CA" - elif getenv("CHE_API", getenv("CHE_API_ENDPOINT")): + elif os.getenv("CHE_API", os.getenv("CHE_API_ENDPOINT")): caller = "Che" return app.set_session_var("caller_id", caller) @@ -139,7 +139,7 @@ class Upgrader(object): def after_upgrade(ctx): - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() last_version = app.get_state_item("last_version", "0.0.0") if last_version == __version__: return @@ -204,7 +204,7 @@ def after_upgrade(ctx): click.style("https://github.com/platformio/platformio", fg="cyan"), ) ) - if not getenv("PLATFORMIO_IDE"): + if not os.getenv("PLATFORMIO_IDE"): click.echo( "- %s PlatformIO IDE for embedded development > %s" % ( @@ -235,7 +235,7 @@ def check_platformio_upgrade(): if pepver_to_semver(latest_version) <= pepver_to_semver(__version__): return - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() click.echo("") click.echo("*" * terminal_width) @@ -245,10 +245,10 @@ def check_platformio_upgrade(): fg="yellow", nl=False, ) - if getenv("PLATFORMIO_IDE"): + if os.getenv("PLATFORMIO_IDE"): click.secho("PlatformIO IDE Menu: Upgrade PlatformIO", fg="cyan", nl=False) click.secho("`.", fg="yellow") - elif join("Cellar", "platformio") in fs.get_source_dir(): + elif os.path.join("Cellar", "platformio") in fs.get_source_dir(): click.secho("brew update && brew upgrade", fg="cyan", nl=False) click.secho("` command.", fg="yellow") else: @@ -288,7 +288,7 @@ def check_internal_updates(ctx, what): # pylint: disable=too-many-branches if not outdated_items: return - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() click.echo("") click.echo("*" * terminal_width) @@ -350,7 +350,7 @@ def check_prune_system(): if (unnecessary_size / 1024) < threshold_mb: return - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() click.echo() click.echo("*" * terminal_width) click.secho( diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 6ca60b0f..94c4222a 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -17,13 +17,13 @@ import hashlib import json import os import re +import shutil import sys import threading from collections import deque from time import sleep, time from traceback import format_exc -import click import requests from platformio import __version__, app, exception, util @@ -74,7 +74,7 @@ class MeasurementProtocol(TelemetryBase): self["cid"] = app.get_cid() try: - self["sr"] = "%dx%d" % click.get_terminal_size() + self["sr"] = "%dx%d" % shutil.get_terminal_size() except ValueError: pass diff --git a/platformio/util.py b/platformio/util.py index 1d7c8655..8ab144a4 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -19,6 +19,7 @@ import math import os import platform import re +import shutil import time from functools import wraps from glob import glob @@ -269,7 +270,7 @@ def merge_dicts(d1, d2, path=None): def print_labeled_bar(label, is_error=False, fg=None): - terminal_width, _ = click.get_terminal_size() + terminal_width, _ = shutil.get_terminal_size() width = len(click.unstyle(label)) half_line = "=" * int((terminal_width - width - 2) / 2) click.secho("%s %s %s" % (half_line, label, half_line), fg=fg, err=is_error) diff --git a/setup.py b/setup.py index af921b76..a520931c 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ from platformio.compat import PY2, WINDOWS minimal_requirements = [ "bottle==0.12.*", - "click>=5,<8%s" % (",!=7.1,!=7.1.1" if WINDOWS else ""), + "click>=5,<9%s" % (",!=7.1,!=7.1.1" if WINDOWS else ""), "colorama", "marshmallow%s" % (">=2,<3" if PY2 else ">=2,<4"), "pyelftools>=0.27,<1", @@ -39,10 +39,10 @@ minimal_requirements = [ ] if not PY2: - minimal_requirements.append("zeroconf==0.29.*") + minimal_requirements.append("zeroconf==0.31.*") home_requirements = [ - "aiofiles==0.6.*", + "aiofiles==0.7.*", "ajsonrpc==1.1.*", "starlette==0.14.*", "uvicorn==0.13.*",