Show vendor version of a package // Resolve #838

This commit is contained in:
Ivan Kravets
2016-12-02 19:55:19 +02:00
parent 25c979a8ee
commit acf56b28a1
3 changed files with 33 additions and 16 deletions

View File

@ -38,6 +38,8 @@ PlatformIO 3.0
(`issue #814 <https://github.com/platformio/platformio/issues/814>`_)
* Improved `Library Dependency Finder (LDF) <http://docs.platformio.org/en/stable/librarymanager/ldf.html>`__
for circular dependencies
* Show vendor version of a package for `platformio platform show <http://docs.platformio.org/en/stable/userguide/platforms/cmd_show.html>`__ command
(`issue #838 <https://github.com/platformio/platformio/issues/838>`_)
* Fixed issue with ``PATH`` auto-configuring for upload tools
* Fixed ``99-platformio-udev.rules`` checker for Linux OS

View File

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

View File

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