From 55d4fc23d076b8a2318e9a6fb387aa46e9dc5586 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 27 Dec 2017 16:02:36 +0200 Subject: [PATCH] Use "path" instead of "device" for logical devices --- docs | 2 +- platformio/builder/tools/pioupload.py | 10 +++++----- platformio/commands/device.py | 4 ++-- platformio/util.py | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs b/docs index 8486fccd..0403f687 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8486fccd5043005ce8de7607cc814d6a619959a5 +Subproject commit 0403f687d6bca4f40a3e8ed2cfc2c635fc198516 diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 2d75c6a9..ab7b27ca 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -108,17 +108,17 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument def _look_for_mbed_disk(): msdlabels = ("mbed", "nucleo", "frdm", "microbit") for item in util.get_logical_devices(): - if item['device'].startswith("/net") or not _is_match_pattern( - item['device']): + if item['path'].startswith("/net") or not _is_match_pattern( + item['path']): continue mbed_pages = [ - join(item['device'], n) for n in ("mbed.htm", "mbed.html") + join(item['path'], n) for n in ("mbed.htm", "mbed.html") ] if any([isfile(p) for p in mbed_pages]): - return item['device'] + return item['path'] if item['name'] \ and any([l in item['name'].lower() for l in msdlabels]): - return item['device'] + return item['path'] return None def _look_for_serial_port(): diff --git a/platformio/commands/device.py b/platformio/commands/device.py index 5d71c223..877b62e6 100644 --- a/platformio/commands/device.py +++ b/platformio/commands/device.py @@ -70,8 +70,8 @@ def device_list( # pylint: disable=too-many-branches if key == "logical": for item in value: - click.secho(item['device'], fg="cyan") - click.echo("-" * len(item['device'])) + click.secho(item['path'], fg="cyan") + click.echo("-" * len(item['path'])) click.echo("Name: %s" % item['name']) click.echo("") diff --git a/platformio/util.py b/platformio/util.py index 419fbd1c..a1c16b95 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -458,7 +458,7 @@ def get_logical_devices(): if not match: continue items.append({ - "device": match.group(1) + "\\", + "path": match.group(1) + "\\", "name": match.group(2) }) return items @@ -467,7 +467,7 @@ def get_logical_devices(): # try "fsutil" result = exec_command(["fsutil", "fsinfo", "drives"]).get("out", "") for device in re.findall(r"[A-Z]:\\", result): - items.append({"device": device, "name": None}) + items.append({"path": device, "name": None}) return items else: result = exec_command(["df"]).get("out") @@ -477,7 +477,7 @@ def get_logical_devices(): if not match: continue items.append({ - "device": match.group(1), + "path": match.group(1), "name": basename(match.group(1)) }) return items @@ -486,7 +486,7 @@ def get_logical_devices(): ### Backward compatibility for PIO Core <3.5 get_serialports = get_serial_ports get_logicaldisks = lambda: [{ - "disk": d['device'], + "disk": d['path'], "name": d['name'] } for d in get_logical_devices()]