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. # limitations under the License.
import json import json
import shutil
import click import click
from tabulate import tabulate from tabulate import tabulate
@ -40,7 +41,7 @@ def cli(query, installed, json_output): # pylint: disable=R0912
grpboards[board["platform"]] = [] grpboards[board["platform"]] = []
grpboards[board["platform"]].append(board) grpboards[board["platform"]].append(board)
terminal_width, _ = click.get_terminal_size() terminal_width, _ = shutil.get_terminal_size()
for (platform, boards) in sorted(grpboards.items()): for (platform, boards) in sorted(grpboards.items()):
click.echo("") click.echo("")
click.echo("Platform: ", nl=False) click.echo("Platform: ", nl=False)

View File

@ -17,6 +17,7 @@
import json import json
import os import os
import shutil
from collections import Counter from collections import Counter
from os.path import dirname, isfile from os.path import dirname, isfile
from time import time from time import time
@ -193,7 +194,7 @@ def print_processing_header(tool, envname, envdump):
"Checking %s > %s (%s)" "Checking %s > %s (%s)"
% (click.style(envname, fg="cyan", bold=True), tool, "; ".join(envdump)) % (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) click.secho("-" * terminal_width, bold=True)

View File

@ -14,6 +14,7 @@
import operator import operator
import os import os
import shutil
from multiprocessing import cpu_count from multiprocessing import cpu_count
from time import time from time import time
@ -200,7 +201,7 @@ def print_processing_header(env, config, verbose=False):
"Processing %s (%s)" "Processing %s (%s)"
% (click.style(env, fg="cyan", bold=True), "; ".join(env_dump)) % (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) click.secho("-" * terminal_width, bold=True)

View File

@ -16,6 +16,7 @@
import fnmatch import fnmatch
import os import os
import shutil
from time import time from time import time
import click import click
@ -192,7 +193,7 @@ def print_processing_header(test, env):
click.style(env, fg="cyan", bold=True), 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) click.secho("-" * terminal_width, bold=True)

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from os import getenv import os
from os.path import join import shutil
from time import time from time import time
import click import click
@ -75,19 +75,19 @@ def on_platformio_exception(e):
def set_caller(caller=None): def set_caller(caller=None):
caller = caller or getenv("PLATFORMIO_CALLER") caller = caller or os.getenv("PLATFORMIO_CALLER")
if caller: if caller:
return app.set_session_var("caller_id", 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" 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" caller = "gitpod"
elif is_container(): elif is_container():
if getenv("C9_UID"): if os.getenv("C9_UID"):
caller = "C9" caller = "C9"
elif getenv("USER") == "cabox": elif os.getenv("USER") == "cabox":
caller = "CA" caller = "CA"
elif getenv("CHE_API", getenv("CHE_API_ENDPOINT")): elif os.getenv("CHE_API", os.getenv("CHE_API_ENDPOINT")):
caller = "Che" caller = "Che"
return app.set_session_var("caller_id", caller) return app.set_session_var("caller_id", caller)
@ -139,7 +139,7 @@ class Upgrader(object):
def after_upgrade(ctx): 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") last_version = app.get_state_item("last_version", "0.0.0")
if last_version == __version__: if last_version == __version__:
return return
@ -204,7 +204,7 @@ def after_upgrade(ctx):
click.style("https://github.com/platformio/platformio", fg="cyan"), click.style("https://github.com/platformio/platformio", fg="cyan"),
) )
) )
if not getenv("PLATFORMIO_IDE"): if not os.getenv("PLATFORMIO_IDE"):
click.echo( click.echo(
"- %s PlatformIO IDE for embedded development > %s" "- %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__): if pepver_to_semver(latest_version) <= pepver_to_semver(__version__):
return return
terminal_width, _ = click.get_terminal_size() terminal_width, _ = shutil.get_terminal_size()
click.echo("") click.echo("")
click.echo("*" * terminal_width) click.echo("*" * terminal_width)
@ -245,10 +245,10 @@ def check_platformio_upgrade():
fg="yellow", fg="yellow",
nl=False, nl=False,
) )
if getenv("PLATFORMIO_IDE"): if os.getenv("PLATFORMIO_IDE"):
click.secho("PlatformIO IDE Menu: Upgrade PlatformIO", fg="cyan", nl=False) click.secho("PlatformIO IDE Menu: Upgrade PlatformIO", fg="cyan", nl=False)
click.secho("`.", fg="yellow") 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("brew update && brew upgrade", fg="cyan", nl=False)
click.secho("` command.", fg="yellow") click.secho("` command.", fg="yellow")
else: else:
@ -288,7 +288,7 @@ def check_internal_updates(ctx, what): # pylint: disable=too-many-branches
if not outdated_items: if not outdated_items:
return return
terminal_width, _ = click.get_terminal_size() terminal_width, _ = shutil.get_terminal_size()
click.echo("") click.echo("")
click.echo("*" * terminal_width) click.echo("*" * terminal_width)
@ -350,7 +350,7 @@ def check_prune_system():
if (unnecessary_size / 1024) < threshold_mb: if (unnecessary_size / 1024) < threshold_mb:
return return
terminal_width, _ = click.get_terminal_size() terminal_width, _ = shutil.get_terminal_size()
click.echo() click.echo()
click.echo("*" * terminal_width) click.echo("*" * terminal_width)
click.secho( click.secho(

View File

@ -17,13 +17,13 @@ import hashlib
import json import json
import os import os
import re import re
import shutil
import sys import sys
import threading import threading
from collections import deque from collections import deque
from time import sleep, time from time import sleep, time
from traceback import format_exc from traceback import format_exc
import click
import requests import requests
from platformio import __version__, app, exception, util from platformio import __version__, app, exception, util
@ -74,7 +74,7 @@ class MeasurementProtocol(TelemetryBase):
self["cid"] = app.get_cid() self["cid"] = app.get_cid()
try: try:
self["sr"] = "%dx%d" % click.get_terminal_size() self["sr"] = "%dx%d" % shutil.get_terminal_size()
except ValueError: except ValueError:
pass pass

View File

@ -19,6 +19,7 @@ import math
import os import os
import platform import platform
import re import re
import shutil
import time import time
from functools import wraps from functools import wraps
from glob import glob 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): 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)) width = len(click.unstyle(label))
half_line = "=" * int((terminal_width - width - 2) / 2) half_line = "=" * int((terminal_width - width - 2) / 2)
click.secho("%s %s %s" % (half_line, label, half_line), fg=fg, err=is_error) 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 = [ minimal_requirements = [
"bottle==0.12.*", "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", "colorama",
"marshmallow%s" % (">=2,<3" if PY2 else ">=2,<4"), "marshmallow%s" % (">=2,<3" if PY2 else ">=2,<4"),
"pyelftools>=0.27,<1", "pyelftools>=0.27,<1",
@ -39,10 +39,10 @@ minimal_requirements = [
] ]
if not PY2: if not PY2:
minimal_requirements.append("zeroconf==0.29.*") minimal_requirements.append("zeroconf==0.31.*")
home_requirements = [ home_requirements = [
"aiofiles==0.6.*", "aiofiles==0.7.*",
"ajsonrpc==1.1.*", "ajsonrpc==1.1.*",
"starlette==0.14.*", "starlette==0.14.*",
"uvicorn==0.13.*", "uvicorn==0.13.*",