From acf56b28a111f08df46538d1147e2a299ae20197 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Dec 2016 19:55:19 +0200 Subject: [PATCH] Show vendor version of a package // Resolve #838 --- HISTORY.rst | 2 ++ docs/userguide/platforms/cmd_show.rst | 33 ++++++++++++++------------- platformio/commands/platform.py | 14 ++++++++++++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 0012ae9c..4cd9a10b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -38,6 +38,8 @@ PlatformIO 3.0 (`issue #814 `_) * Improved `Library Dependency Finder (LDF) `__ for circular dependencies +* Show vendor version of a package for `platformio platform show `__ command + (`issue #838 `_) * Fixed issue with ``PATH`` auto-configuring for upload tools * Fixed ``99-platformio-udev.rules`` checker for Linux OS diff --git a/docs/userguide/platforms/cmd_show.rst b/docs/userguide/platforms/cmd_show.rst index 35ec16c3..111f34e5 100644 --- a/docs/userguide/platforms/cmd_show.rst +++ b/docs/userguide/platforms/cmd_show.rst @@ -41,7 +41,7 @@ Examples ==================== Atmel AVR 8- and 32-bit MCUs deliver a unique combination of performance, power efficiency and design flexibility. Optimized to speed time to market-and easily adapt to new ones-they are based on the industrys most code-efficient architecture for C and assembly programming. - Version: 0.0.0 + Version: 1.2.1 Home: http://platformio.org/platforms/atmelavr License: Apache-2.0 Frameworks: simba, arduino @@ -49,40 +49,41 @@ Examples Package toolchain-atmelavr -------------------------- Type: toolchain - Optional: No - Requirements: ~1.40801.0 + Requirements: ~1.40902.0 Installed: Yes Description: avr-gcc - Url: https://gcc.gnu.org/wiki/avr-gcc - Version: 1.40801.0 + Url: http://www.atmel.com/products/microcontrollers/avr/32-bitavruc3.aspx?tab=tools + Version: 1.40902.0 (4.9.2) Package framework-arduinoavr ---------------------------- Type: framework - Optional: Yes - Requirements: ~1.10608.0 - Installed: No (optional) + Requirements: ~1.10612.1 + Installed: Yes + Url: https://www.arduino.cc/en/Main/Software + Version: 1.10612.1 (1.6.12) + Description: Arduino Wiring-based Framework (AVR Core, 1.6) Package framework-simba ----------------------- Type: framework - Optional: Yes - Requirements: ~1.50.0 + Requirements: >=7.0.0 Installed: Yes - Description: framework-simba Url: https://github.com/eerimoq/simba - Version: 1.50.0 + Version: 11.0.0 + Description: Simba Embedded Programming Platform Package tool-avrdude -------------------- Type: uploader - Optional: Yes - Requirements: >=1.60001.0,<=1.60100.0 - Installed: No (optional) + Requirements: ~1.60300.0 + Installed: Yes + Description: AVRDUDE + Url: http://www.nongnu.org/avrdude/ + Version: 1.60300.0 (6.3.0) Package tool-micronucleus ------------------------- Type: uploader - Optional: Yes Requirements: ~1.200.0 Installed: No (optional) diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index 53bb5515..e96a7d79 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -154,6 +154,18 @@ def platform_list(json_output): @cli.command("show", short_help="Show details about installed platform") @click.argument("platform") def platform_show(platform): + + def _detail_version(version): + if version.count(".") != 2: + return version + x, y, z = version.split(".") + if int(y) < 100: + return version + if len(y) % 2 != 0: + y = "0" + y + parts = [str(int(y[i * 2:i * 2 + 2])) for i in range(len(y) / 2)] + return "%s (%s)" % (version, ".".join(parts)) + try: p = PlatformFactory.newPlatform(platform) except exception.UnknownPlatform: @@ -189,4 +201,6 @@ def platform_show(platform): if name in installed_pkgs: for key, value in installed_pkgs[name].items(): if key in ("url", "version", "description"): + if key == "version": + value = _detail_version(value) click.echo("%s: %s" % (key.title(), value))