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>`_) (`issue #814 <https://github.com/platformio/platformio/issues/814>`_)
* Improved `Library Dependency Finder (LDF) <http://docs.platformio.org/en/stable/librarymanager/ldf.html>`__ * Improved `Library Dependency Finder (LDF) <http://docs.platformio.org/en/stable/librarymanager/ldf.html>`__
for circular dependencies 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 issue with ``PATH`` auto-configuring for upload tools
* Fixed ``99-platformio-udev.rules`` checker for Linux OS * 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. 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 Home: http://platformio.org/platforms/atmelavr
License: Apache-2.0 License: Apache-2.0
Frameworks: simba, arduino Frameworks: simba, arduino
@ -49,40 +49,41 @@ Examples
Package toolchain-atmelavr Package toolchain-atmelavr
-------------------------- --------------------------
Type: toolchain Type: toolchain
Optional: No Requirements: ~1.40902.0
Requirements: ~1.40801.0
Installed: Yes Installed: Yes
Description: avr-gcc Description: avr-gcc
Url: https://gcc.gnu.org/wiki/avr-gcc Url: http://www.atmel.com/products/microcontrollers/avr/32-bitavruc3.aspx?tab=tools
Version: 1.40801.0 Version: 1.40902.0 (4.9.2)
Package framework-arduinoavr Package framework-arduinoavr
---------------------------- ----------------------------
Type: framework Type: framework
Optional: Yes Requirements: ~1.10612.1
Requirements: ~1.10608.0 Installed: Yes
Installed: No (optional) 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 Package framework-simba
----------------------- -----------------------
Type: framework Type: framework
Optional: Yes Requirements: >=7.0.0
Requirements: ~1.50.0
Installed: Yes Installed: Yes
Description: framework-simba
Url: https://github.com/eerimoq/simba Url: https://github.com/eerimoq/simba
Version: 1.50.0 Version: 11.0.0
Description: Simba Embedded Programming Platform
Package tool-avrdude Package tool-avrdude
-------------------- --------------------
Type: uploader Type: uploader
Optional: Yes Requirements: ~1.60300.0
Requirements: >=1.60001.0,<=1.60100.0 Installed: Yes
Installed: No (optional) Description: AVRDUDE
Url: http://www.nongnu.org/avrdude/
Version: 1.60300.0 (6.3.0)
Package tool-micronucleus Package tool-micronucleus
------------------------- -------------------------
Type: uploader Type: uploader
Optional: Yes
Requirements: ~1.200.0 Requirements: ~1.200.0
Installed: No (optional) Installed: No (optional)

View File

@ -154,6 +154,18 @@ def platform_list(json_output):
@cli.command("show", short_help="Show details about installed platform") @cli.command("show", short_help="Show details about installed platform")
@click.argument("platform") @click.argument("platform")
def platform_show(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: try:
p = PlatformFactory.newPlatform(platform) p = PlatformFactory.newPlatform(platform)
except exception.UnknownPlatform: except exception.UnknownPlatform:
@ -189,4 +201,6 @@ def platform_show(platform):
if name in installed_pkgs: if name in installed_pkgs:
for key, value in installed_pkgs[name].items(): for key, value in installed_pkgs[name].items():
if key in ("url", "version", "description"): if key in ("url", "version", "description"):
if key == "version":
value = _detail_version(value)
click.echo("%s: %s" % (key.title(), value)) click.echo("%s: %s" % (key.title(), value))