Added support for Click 8.0; updated other deps

This commit is contained in:
Ivan Kravets
2021-05-19 19:43:41 +03:00
parent 2be7e0f7e6
commit 27feb1ddd7
9 changed files with 31 additions and 26 deletions

2
docs

Submodule docs updated: 01219b63ed...459f01352a

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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(

View File

@ -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

View File

@ -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)

View File

@ -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.*",