From fcfdc5c206e96ffd8acfd46163250e64e4fc0997 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 27 Jun 2017 00:05:23 +0300 Subject: [PATCH 01/70] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 58574c07..7db6a665 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 58574c074149656f1cfc5290122251ea6a5344c6 +Subproject commit 7db6a665218f69f74fc24b2188995af5a2c573d9 From 2695c985a44658898f3c0cbbd32e9c3eb960f181 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 27 Jun 2017 01:03:26 +0300 Subject: [PATCH 02/70] Remove platforms related history from the Core --- HISTORY.rst | 303 ---------------------------------------------------- 1 file changed, 303 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9f73d3cd..10db7362 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -62,75 +62,6 @@ PlatformIO 3.0 custom user name and SSH port (`issue #925 `_) -------- - -* Development platform `Atmel AVR `__ - - + ATTiny Support (1634, x313, x4, x41, x5, x61, x7, x8) - (`issue #47 `__) - + New boards: Dwenguino, nicai-systems BOB3 coding bot, NIBO 2 robot, - NIBObee robot - + AVRDude TCP upload port (``net:host:port``) - (`pull #45 `_) - + Fixed uploading for LowPowerLab Moteino - -* Development platform `Atmel SAM `__ - - + Support for `PIO Unified Debugger `__ - + Added support for MKRFox1200 board - + Updated Arduino SAMD Core to 1.6.14 - + Updated mbed framework to 5.4.5/142 - + Fixed firmware uploading Arduino Zero and USB-native boards - -* Development platform `Espressif 32 `__ - - + New boards: Adafruit Feather, FireBeetle-ESP32, IntoRobot Fig, NodeMCU-32S, Onehorse ESP32 Dev Module, and Widora AIR - + Added support for OTA (Over-The-Air) updates - + Updated ESP-IDF framework to v2.0 - + Updated core for Arduino framework - -* Development platform `Freescale Kinetis `__ - - + Support for `PIO Unified Debugger `__ - + Updated mbed framework to 5.4.5/142 - -* Development platform `Nordic nRF51 `__ - - + Support for `PIO Unified Debugger `__ - + Updated mbed framework to 5.4.5/142 - -* Development platform `NXP LPC `__ - - + Support for `PIO Unified Debugger `__ - + Updated mbed framework to 5.4.5/142 - -* Development platform `Silicon Labs EFM32 `__ - - + Support for `PIO Unified Debugger `__ - + Updated mbed framework to 5.4.5/142 - -* Development platform `ST STM32 `__ - - + Support for `PIO Unified Debugger `__ - + Added support for new boards: ST STM32F0308DISCOVERY - + Updated ``tool-stlink`` to v1.3.1 - + Updated mbed framework to 5.4.5/142 - -* Development platform `Teensy `__ - - + Updated Teensy Loader CLI to v21 - + Updated Arduino Core to v1.36 - + Updated mbed framework to 5.4.5/142 - -* Development platform `TI MSP430 `__ - - + Support for `PIO Unified Debugger `__ - -* Development platform `TI TIVA `__ - - + Support for `PIO Unified Debugger `__ - - 3.3.1 (2017-05-27) ~~~~~~~~~~~~~~~~~~ @@ -177,88 +108,6 @@ PlatformIO 3.0 * Fixed package installing with VCS branch for Python 2.7.3 (`issue #885 `_) - -------- - -* Development platform `Atmel AVR `__ - - + New boards: EnviroDIY Mayfly, The Things Uno, SparkFun Qduino Mini, - SparkFun ATmega128RFA1 Dev Board, SparkFun Serial 7-Segment Display, - Generic ATTiny2313 and ATTiny4313 - + Set fuse bits with new target named ``fuses`` - (`issue #865 `_) - + Updated Arduino Core to 1.6.17 - + Fixed ISO C99 warning for EnviroDIY Mayfly board - + Fixed firmware uploading to Arduino Leonardo - -* Development platform `Atmel SAM `__ - - + Added support for Adafruit Circuit Playground Express, Arduino MKRZero, - Atmel ATSAMW25-XPRO boards - + Added support for ARM mbed events library - + Updated ARM mbed OS to 5.3.6/rev137 - + Updated Arduino SAM & SAMD Core to 1.6.11 - -* Development platform `Espressif 32 `__ - - + Added support for Simba & Pumbaa Frameworks - + Added new boards: Node32s, Hornbill ESP32 Dev, Hornbill ESP32 Minim - + Updated Arduino Core - + Updated ESP-IDF framework to the latest v2.0 Release Candidate 1 - + New ESP IDF examples: BLE, Coap Server, Peripherals UART, Storage SDCard - -* Development platform `Freescale Kinetis `__ - - + Added support for ARM mbed events library - + Updated ARM mbed OS to 5.3.6/rev137 - -* Development platform `Lattice iCE40 `__ - - + Improved path management for Windows - + Custom uploader using ``$UPLOAD`` build variable - (`issue #6 `__) - + Updated toolchain-icestorm to 1.10.0 (added -C option to "time" target) - + Updated toolchain-iverilog to 1.1.0 (loaed all vlib/\*.v files in "iverilog" builder) - -* Development platform `Linux ARM `__ - - + Added support for Samsung ARTIK boards (520, 530, 710, 1020) and ARTIK SDK - (`issue #353 `_) - -* Development platform `Nordic nRF51 `__ - - + Added support for ARM mbed events library - + Updated ARM mbed OS to 5.3.6/rev137 - -* Development platform `NXP LPC `__ - - + Added support for LPCXpresso4337 and y5 LPC11U35 mbug boards - + Added support for ARM mbed events library - + Updated ARM mbed OS to 5.3.6/rev137 - -* Development platform `Silicon Labs EFM32 `__ - - + Added support for ARM mbed events library - + Updated ARM mbed OS to 5.3.6/rev137 - -* Development platform `ST STM32 `__ - - + Added support for new boards: Espotel LoRa Module, NAMote72, MTS Dragonfly, - ST Nucleo F303ZE, u-blox EVK-ODIN-W2, MultiTech xDot - + Added support for ARM mbed events library - + Updated ARM mbed OS to 5.3.6/rev137 - -* Development platform `Teensy `__ - - + Added support for ARM mbed events library - + Updated ARM mbed OS to 5.3.6/rev137 - + Updated Arduino Core to v1.35 - -* Development platform `TI TIVA `__ - - + Updated Energia Core to 1.0.2 - - 3.2.1 (2016-12-07) ~~~~~~~~~~~~~~~~~~ @@ -323,93 +172,6 @@ PlatformIO 3.0 * Fixed issue with ``PATH`` auto-configuring for upload tools * Fixed ``99-platformio-udev.rules`` checker for Linux OS -------- - -* Development platform `Atmel AVR `__ - - + Added support for SODAQ AVR boards - (`issue #796 `__) - + Added support for Pololu A-Star boards - (`issue #804 `__) - + Added support for Altair board - (`issue #15 `__) - + Added support for ATmega328PB MCUs - + Updated Atmel AVR toolchain to GCC 4.9.2 - + Updated Arduino Core for LightBlue Bean/LightBlue Bean+ boards - + Handle "micronucleus" tool base on upload protocol - (`issue #18 `__) - + Fixed programming of ATtiny boards when "micronucleus" uploader is used - (`issue #13 `__) - -* Development platform `Atmel SAM `__ - - + Added support for SODAQ SAMD boards - (`issue #796 `__) - + Updated ARM mbed OS to 5.1.4/rev126 - + Fixed issue with uploading to Arduino Zero on programming USB port - (`issue #805 `__) - -* Development platform `Espressif 32 `__ - - * Initial support for Espressif IDF and Arduino for ESP32 - -* Development platform `Espressif 8266 `__ - - + Added support for ESPrectro board - + Additional target "buildfs" to accompany "uploadfs" - (`issue #6 `__) - -* Development platform `Freescale Kinetis `__ - - + Updated ARM mbed OS to 5.1.4/rev126 - -* Development platform `Microchip PIC32 `__ - - + Add support for MikroElektronika Clicker 2 board - + Updated ChipKIT Core to v1.3.1 - + Updated Microchip PIC32 GCC-based toolchain and "pic32prog" tool - -* Development platform `Nordic nRF51 `__ - - + Added BBC micro:bit B(S130) board - (`issue #3 `__) - + Updated ARM mbed OS to 5.1.4/rev126 - + Fixed “undefined reference to `_sbrk’” error for RFDuino - (`issue #1 `__) - -* Development platform `NXP LPC `__ - - + Updated ARM mbed OS to 5.1.4/rev126 - -* Development platform `Silicon Labs EFM32 `__ - - + Updated ARM mbed OS to 5.1.4/rev126 - -* Development platform `ST STM32 `__ - - + Added support for Maple Mini Original and Maple Mini Bootloader 2.0 - (`issue #22 `__) - + Added support for new boards: ST 32F769IDISCOVERY - + Updated ARM mbed OS to 5.1.4/rev126 - + Use ``serial`` protocol by default for STM32Duino-based boards - (`issue #14 `__) - + Fixed linker error "undefined reference to _sbrk" for STM32Duino - (`issue #10 `__) - -* Development platform `Teensy `__ - - + Updated Arduino Framework for Teensy to v131 - + Updated ARM mbed OS to 5.1.4/rev126 - + Added support for Teensy Audio feature (``build_flags = -D USB_AUDIO``) - -* Development platform `TI MSP430 `__ - - + Upgrade development platform with the latest GCC toolchains and Energia - framework - (`issue #1 `__, - `issue #2 `__, - `issue #3 `__) - 3.1.0 (2016-09-19) ~~~~~~~~~~~~~~~~~~ @@ -428,48 +190,6 @@ PlatformIO 3.0 * Fixed SSL Server-Name-Indication for Python < 2.7.9 (`issue #774 `_) -------- - -* Development platform `Espressif 8266 `__ - - + Add support for `SparkFun Blynk Board `_ - + Created `staging `__ - branch to work with development version of Arduino Framework - -* Development platform `Freescale Kinetis `__ - - + Added support for new boards: FRDM-KL26Z, FRDM-KL27Z, FRDM-KL43Z, Hexiwear - -* Development platform `Nordic nRF51 `__ - - + Added support for new boards: Seeed Arch BLE, Seeed Arch Link, Switch - Science mbed TY51822r3, y5 nRF51822 mbug, JKSoft Wallbot BLE - -* Development platform `NXP LPC `__ - - + Added support for new boards: ARM mbed LPC11U24 (+CAN), Bambino-210E, - CoCo-ri-Co!, DipCortex M3, LPCXpresso11U68, LPCXpresso824-MAX, mBuino, - MicroNFCBoard, NXP LPC11C24, NXP LPC11U34, EA LPC11U35 QuickStart Board, - NXP LPC11U37, NXP LPC2368, NXP LPC2460, NXP LPC800-MAX, Seeed Arch GPRS V2, - Seeed Xadow M0, Smeshlink xbed LPC1768, Switch Science mbed LPC824 - -* Development platform `ST STM32 `__ - - + New Arduino framework for ST STM32 - - `STM32Duino `__. - Supported boards: BluePill F103C8, Generic STM32F103C8, Generic STM32F103R8, - Generic STM32F103RB, Generic STM32F103RC, Generic STM32F103RE, Olimexino STM32 - - + Added support for new ARM mbed based boards: ST 32F746GDISCOVER, - MultiTech mDot, ST Nucleo F207ZG, ST Nucleo F429ZI, ST Nucleo F446ZE, - ST Nucleo F746ZG, ST Nucleo F767ZI, ST Nucleo L011K4, ST Nucleo L432KC, - Seeed Arch Max - -* Development platform `Teensy `__ - - + Added support for Teensy 3.5 and 3.6 boards - + Updated Arduino Framework for Teensy to v130 - 3.0.1 (2016-09-08) ~~~~~~~~~~~~~~~~~~ @@ -559,29 +279,6 @@ PlatformIO 3.0 (`issue #742 `_) * Stopped supporting Python 2.6 ------- - -* Development platform `Atmel SAM `__ - - + Fixed missing analog ports for Adafruit Feather M0 Bluefruit - (`issue #2 `__) - -* Development platform `Nordic nRF51 `__ - - + Added support for BBC micro:bit board - (`issue #709 `_) - -* Development platform `ST STM32 `__ - - + Added support for BluePill F103C8 board - (`pull #2 `__) - -* Development platform `Teensy `__ - - + Updated Arduino Framework to v1.29 - (`issue #2 `__) - - PlatformIO 2.0 -------------- From ef8aeeb5f0740c1ac55a2c3167056ead3d30a86a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 27 Jun 2017 01:17:34 +0300 Subject: [PATCH 03/70] Add support for Adafruit Feather M0 Express & Metro M0 Expresss boards --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 7db6a665..a5c635fa 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 7db6a665218f69f74fc24b2188995af5a2c573d9 +Subproject commit a5c635fab4930b4dab66aa02c9aeae8d5e629f67 From 0deb623ad5e165ec75db923896ff22fb01ce4a66 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 27 Jun 2017 01:56:03 +0300 Subject: [PATCH 04/70] Add link to PIO IDE packages --- docs | 2 +- examples | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index a5c635fa..66cd44f5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a5c635fab4930b4dab66aa02c9aeae8d5e629f67 +Subproject commit 66cd44f5086a30636db01fb925358c516eda6f6b diff --git a/examples b/examples index 372f45c9..94376304 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 372f45c9d4394d1d1559057d59f5f5d22933d5d8 +Subproject commit 94376304d442f2fc8cf4031f1e055c304e935658 From 61fc7d858992ae070945b9e1cdb3a4407b6615ac Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 28 Jun 2017 01:01:03 +0300 Subject: [PATCH 05/70] Fix issue when can not load broken PIO Core state --- HISTORY.rst | 5 +++++ platformio/app.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 10db7362..e4d63f26 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,11 @@ Release Notes PlatformIO 3.0 -------------- +3.4.1 (2017-??-??) +~~~~~~~~~~~~~~~~~~ + +* Fixed issue when can not load broken PIO Core state + 3.4.0 (2017-06-26) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/app.py b/platformio/app.py index d4bfdb3e..f4e5ea2b 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -88,7 +88,7 @@ class State(object): self._lock_state_file() if isfile(self.path): self._state = util.load_json(self.path) - except ValueError: + except exception.PlatformioException: self._state = {} self._prev_state = deepcopy(self._state) return self._state From dae290ad2d34ae1f979f7b355db56b08dbfdfe2e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 28 Jun 2017 01:01:27 +0300 Subject: [PATCH 06/70] Bump version to 3.4.1a1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 0c26d0af..b03bc9e2 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, 0) +VERSION = (3, 4, "1a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 7827994791155887d606ef6f248266cdc6699a59 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 28 Jun 2017 01:38:20 +0300 Subject: [PATCH 07/70] Do not ask for board ID when initialize project for desktop platform --- HISTORY.rst | 1 + platformio/commands/init.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index e4d63f26..ebb34014 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ PlatformIO 3.0 3.4.1 (2017-??-??) ~~~~~~~~~~~~~~~~~~ +* Do not ask for board ID when initialize project for desktop platform * Fixed issue when can not load broken PIO Core state 3.4.0 (2017-06-26) diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 564010a1..ac16bb7e 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -123,13 +123,14 @@ def get_best_envname(project_dir, boards=None): "env_default").split(", ")[0].strip() if env_default: return env_default + section = None for section in config.sections(): if not section.startswith("env:"): continue elif config.has_option(section, "board") and (not boards or config.get( section, "board") in boards): - return section[4:] - return None + break + return section[4:] if section else None def init_base_project(project_dir): From 7a04061d6d4b38bc6ee0e496ca13d86e2eac2e0f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 28 Jun 2017 14:05:28 +0300 Subject: [PATCH 08/70] Typo fix --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index a11a77ca..82898d08 100644 --- a/README.rst +++ b/README.rst @@ -95,7 +95,7 @@ Development Platforms * `ST STM32 `_ * `Teensy `_ * `TI MSP430 `_ -* `TI TivaVA C `_ +* `TI Tiva `_ * `WIZNet W7500 `_ Frameworks From f7ee7e2e8c68c7479e969f893583f5d09cab4e6c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 28 Jun 2017 18:29:56 +0300 Subject: [PATCH 09/70] Add Changelog for PIO IDE for Atom and VSCode --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 66cd44f5..23baf688 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 66cd44f5086a30636db01fb925358c516eda6f6b +Subproject commit 23baf688304fdf981beb4667d1a81061f9a500a5 From a3e7535db5ebbd0dd27c3683959d62faab6b8527 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 28 Jun 2017 19:33:53 +0300 Subject: [PATCH 10/70] Simplify index page of docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 23baf688..686f8c6b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 23baf688304fdf981beb4667d1a81061f9a500a5 +Subproject commit 686f8c6b0fb221676ed586e8bff9f4c5b397de4f From 671eff50128513de06bdb1ba8b424d722d3d85fd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 29 Jun 2017 01:13:20 +0300 Subject: [PATCH 11/70] Library Manager in PlatformIO IDE for Atom --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 686f8c6b..0bff2919 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 686f8c6b0fb221676ed586e8bff9f4c5b397de4f +Subproject commit 0bff2919a373372e8d5f49e51cb6e4fd19250f13 From 46774466dbb33ef1b27fcce20c76dfe1126a6de7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 29 Jun 2017 19:32:38 +0300 Subject: [PATCH 12/70] Fix contact url --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 0bff2919..592bf52d 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 0bff2919a373372e8d5f49e51cb6e4fd19250f13 +Subproject commit 592bf52d72c4b4ebf745b86289531461dba0dc6b From 94a834ecc4cbf6391aed020d1434c1bd20f37095 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 29 Jun 2017 21:22:44 +0300 Subject: [PATCH 13/70] Use a root of library when filtering source code using library.json and srcFilter field --- HISTORY.rst | 3 +++ platformio/builder/tools/piolib.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index ebb34014..05b6efbb 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,9 @@ PlatformIO 3.0 3.4.1 (2017-??-??) ~~~~~~~~~~~~~~~~~~ +* Use a root of library when filtering source code using + `library.json `__ + and ``srcFilter`` field * Do not ask for board ID when initialize project for desktop platform * Fixed issue when can not load broken PIO Core state diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 8f7a1f52..40ec5213 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -521,6 +521,15 @@ class PlatformIOLibBuilder(LibBuilderBase): def _is_arduino_manifest(self): return isfile(join(self.path, "library.properties")) + @property + def src_dir(self): + if all([ + "srcFilter" in self._manifest.get("build", {}) or + self.env['SRC_FILTER'], not self._is_arduino_manifest() + ]): + return self.path + return LibBuilderBase.src_dir.fget(self) + @property def src_filter(self): if "srcFilter" in self._manifest.get("build", {}): From 7d2728845efee4f3f198cc6171bd9aa7c99b70a1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 29 Jun 2017 21:23:06 +0300 Subject: [PATCH 14/70] Use a root of library when filtering source code using library.json and srcFilter field --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 592bf52d..110e2067 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 592bf52d72c4b4ebf745b86289531461dba0dc6b +Subproject commit 110e206764a476adaf520c4ad7a0ed2fb02a71b1 From 7a56ec614c8d2b4805b913a3b382c0a16b2105fd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 29 Jun 2017 21:27:38 +0300 Subject: [PATCH 15/70] =?UTF-8?q?Added=20monitor=5F*=20options=20to=20whit?= =?UTF-8?q?e-list=20for=20Project=20Configuration=20File=20=E2=80=9Cplatfo?= =?UTF-8?q?rmio.ini=E2=80=9D=20//=20Resolve=20#982?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 2 ++ platformio/commands/run.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 05b6efbb..1e655bf0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 3.0 3.4.1 (2017-??-??) ~~~~~~~~~~~~~~~~~~ +* Added ``monitor_*`` options to white-list for `Project Configuration File "platformio.ini" `__ + (`issue #982 `_) * Use a root of library when filtering source code using `library.json `__ and ``srcFilter`` field diff --git a/platformio/commands/run.py b/platformio/commands/run.py index fdd9cefe..4b8ef90b 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -137,13 +137,15 @@ class EnvironmentProcessor(object): "piotest", "test_transport", "test_ignore", "test_port", "debug_tool", "debug_port", "debug_init_cmds", "debug_extra_cmds", "debug_server", "debug_init_break", - "debug_load_cmd") + "debug_load_cmd", "monitor_port", "monitor_baud", + "monitor_rts", "monitor_dtr") IGNORE_BUILD_OPTIONS = ("test_transport", "test_filter", "test_ignore", "test_port", "debug_tool", "debug_port", "debug_init_cmds", "debug_extra_cmds", "debug_server", "debug_init_break", - "debug_load_cmd") + "debug_load_cmd", "monitor_port", "monitor_baud", + "monitor_rts", "monitor_dtr") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} From 35a91dbd570fd4c0353b1666884e332b784f9c31 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 30 Jun 2017 00:15:49 +0300 Subject: [PATCH 16/70] Pre/Post extra scripting for advanced control of PIO Build System // Resolve #891 --- HISTORY.rst | 2 ++ docs | 2 +- platformio/builder/main.py | 41 +++++++++++++---------------- platformio/builder/tools/piomisc.py | 16 +++++++++++ platformio/commands/run.py | 40 +++++++++++++++------------- platformio/managers/core.py | 3 +-- platformio/util.py | 9 +++++++ 7 files changed, 69 insertions(+), 44 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 1e655bf0..81e28cc9 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 3.0 3.4.1 (2017-??-??) ~~~~~~~~~~~~~~~~~~ +* Pre/Post extra scripting for advanced control of PIO Build System + (`issue #891 `_) * Added ``monitor_*`` options to white-list for `Project Configuration File "platformio.ini" `__ (`issue #982 `_) * Use a root of library when filtering source code using diff --git a/docs b/docs index 110e2067..0f6088ae 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 110e206764a476adaf520c4ad7a0ed2fb02a71b1 +Subproject commit 0f6088aed3628a03d227bec60aab3c5c4ea4dafa diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 679236bc..7df25c85 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -32,7 +32,7 @@ commonvars = Variables(None) commonvars.AddVariables( ("PLATFORM_MANIFEST",), ("BUILD_SCRIPT",), - ("EXTRA_SCRIPT",), + ("EXTRA_SCRIPTS",), ("PIOENV",), ("PIOTEST",), ("PIOPLATFORM",), @@ -67,6 +67,11 @@ commonvars.AddVariables( ) # yapf: disable +MULTILINE_VARS = [ + "EXTRA_SCRIPTS", "PIOFRAMEWORK", "BUILD_FLAGS", "SRC_BUILD_FLAGS", + "BUILD_UNFLAGS", "SRC_FILTER", "LIB_DEPS", "LIB_IGNORE", "LIB_EXTRA_DIRS" +] + DEFAULT_ENV_OPTIONS = dict( tools=[ "ar", "as", "gcc", "g++", "gnulink", "platformio", "pioplatform", @@ -110,8 +115,8 @@ env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS) for k in commonvars.keys(): if k in env: env[k] = base64.b64decode(env[k]) - if "\n" in env[k]: - env[k] = [v.strip() for v in env[k].split("\n") if v.strip()] + if k in MULTILINE_VARS: + env[k] = util.parse_conf_multi_values(env[k]) if env.GetOption('clean'): env.PioClean(env.subst("$BUILD_DIR")) @@ -120,38 +125,30 @@ elif not int(ARGUMENTS.get("PIOVERBOSE", 0)): print "Verbose mode can be enabled via `-v, --verbose` option" # Handle custom variables from system environment -for var in ("BUILD_FLAGS", "SRC_BUILD_FLAGS", "SRC_FILTER", "EXTRA_SCRIPT", +for var in ("BUILD_FLAGS", "SRC_BUILD_FLAGS", "SRC_FILTER", "EXTRA_SCRIPTS", "UPLOAD_PORT", "UPLOAD_FLAGS", "LIB_EXTRA_DIRS"): k = "PLATFORMIO_%s" % var if k not in environ: continue - if var in ("UPLOAD_PORT", "EXTRA_SCRIPT") or not env.get(var): + if var in ("UPLOAD_PORT", ): env[var] = environ.get(k) - elif isinstance(env[var], list): - env.Append(**{var: environ.get(k)}) - else: - env[var] = "%s%s%s" % (environ.get(k), ", " - if var == "LIB_EXTRA_DIRS" else " ", env[var]) - -# Parse comma separated items -for opt in ("PIOFRAMEWORK", "LIB_DEPS", "LIB_IGNORE", "LIB_EXTRA_DIRS"): - if opt not in env or isinstance(env[opt], list): continue - env[opt] = [l.strip() for l in env[opt].split(", ") if l.strip()] + env.Append(**{var: util.parse_conf_multi_values(environ.get(k))}) # Configure extra library source directories for LDF if util.get_project_optional_dir("lib_extra_dirs"): - items = util.get_project_optional_dir("lib_extra_dirs") - env.Prepend(LIBSOURCE_DIRS=[ - l.strip() for l in items.split("\n" if "\n" in items else ", ") - if l.strip() - ]) + env.Prepend(LIBSOURCE_DIRS=util.parse_conf_multi_values( + util.get_project_optional_dir("lib_extra_dirs"))) env.Prepend(LIBSOURCE_DIRS=env.get("LIB_EXTRA_DIRS", [])) env.LoadPioPlatform(commonvars) env.SConscriptChdir(0) env.SConsignFile(join("$PROJECTPIOENVS_DIR", ".sconsign.dblite")) + +for item in env.GetPreExtraScripts(): + env.SConscript(item, exports="env") + env.SConscript("$BUILD_SCRIPT") AlwaysBuild(env.Alias("__debug", DEFAULT_TARGETS + ["size"])) @@ -160,8 +157,8 @@ AlwaysBuild(env.Alias("__test", DEFAULT_TARGETS + ["size"])) if "UPLOAD_FLAGS" in env: env.Append(UPLOADERFLAGS=["$UPLOAD_FLAGS"]) -if env.get("EXTRA_SCRIPT"): - env.SConscript(env.get("EXTRA_SCRIPT"), exports="env") +for item in env.GetPostExtraScripts(): + env.SConscript(item, exports="env") if "envdump" in COMMAND_LINE_TARGETS: print env.Dump() diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index f716347f..3dfda62b 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -297,6 +297,20 @@ def ProcessTest(env): duplicate=False) +def GetPreExtraScripts(env): + return [ + item[4:] for item in env.get("EXTRA_SCRIPTS", []) + if item.startswith("pre:") + ] + + +def GetPostExtraScripts(env): + return [ + item[5:] if item.startswith("post:") else item + for item in env.get("EXTRA_SCRIPTS", []) if not item.startswith("pre:") + ] + + def exists(_): return True @@ -309,4 +323,6 @@ def generate(env): env.AddMethod(PioClean) env.AddMethod(ProcessDebug) env.AddMethod(ProcessTest) + env.AddMethod(GetPreExtraScripts) + env.AddMethod(GetPostExtraScripts) return env diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 4b8ef90b..d6546199 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -77,10 +77,8 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, env_default = None if config.has_option("platformio", "env_default"): - env_default = [ - e.strip() - for e in config.get("platformio", "env_default").split(", ") - ] + env_default = util.parse_conf_multi_values( + config.get("platformio", "env_default")) results = [] start_time = time() @@ -130,7 +128,7 @@ class EnvironmentProcessor(object): KNOWN_OPTIONS = ("platform", "framework", "board", "board_mcu", "board_f_cpu", "board_f_flash", "board_flash_mode", "build_flags", "src_build_flags", "build_unflags", - "src_filter", "extra_script", "targets", "upload_port", + "src_filter", "extra_scripts", "targets", "upload_port", "upload_protocol", "upload_speed", "upload_flags", "upload_resetmethod", "lib_deps", "lib_ignore", "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", @@ -149,7 +147,11 @@ class EnvironmentProcessor(object): REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} - RENAMED_OPTIONS = {"lib_use": "lib_deps", "lib_force": "lib_deps"} + RENAMED_OPTIONS = { + "lib_use": "lib_deps", + "lib_force": "lib_deps", + "extra_script": "extra_scripts" + } RENAMED_PLATFORMS = {"espressif": "espressif8266"} @@ -178,13 +180,13 @@ class EnvironmentProcessor(object): self.options[k] = self.options[k].strip() if not self.silent: - click.echo("[%s] Processing %s (%s)" % - (datetime.now().strftime("%c"), - click.style(self.name, fg="cyan", bold=True), - "; ".join([ - "%s: %s" % (k, v.replace("\n", ", ")) - for k, v in self.options.items() - ]))) + click.echo( + "[%s] Processing %s (%s)" % + (datetime.now().strftime("%c"), + click.style(self.name, fg="cyan", bold=True), "; ".join([ + "%s: %s" % (k, ", ".join(util.parse_conf_multi_values(v))) + for k, v in self.options.items() + ]))) click.secho("-" * terminal_width, bold=True) self.options = self._validate_options(self.options) @@ -276,12 +278,10 @@ class EnvironmentProcessor(object): if d.strip() ], self.verbose) if "lib_deps" in self.options: - _autoinstall_libdeps(self.cmd_ctx, [ - d.strip() - for d in self.options['lib_deps'].split( - "\n" if "\n" in self.options['lib_deps'] else ", ") - if d.strip() - ], self.verbose) + _autoinstall_libdeps( + self.cmd_ctx, + util.parse_conf_multi_values(self.options['lib_deps']), + self.verbose) try: p = PlatformFactory.newPlatform(self.options['platform']) @@ -296,6 +296,8 @@ class EnvironmentProcessor(object): def _autoinstall_libdeps(ctx, libraries, verbose=False): + if not libraries: + return storage_dir = util.get_projectlibdeps_dir() ctx.obj = LibraryManager(storage_dir) if verbose: diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 95c8fa4c..080a0013 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -41,8 +41,7 @@ class CorePackageManager(PackageManager): ("" if sys.version_info < (2, 7, 9) else "s") ]) - def install(self, name, requirements=None, *args, - **kwargs): # pylint: disable=arguments-differ + def install(self, name, requirements=None, *args, **kwargs): # pylint: disable=arguments-differ PackageManager.install(self, name, requirements, *args, **kwargs) self.cleanup_packages() return self.get_package_dir(name, requirements) diff --git a/platformio/util.py b/platformio/util.py index ce763969..557db017 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -327,6 +327,15 @@ def load_project_config(path=None): return cp +def parse_conf_multi_values(items): + if not items: + return [] + return [ + item.strip() for item in items.split("\n" if "\n" in items else ", ") + if item.strip() + ] + + def change_filemtime(path, time): os.utime(path, (time, time)) From bf4864386523e2fd04403941714b3644295b87e8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 30 Jun 2017 00:20:27 +0300 Subject: [PATCH 17/70] Bump version to 3.4.1a2 --- docs | 2 +- platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 0f6088ae..f49d1e2f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 0f6088aed3628a03d227bec60aab3c5c4ea4dafa +Subproject commit f49d1e2f81eec4ead17c434b44b4fac7cd708c1b diff --git a/platformio/__init__.py b/platformio/__init__.py index b03bc9e2..8edcd953 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1a1") +VERSION = (3, 4, "1a2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 08ab80187cc47817bcff526e7782993addf1705b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 30 Jun 2017 00:24:35 +0300 Subject: [PATCH 18/70] Mode PIO Core Dev installation on upper level --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index f49d1e2f..5d8c7551 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f49d1e2f81eec4ead17c434b44b4fac7cd708c1b +Subproject commit 5d8c75518b902e620d4e3a296c834cf652780607 From 546993b12cb6683194b9f9856e47a5aa29e1d6be Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 30 Jun 2017 01:23:52 +0300 Subject: [PATCH 19/70] Fix PyLint Warning --- platformio/managers/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 080a0013..f0836d95 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -29,6 +29,8 @@ CORE_PACKAGES = { PIOPLUS_AUTO_UPDATES_MAX = 100 +# pylint: disable=arguments-differ + class CorePackageManager(PackageManager): @@ -41,12 +43,12 @@ class CorePackageManager(PackageManager): ("" if sys.version_info < (2, 7, 9) else "s") ]) - def install(self, name, requirements=None, *args, **kwargs): # pylint: disable=arguments-differ + def install(self, name, requirements=None, *args, **kwargs): PackageManager.install(self, name, requirements, *args, **kwargs) self.cleanup_packages() return self.get_package_dir(name, requirements) - def update(self, *args, **kwargs): # pylint: disable=arguments-differ + def update(self, *args, **kwargs): result = PackageManager.update(self, *args, **kwargs) self.cleanup_packages() return result From cefc2fa21c08a4aef5b710cac9f7625a74d0fccf Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 30 Jun 2017 01:35:54 +0300 Subject: [PATCH 20/70] Cosmetic improvements --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 5d8c7551..d96f7abb 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5d8c75518b902e620d4e3a296c834cf652780607 +Subproject commit d96f7abb6624cd23c5ad911255187255c7071743 From b774bd6a55f2a3b50f2f47d9476a278c202b82ca Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 30 Jun 2017 22:07:04 +0300 Subject: [PATCH 21/70] Improve platformio.ini example --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index d96f7abb..927cc45f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d96f7abb6624cd23c5ad911255187255c7071743 +Subproject commit 927cc45f0dc804725d8771030e8985ed37444a84 From 53906c49cb6c07bf5e04c090832d9fc9d7f0afb5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 14:16:26 +0300 Subject: [PATCH 22/70] Refactor PIO Account docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 927cc45f..33f46724 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 927cc45f0dc804725d8771030e8985ed37444a84 +Subproject commit 33f4672425a376d80b601d8e816b9208dd5ccee8 From e8da7b46739251954b0dff379060a66ea9e0703a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 19:24:10 +0300 Subject: [PATCH 23/70] Depend on PIO Core Plus v0.9.1 --- examples | 2 +- platformio/managers/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples b/examples index 94376304..825210f8 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 94376304d442f2fc8cf4031f1e055c304e935658 +Subproject commit 825210f89d15612f91465b56bdd1c375060ee91e diff --git a/platformio/managers/core.py b/platformio/managers/core.py index f0836d95..b052c23e 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.9.0,<2", + "tool-pioplus": ">=0.9.1,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From fb432da26b1a2af619322a9e8cf2ce8c42924674 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 19:24:41 +0300 Subject: [PATCH 24/70] Bump version to 3.4.1a3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 8edcd953..c92327f3 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1a2") +VERSION = (3, 4, "1a3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From f85c894b527e38049aca7f58d88d7f787931167b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 20:24:03 +0300 Subject: [PATCH 25/70] Move Pricing before Docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 33f46724..5eed4de3 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 33f4672425a376d80b601d8e816b9208dd5ccee8 +Subproject commit 5eed4de34472e98f2540ba5577ef456f1fe9f3d0 From 2c232f2f3f95cc2db95c86b4a6065eb255ff2938 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 20:34:34 +0300 Subject: [PATCH 26/70] Standalone IDEs Integration --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 5eed4de3..f98142c3 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5eed4de34472e98f2540ba5577ef456f1fe9f3d0 +Subproject commit f98142c3f4defb84b40fd5f15ec53bfdd9dccdaf From aadb1860547ddbe70e4b9289fc11cbe14de9d8af Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 21:54:04 +0300 Subject: [PATCH 27/70] Escape spaces in task command for VSCode Task Runner --- platformio/ide/tpls/vscode/.vscode/tasks.json.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl index 870cb566..59382cf3 100644 --- a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl @@ -1,7 +1,7 @@ { "version": "0.1.0", "runner": "terminal", - "command": "{{platformio_path}}", + "command": "\"{{platformio_path}}\"", "isShellCommand": false, "args": ["-c", "vscode"], "showOutput": "always", From a0cd0bc189d6e21de1e61a07bed138fe67439b9b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 22:00:25 +0300 Subject: [PATCH 28/70] Fix an issue with a custom unit testing transport --- platformio/builder/tools/piomisc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 3dfda62b..0e253ce7 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -285,10 +285,12 @@ def ProcessTest(env): join("$BUILD_DIR", "UnityTestLib"), get_core_package_dir("tool-unity")) env.Prepend(LIBS=[unitylib]) - src_filter = None + src_filter = [ + "+<*.cpp>", + "+<*.c>" + ] if "PIOTEST" in env: - src_filter = "+" - src_filter += " +<%s%s>" % (env['PIOTEST'], sep) + src_filter.append("+<%s%s>" % (env['PIOTEST'], sep)) return env.CollectBuildFiles( "$BUILDTEST_DIR", From 68ccabda56d53f504495b29538c6fcbf142a46b0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Jul 2017 22:17:37 +0300 Subject: [PATCH 29/70] Update history --- HISTORY.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 81e28cc9..f5ace81f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,6 +16,8 @@ PlatformIO 3.0 and ``srcFilter`` field * Do not ask for board ID when initialize project for desktop platform * Fixed issue when can not load broken PIO Core state +* Fixed an issue with a custom transport for `PIO Unit Testing `__ + when multiple tests are present 3.4.0 (2017-06-26) ~~~~~~~~~~~~~~~~~~ From 8741f378310d28ad79e5453c80a3e7e131fa8ba5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 3 Jul 2017 13:35:39 +0300 Subject: [PATCH 30/70] Minor improvements --- platformio/builder/tools/piomisc.py | 5 +---- platformio/exception.py | 4 ++++ platformio/ide/projectgenerator.py | 2 +- platformio/telemetry.py | 26 +++++++++++++++++++++----- platformio/vcsclient.py | 4 ++-- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 0e253ce7..fc08ed93 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -285,10 +285,7 @@ def ProcessTest(env): join("$BUILD_DIR", "UnityTestLib"), get_core_package_dir("tool-unity")) env.Prepend(LIBS=[unitylib]) - src_filter = [ - "+<*.cpp>", - "+<*.c>" - ] + src_filter = ["+<*.cpp>", "+<*.c>"] if "PIOTEST" in env: src_filter.append("+<%s%s>" % (env['PIOTEST'], sep)) diff --git a/platformio/exception.py b/platformio/exception.py index 8743e784..e190d7a4 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -32,6 +32,10 @@ class MinitermException(PlatformioException): pass +class UserSideException(PlatformioException): + pass + + class AbortedByUser(PlatformioException): MESSAGE = "Aborted by user" diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index c12d4731..1561bc6e 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -46,7 +46,7 @@ class ProjectGenerator(object): @util.memoized def get_project_env(self): - data = None + data = {} config = util.load_project_config(self.project_dir) for section in config.sections(): if not section.startswith("env:"): diff --git a/platformio/telemetry.py b/platformio/telemetry.py index bcf39fbe..5482353c 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -92,10 +92,24 @@ class MeasurementProtocol(TelemetryBase): self['an'] = " ".join(dpdata) def _prefill_custom_data(self): + + def _filter_args(items): + result = [] + stop = False + for item in items: + item = str(item).lower() + result.append(item) + if stop: + break + if item == "account": + stop = True + return result + caller_id = str(app.get_session_var("caller_id")) self['cd1'] = util.get_systype() self['cd2'] = "Python/%s %s" % (platform.python_version(), platform.platform()) + self['cd3'] = " ".join(_filter_args(sys.argv[1:])) self['cd4'] = 1 if (not util.is_ci() and (caller_id or not util.is_container())) else 0 if caller_id: @@ -109,7 +123,6 @@ class MeasurementProtocol(TelemetryBase): return _arg return None - self['cd3'] = " ".join([str(s).lower() for s in sys.argv[1:]]) if not app.get_session_var("command_ctx"): return ctx_args = app.get_session_var("command_ctx").args @@ -301,12 +314,15 @@ def on_event(category, action, label=None, value=None, screen_name=None): def on_exception(e): - skip = any([ + skip_conditions = [ isinstance(e, cls) for cls in (IOError, exception.AbortedByUser, - exception.NotGlobalLibDir, exception.InternetIsOffline) - ]) - if skip: + exception.NotGlobalLibDir, exception.InternetIsOffline, + exception.NotPlatformIOProject, + exception.UserSideException) + ] + skip_conditions.append("[API] Account: " in str(e)) + if any(skip_conditions): return is_crash = any([ not isinstance(e, exception.PlatformioException), diff --git a/platformio/vcsclient.py b/platformio/vcsclient.py index 3ef64fe1..b7c72ea1 100644 --- a/platformio/vcsclient.py +++ b/platformio/vcsclient.py @@ -19,7 +19,7 @@ from sys import modules from urlparse import urlparse from platformio import util -from platformio.exception import PlatformioException +from platformio.exception import PlatformioException, UserSideException class VCSClientFactory(object): @@ -64,7 +64,7 @@ class VCSClientBase(object): else: assert self.run_cmd(["--version"]) except (AssertionError, OSError, PlatformioException): - raise PlatformioException( + raise UserSideException( "VCS: `%s` client is not installed in your system" % self.command) return True From 0e8fb1ba837c76f32aa694284631f2e6694aaf28 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 3 Jul 2017 13:36:51 +0300 Subject: [PATCH 31/70] Bump version to 3.4.1a4 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index c92327f3..c53d055d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1a3") +VERSION = (3, 4, "1a4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 4eb92ff2e38397060a89ccf9d525eb70fd0e9aaf Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 4 Jul 2017 01:17:56 +0300 Subject: [PATCH 32/70] Refactor pioNav for docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index f98142c3..5465ce7f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f98142c3f4defb84b40fd5f15ec53bfdd9dccdaf +Subproject commit 5465ce7f21eecb2ad6c933b9042faaa4f7fcbd59 From 97866cf44d82fab912d210bd4806cdbe77d25498 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 4 Jul 2017 14:24:40 +0300 Subject: [PATCH 33/70] Correct default values for auto_update_libraries/platforms --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 5465ce7f..7bcff76b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5465ce7f21eecb2ad6c933b9042faaa4f7fcbd59 +Subproject commit 7bcff76bb1d10c4817a3bdd7defee17c80d70fd9 From 7964aed4533b22b4cf8720cf804a8f75cfd7f313 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 4 Jul 2017 19:30:39 +0300 Subject: [PATCH 34/70] New boards by RushUp --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 7bcff76b..5d830300 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 7bcff76bb1d10c4817a3bdd7defee17c80d70fd9 +Subproject commit 5d8303000f792d1b2063f2f457c7a928c752d785 From 6403cf0c8b452ae6462251271bda1e84d6c70cf0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 5 Jul 2017 20:38:28 +0300 Subject: [PATCH 35/70] New task "PlatformIO: Monitor" for VSCode --- platformio/ide/tpls/vscode/.vscode/tasks.json.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl index 59382cf3..a0efc7bc 100644 --- a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl @@ -93,6 +93,10 @@ } } }, + { + "taskName": "PlatformIO: Monitor", + "args": ["device", "monitor"] + }, { "taskName": "PlatformIO: Test", "args": ["test"], From ebe0d41b77e76600935dfd9900eeef36ccc957c5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 5 Jul 2017 20:38:55 +0300 Subject: [PATCH 36/70] Bump version to 3.4.1a5 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index c53d055d..c46c0713 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1a4") +VERSION = (3, 4, "1a5") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 309d3a45d615793c179afb5a0ec5459cb2ec6975 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 5 Jul 2017 21:22:33 +0300 Subject: [PATCH 37/70] New "forceUploadAndMonitor" option for PlatformIO IDE for VSCode --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 5d830300..9456cf90 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5d8303000f792d1b2063f2f457c7a928c752d785 +Subproject commit 9456cf9099181c9b85462fe96a397349f61edc3a From 91d3a8ffad051dd605b2fc74a626624544b0618f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Jul 2017 01:28:19 +0300 Subject: [PATCH 38/70] Improve docs for PIO Debugger --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 9456cf90..01b354fa 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9456cf9099181c9b85462fe96a397349f61edc3a +Subproject commit 01b354fa68a2660f476e5e749ca1bdcbbb080f9a From 8008f87ffa8a6ad56275a31f8a7dfba9c543f3fe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 13 Jul 2017 00:51:04 +0300 Subject: [PATCH 39/70] Manage project libraries with "--storage-dir" option --- platformio/commands/lib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 5a4c9fbc..0d20e281 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -66,6 +66,9 @@ def cli(ctx, **options): "Please use `platformio lib --global %s` command to remove " "this warning." % ctx.invoked_subcommand, fg="yellow") + elif util.is_platformio_project(storage_dir): + with util.cd(storage_dir): + storage_dir = util.get_projectlibdeps_dir() if not storage_dir and not util.is_platformio_project(): raise exception.NotGlobalLibDir(util.get_project_dir(), From e01c0a1effca482276fff72e765e72e7a8286201 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Jul 2017 02:10:12 +0300 Subject: [PATCH 40/70] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 01b354fa..831658e4 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 01b354fa68a2660f476e5e749ca1bdcbbb080f9a +Subproject commit 831658e463577e711c6be8f80c2c2488fdfebc85 From c926ca389c54ae494d73891757f1b9a1ec7fa073 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Jul 2017 14:05:38 +0300 Subject: [PATCH 41/70] Sync examples --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index 825210f8..12b07e0a 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 825210f89d15612f91465b56bdd1c375060ee91e +Subproject commit 12b07e0ad0a71ce3dac9031a935994c555782b2c From 12ec11c7e21ef352dfce0dfd3b6b66f4342dc65e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Jul 2017 14:22:38 +0300 Subject: [PATCH 42/70] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 831658e4..fcc3f8dd 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 831658e463577e711c6be8f80c2c2488fdfebc85 +Subproject commit fcc3f8ddb45aa95d3b6bfbefdf8eb3268edb2a99 From 12222c0f42cffd626c72add1c9003aea6e007b50 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Jul 2017 23:56:45 +0300 Subject: [PATCH 43/70] Improve docs for advanced scripting --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index fcc3f8dd..1e293085 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit fcc3f8ddb45aa95d3b6bfbefdf8eb3268edb2a99 +Subproject commit 1e2930851a2065f73512e77e91909527866af36e From 35cab82605630c7db27ac3da3d624efa6cd975db Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 16 Jul 2017 21:28:54 +0300 Subject: [PATCH 44/70] Remove static tasks for VSCode --- .../ide/tpls/vscode/.vscode/tasks.json.tpl | 125 ------------------ 1 file changed, 125 deletions(-) delete mode 100644 platformio/ide/tpls/vscode/.vscode/tasks.json.tpl diff --git a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl deleted file mode 100644 index a0efc7bc..00000000 --- a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl +++ /dev/null @@ -1,125 +0,0 @@ -{ - "version": "0.1.0", - "runner": "terminal", - "command": "\"{{platformio_path}}\"", - "isShellCommand": false, - "args": ["-c", "vscode"], - "showOutput": "always", - "echoCommand": false, - "suppressTaskName": true, - "tasks": [ - { - "taskName": "PlatformIO: Build", - "isBuildCommand": true, - "args": ["run"], - "problemMatcher": { - "owner": "cpp", - "fileLocation": ["relative", "${workspaceRoot}"], - "pattern": { - "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - } - }, - { - "taskName": "PlatformIO: Clean", - "args": ["run", "-t", "clean"] - }, - { - "taskName": "PlatformIO: Upload", - "args": ["run", "-t", "upload"], - "problemMatcher": { - "owner": "cpp", - "fileLocation": ["relative", "${workspaceRoot}"], - "pattern": { - "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - } - }, - { - "taskName": "PlatformIO: Upload using Programmer", - "args": ["run", "-t", "program"], - "problemMatcher": { - "owner": "cpp", - "fileLocation": ["relative", "${workspaceRoot}"], - "pattern": { - "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - } - }, - { - "taskName": "PlatformIO: Upload SPIFFS image", - "args": ["run", "-t", "uploadfs"], - "problemMatcher": { - "owner": "cpp", - "fileLocation": ["relative", "${workspaceRoot}"], - "pattern": { - "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - } - }, - { - "taskName": "PlatformIO: Upload and Monitor", - "args": ["run", "-t", "upload", "-t", "monitor"], - "problemMatcher": { - "owner": "cpp", - "fileLocation": ["relative", "${workspaceRoot}"], - "pattern": { - "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - } - }, - { - "taskName": "PlatformIO: Monitor", - "args": ["device", "monitor"] - }, - { - "taskName": "PlatformIO: Test", - "args": ["test"], - "problemMatcher": { - "owner": "cpp", - "fileLocation": ["relative", "${workspaceRoot}"], - "pattern": { - "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", - "file": 1, - "line": 2, - "column": 3, - "severity": 4, - "message": 5 - } - } - }, - { - "taskName": "PlatformIO: Update platforms and libraries", - "args": ["update"] - }, - { - "taskName": "PlatformIO: Upgrade PIO Core", - "args": ["upgrade"] - } - ] -} \ No newline at end of file From d66b1780ce5be018677fbbe71beaa66708db61da Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 17 Jul 2017 13:13:42 +0300 Subject: [PATCH 45/70] Bump version to 3.4.1a6 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index c46c0713..672bea22 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1a5") +VERSION = (3, 4, "1a6") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From ec9324d77f60ffa1548d948522deeed00ef96cf4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 18 Jul 2017 22:47:39 +0300 Subject: [PATCH 46/70] Sync examples with mbed 5.5 --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index 12b07e0a..2170f4af 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 12b07e0ad0a71ce3dac9031a935994c555782b2c +Subproject commit 2170f4afe5f457e782477ffac32b55bb6ea2adf3 From 1260859c4240e6244ac6c427c968f1444813cc64 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 18 Jul 2017 23:15:09 +0300 Subject: [PATCH 47/70] Sync examples --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index 2170f4af..838f1297 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 2170f4afe5f457e782477ffac32b55bb6ea2adf3 +Subproject commit 838f1297ac32a4418e71c6c24095874693f721be From f61c7f60303ce168c3d57a858b3ede98d15ff60f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 19 Jul 2017 13:53:58 +0300 Subject: [PATCH 48/70] Sync examples --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index 838f1297..867a72c6 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 838f1297ac32a4418e71c6c24095874693f721be +Subproject commit 867a72c6d9f516b63528ef95cc10508fe86969a0 From e708b745070b287429ff0b9c0aae7459840d0a3a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 20 Jul 2017 13:36:13 +0300 Subject: [PATCH 49/70] Document Task Runner for VSCode --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 1e293085..fedc7eaf 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 1e2930851a2065f73512e77e91909527866af36e +Subproject commit fedc7eaf7042549e0489090c67cd90cd94e7c092 From 16ea8f29a1473835cf5e9dc5ffc03873f5c00c73 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 21 Jul 2017 22:07:11 +0300 Subject: [PATCH 50/70] Update docs with new boards --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index fedc7eaf..89c585fb 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit fedc7eaf7042549e0489090c67cd90cd94e7c092 +Subproject commit 89c585fb3ca950e27feb622c4273f1299344dbda From f13537cabb793b683bb7ed439732ac96b8572ffa Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 24 Jul 2017 17:35:41 +0300 Subject: [PATCH 51/70] YAPF --- platformio/builder/tools/piolib.py | 14 +++++++------- platformio/builder/tools/pioplatform.py | 6 +++--- platformio/builder/tools/pioupload.py | 4 ++-- platformio/builder/tools/platformio.py | 4 ++-- platformio/commands/lib.py | 4 ++-- platformio/commands/run.py | 8 ++++---- platformio/commands/upgrade.py | 4 ++-- platformio/managers/package.py | 4 ++-- platformio/managers/platform.py | 24 ++++++++++++------------ platformio/telemetry.py | 4 ++-- platformio/util.py | 4 ++-- 11 files changed, 40 insertions(+), 40 deletions(-) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 40ec5213..a7bbc6f4 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -524,8 +524,8 @@ class PlatformIOLibBuilder(LibBuilderBase): @property def src_dir(self): if all([ - "srcFilter" in self._manifest.get("build", {}) or - self.env['SRC_FILTER'], not self._is_arduino_manifest() + "srcFilter" in self._manifest.get("build", {}) + or self.env['SRC_FILTER'], not self._is_arduino_manifest() ]): return self.path return LibBuilderBase.src_dir.fget(self) @@ -587,9 +587,9 @@ class PlatformIOLibBuilder(LibBuilderBase): inc_dirs = LibBuilderBase.get_inc_dirs(self) # backwards compatibility with PlatformIO 2.0 - if ("build" not in self._manifest and self._is_arduino_manifest() and - not isdir(join(self.path, "src")) and - isdir(join(self.path, "utility"))): + if ("build" not in self._manifest and self._is_arduino_manifest() + and not isdir(join(self.path, "src")) + and isdir(join(self.path, "utility"))): inc_dirs.append(join(self.path, "utility")) for path in self.env.get("CPPPATH", []): @@ -605,8 +605,8 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches items = [] compat_mode = int(env.get("LIB_COMPAT_MODE", 1)) - verbose = (int(ARGUMENTS.get("PIOVERBOSE", 0)) and - not env.GetOption('clean')) + verbose = (int(ARGUMENTS.get("PIOVERBOSE", 0)) + and not env.GetOption('clean')) def _check_lib_builder(lb): if lb.name in env.get("LIB_IGNORE", []): diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 9be56410..ab679a68 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -80,9 +80,9 @@ def LoadPioPlatform(env, variables): board_config = env.BoardConfig() for k in variables.keys(): - if (k in env or - not any([k.startswith("BOARD_"), - k.startswith("UPLOAD_")])): + if (k in env + or not any([k.startswith("BOARD_"), + k.startswith("UPLOAD_")])): continue _opt, _val = k.lower().split("_", 1) if _opt == "board": diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 4547858d..e3641d81 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -115,8 +115,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument ] if any([isfile(p) for p in mbed_pages]): return item['disk'] - if (item['name'] and - any([l in item['name'].lower() for l in msdlabels])): + if (item['name'] + and any([l in item['name'].lower() for l in msdlabels])): return item['disk'] return None diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index fffb8e40..79e8d212 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -66,8 +66,8 @@ def BuildProgram(env): deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR") # append specified LD_SCRIPT - if ("LDSCRIPT_PATH" in env and - not any(["-Wl,-T" in f for f in env['LINKFLAGS']])): + if ("LDSCRIPT_PATH" in env + and not any(["-Wl,-T" in f for f in env['LINKFLAGS']])): env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"']) # enable "cyclic reference" for linker diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 0d20e281..f801e23a 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -385,8 +385,8 @@ def lib_show(library, json_output): @cli.command("register", short_help="Register a new library") @click.argument("config_url") def lib_register(config_url): - if (not config_url.startswith("http://") and - not config_url.startswith("https://")): + if (not config_url.startswith("http://") + and not config_url.startswith("https://")): raise exception.InvalidLibConfURL(config_url) result = get_api_result("/lib/register", data=dict(config_url=config_url)) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index d6546199..5c35c4d2 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -88,8 +88,8 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, envname = section[4:] skipenv = any([ - environment and envname not in environment, not environment and - env_default and envname not in env_default + environment and envname not in environment, not environment + and env_default and envname not in env_default ]) if skipenv: results.append((envname, None)) @@ -322,8 +322,8 @@ def _clean_pioenvs_dir(pioenvs_dir): proj_hash = calculate_project_hash() # if project's config is modified - if (isdir(pioenvs_dir) and - getmtime(join(util.get_project_dir(), "platformio.ini")) > + if (isdir(pioenvs_dir) + and getmtime(join(util.get_project_dir(), "platformio.ini")) > getmtime(pioenvs_dir)): util.rmtree_(pioenvs_dir) diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index a23c695a..ba26b844 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -66,8 +66,8 @@ def cli(): if not r: raise exception.UpgradeError("\n".join([str(cmd), str(e)])) permission_errors = ("permission denied", "not permitted") - if (any([m in r['err'].lower() for m in permission_errors]) and - "windows" not in util.get_systype()): + if (any([m in r['err'].lower() for m in permission_errors]) + and "windows" not in util.get_systype()): click.secho( """ ----------------- diff --git a/platformio/managers/package.py b/platformio/managers/package.py index c05b90f6..54fcaa61 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -516,8 +516,8 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): # Handle GitHub URL (https://github.com/user/package) url.startswith("https://github.com/") and not url.endswith( (".zip", ".tar.gz")), - url.startswith("http") and - (url.split("#", 1)[0] if "#" in url else url).endswith(".git") + url.startswith("http") + and (url.split("#", 1)[0] if "#" in url else url).endswith(".git") ] if any(git_conditions): url = "git+" + url diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index 015d9504..8627a3b6 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -38,8 +38,8 @@ class PlatformManager(BasePkgManager): "{0}://dl.platformio.org/platforms/manifest.json".format( "https" if app.get_setting("enable_ssl") else "http") ] - BasePkgManager.__init__(self, package_dir or - join(util.get_home_dir(), "platforms"), + BasePkgManager.__init__(self, package_dir + or join(util.get_home_dir(), "platforms"), repositories) @property @@ -144,8 +144,8 @@ class PlatformManager(BasePkgManager): for manifest in pm.get_installed(): if manifest['name'] not in names: continue - if (manifest['name'] not in deppkgs or - manifest['version'] not in deppkgs[manifest['name']]): + if (manifest['name'] not in deppkgs + or manifest['version'] not in deppkgs[manifest['name']]): pm.uninstall(manifest['__pkg_dir'], trigger_event=False) self.cache_reset() @@ -168,12 +168,12 @@ class PlatformManager(BasePkgManager): def board_config(self, id_, platform=None): for manifest in self.get_installed_boards(): - if manifest['id'] == id_ and (not platform or - manifest['platform'] == platform): + if manifest['id'] == id_ and (not platform + or manifest['platform'] == platform): return manifest for manifest in self.get_registered_boards(): - if manifest['id'] == id_ and (not platform or - manifest['platform'] == platform): + if manifest['id'] == id_ and (not platform + or manifest['platform'] == platform): return manifest raise exception.UnknownBoard(id_) @@ -270,8 +270,8 @@ class PlatformPackagesMixin(object): if _opts.get("type") == item: candidate = _name - if (self.frameworks and item.startswith("framework-") and - item[10:] in self.frameworks): + if (self.frameworks and item.startswith("framework-") + and item[10:] in self.frameworks): candidate = self.frameworks[item[10:]]['package'] result.append(candidate) @@ -498,8 +498,8 @@ class PlatformBase( # pylint: disable=too-many-public-methods config = PlatformBoardConfig(manifest_path) if "platform" in config and config.get("platform") != self.name: return - elif ("platforms" in config and - self.name not in config.get("platforms")): + elif ("platforms" in config + and self.name not in config.get("platforms")): return config.manifest['platform'] = self.name self._BOARDS_CACHE[board_id] = config diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 5482353c..7c23e6b5 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -110,8 +110,8 @@ class MeasurementProtocol(TelemetryBase): self['cd2'] = "Python/%s %s" % (platform.python_version(), platform.platform()) self['cd3'] = " ".join(_filter_args(sys.argv[1:])) - self['cd4'] = 1 if (not util.is_ci() and - (caller_id or not util.is_container())) else 0 + self['cd4'] = 1 if (not util.is_ci() + and (caller_id or not util.is_container())) else 0 if caller_id: self['cd5'] = caller_id.lower() diff --git a/platformio/util.py b/platformio/util.py index 557db017..f5a7b830 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -200,8 +200,8 @@ def get_project_optional_dir(name, default=None): else: try: config = load_project_config() - if (config.has_section("platformio") and - config.has_option("platformio", name)): + if (config.has_section("platformio") + and config.has_option("platformio", name)): data = config.get("platformio", name) except exception.NotPlatformIOProject: pass From 53017b24d1e58d3d6064426ed9d12dba6a898763 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 24 Jul 2017 17:37:16 +0300 Subject: [PATCH 52/70] VSCode configuration --- .vscode/settings.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..d6d00aee --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "python.pythonPath": "${workspaceRoot}/.tox/develop/bin/python", + "python.formatting.provider": "yapf", + "files.exclude": { + "**/*.pyc": true, + "*.egg-info": true, + ".cache": true, + "build": true, + "dist": true + }, + "editor.rulers": [79] +} From dfe769c92e59eb48342e6d49f6214a6275511538 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 25 Jul 2017 13:22:55 +0300 Subject: [PATCH 53/70] Add support for Controllino PLC --- docs | 2 +- examples | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 89c585fb..e70c7895 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 89c585fb3ca950e27feb622c4273f1299344dbda +Subproject commit e70c789596f115504ef434392aca0f12be68bf18 diff --git a/examples b/examples index 867a72c6..6477733d 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 867a72c6d9f516b63528ef95cc10508fe86969a0 +Subproject commit 6477733d8ef2e0c0f456e8f6c546627c04a1ed4c From c7f5629f82d8f1375941ef43eec933038909d5bc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 25 Jul 2017 19:19:52 +0300 Subject: [PATCH 54/70] Fix links in docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index e70c7895..2afdbefb 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit e70c789596f115504ef434392aca0f12be68bf18 +Subproject commit 2afdbefb8b1ee35f0d48a8bd17de37e18ab97cd1 From 954357bdd2e45a1933567e720ce493f0c8e1f277 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 25 Jul 2017 20:00:27 +0300 Subject: [PATCH 55/70] Update links to ESP8266 docs --- docs | 2 +- examples | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 2afdbefb..ff15e616 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2afdbefb8b1ee35f0d48a8bd17de37e18ab97cd1 +Subproject commit ff15e6162aebb02c1abff238188e08d18c9a06e4 diff --git a/examples b/examples index 6477733d..a2d7ba27 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 6477733d8ef2e0c0f456e8f6c546627c04a1ed4c +Subproject commit a2d7ba27c3f2730381d99e587837c6aca9269e33 From 9994ed8b5ef575bb6d226fecb25907f1b41c2e0c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Jul 2017 15:50:54 +0300 Subject: [PATCH 56/70] Check context arguments before comparison // Resolve #1000 --- platformio/maintenance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index b51fbdf8..5109e0a6 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -39,7 +39,7 @@ def in_silence(ctx=None): assert ctx ctx_args = ctx.args or [] conditions = [ - ctx.args[0] == "upgrade", "--json-output" in ctx_args, + ctx_args and ctx.args[0] == "upgrade", "--json-output" in ctx_args, "--version" in ctx_args ] return ctx_args and any(conditions) From 0099b037f3f67eefeaf783e2e3818ebac211d08e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Jul 2017 19:07:46 +0300 Subject: [PATCH 57/70] Refactor docs for Unit Testing --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index ff15e616..7432349b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ff15e6162aebb02c1abff238188e08d18c9a06e4 +Subproject commit 7432349bf74709bb7584332b05983326de0cf3d9 From 5d31d6825b1276715a45a5b72aed36287efd0a57 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Jul 2017 00:56:02 +0300 Subject: [PATCH 58/70] Export board's connectivity --- platformio/managers/platform.py | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index 8627a3b6..dec4bd30 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -645,6 +645,7 @@ class PlatformBoardConfig(object): int(self._manifest.get("build", {}).get("f_cpu", "0L")[:-1]), "ram": self._manifest.get("upload", {}).get("maximum_ram_size", 0), "rom": self._manifest.get("upload", {}).get("maximum_size", 0), + "connectivity": self._manifest.get("connectivity"), "frameworks": self._manifest.get("frameworks"), "debug": self.get_debug_data(), "vendor": self._manifest['vendor'], From 4944731dc6d075d50991318976d28f1f94475dcd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 31 Jul 2017 18:25:57 +0300 Subject: [PATCH 59/70] Sync docs: Split build flags into multiple lines --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 7432349b..1748af11 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 7432349bf74709bb7584332b05983326de0cf3d9 +Subproject commit 1748af112da926c8c821e454ef13e1f060ce6f8a From 06b49ec3ec38646b98d0ca969587b5b65a79e6eb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 31 Jul 2017 19:05:03 +0300 Subject: [PATCH 60/70] Some improvements --- platformio/maintenance.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 5109e0a6..b9d245da 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -38,11 +38,10 @@ def in_silence(ctx=None): ctx = ctx or app.get_session_var("command_ctx") assert ctx ctx_args = ctx.args or [] - conditions = [ - ctx_args and ctx.args[0] == "upgrade", "--json-output" in ctx_args, + return ctx_args and any([ + ctx.args[0] == "upgrade", "--json-output" in ctx_args, "--version" in ctx_args - ] - return ctx_args and any(conditions) + ]) def on_platformio_start(ctx, force, caller): From cd5b88dd1f6d5261851cfc9f0f97548749af71e1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 31 Jul 2017 19:38:42 +0300 Subject: [PATCH 61/70] Automatically update PIO Core packages when it is possible --- platformio/commands/upgrade.py | 4 ++++ platformio/maintenance.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index ba26b844..df9fc0ee 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -18,11 +18,15 @@ import click import requests from platformio import VERSION, __version__, exception, util +from platformio.managers.core import update_core_packages @click.command( "upgrade", short_help="Upgrade PlatformIO to the latest version") def cli(): + # Update PlatformIO's Core packages + update_core_packages(silent=True) + latest = get_latest_version() if __version__ == latest: return click.secho( diff --git a/platformio/maintenance.py b/platformio/maintenance.py index b9d245da..3e198f08 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -234,6 +234,9 @@ def check_platformio_upgrade(): if (time() - interval) < last_check.get("platformio_upgrade", 0): return + # Update PlatformIO's Core packages + update_core_packages(silent=True) + last_check['platformio_upgrade'] = int(time()) app.set_state_item("last_check", last_check) From 861659e890af8dab49ce725669b98ad343befcb1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Aug 2017 00:12:05 +0300 Subject: [PATCH 62/70] Wait for 400ms after touching serial port (fix SAM-BA issue) --- platformio/builder/tools/pioupload.py | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index e3641d81..a45409e6 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -48,6 +48,7 @@ def TouchSerialPort(env, port, baudrate): s.close() except: # pylint: disable=W0702 pass + sleep(0.4) def WaitForNewSerialPort(env, before): From 3f96530c321d933095597f7aca348a75a4c68dd9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Aug 2017 00:21:57 +0300 Subject: [PATCH 63/70] Sync docs: Add example how to build a custom HEX from ELF --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 1748af11..616f099b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 1748af112da926c8c821e454ef13e1f060ce6f8a +Subproject commit 616f099b7c86f9f70ebad69455555a458bf650a3 From d5baa153a5cdf9f2b3f9e4c5bd21861f8c1e6e44 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Aug 2017 00:33:51 +0300 Subject: [PATCH 64/70] Fix an issue when can not upload firmware to SAM-BA based board (Due) --- HISTORY.rst | 3 ++- platformio/builder/tools/pioupload.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f5ace81f..39d82662 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,9 +15,10 @@ PlatformIO 3.0 `library.json `__ and ``srcFilter`` field * Do not ask for board ID when initialize project for desktop platform -* Fixed issue when can not load broken PIO Core state +* Handle broken PIO Core state and create new one * Fixed an issue with a custom transport for `PIO Unit Testing `__ when multiple tests are present +* Fixed an issue when can not upload firmware to SAM-BA based board (Due) 3.4.0 (2017-06-26) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index a45409e6..0ff3cb1f 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -48,7 +48,7 @@ def TouchSerialPort(env, port, baudrate): s.close() except: # pylint: disable=W0702 pass - sleep(0.4) + sleep(0.4) # DO NOT REMOVE THAT (required by SAM-BA based boards) def WaitForNewSerialPort(env, before): From fe4a72edd01a8506df478872c2b3c40204e636df Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Aug 2017 00:35:16 +0300 Subject: [PATCH 65/70] Bump version to 3.4.1b1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 672bea22..b4f15d85 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1a6") +VERSION = (3, 4, "1b1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From b4f927a84dfbba8eee466b20d2334d222ca7de24 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Aug 2017 01:45:48 +0300 Subject: [PATCH 66/70] Sync docs: add new boards --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 616f099b..6dcdabb9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 616f099b7c86f9f70ebad69455555a458bf650a3 +Subproject commit 6dcdabb99f74d2ba181e666cc1818697c255e271 From b929e452b076f846985ed15b05f3b73a2cc22a24 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Aug 2017 14:45:42 +0300 Subject: [PATCH 67/70] Add "inc" folder automatically to CPPPATH when "src" is available (works for project and library) // Resolve #1003 --- .vscode/settings.json | 5 +- HISTORY.rst | 7 +- platformio/builder/tools/piolib.py | 124 +++++++++++++------------ platformio/builder/tools/platformio.py | 3 +- tox.ini | 1 + 5 files changed, 75 insertions(+), 65 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index d6d00aee..d1efd097 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,8 @@ "build": true, "dist": true }, - "editor.rulers": [79] + "editor.rulers": [79], + "restructuredtext.builtDocumentationPath": "${workspaceRoot}/docs/_build/html", + "restructuredtext.confPath": "${workspaceRoot}/docs", + "restructuredtext.linter.executablePath": "${workspaceRoot}/.tox/docs/bin/restructuredtext-lint" } diff --git a/HISTORY.rst b/HISTORY.rst index 39d82662..09688163 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,11 +9,13 @@ PlatformIO 3.0 * Pre/Post extra scripting for advanced control of PIO Build System (`issue #891 `_) -* Added ``monitor_*`` options to white-list for `Project Configuration File "platformio.ini" `__ - (`issue #982 `_) +* Add "inc" folder automatically to CPPPATH when "src" is available (works for project and library) + (`issue #1003 `_) * Use a root of library when filtering source code using `library.json `__ and ``srcFilter`` field +* Added ``monitor_*`` options to white-list for `Project Configuration File "platformio.ini" `__ + (`issue #982 `_) * Do not ask for board ID when initialize project for desktop platform * Handle broken PIO Core state and create new one * Fixed an issue with a custom transport for `PIO Unit Testing `__ @@ -1434,7 +1436,6 @@ PlatformIO 0.0 * Added support for *Microduino* and *Raspduino* boards in `atmelavr `_ platform - 0.3.1 (2014-06-21) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index a7bbc6f4..4e6f3b02 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -150,7 +150,10 @@ class LibBuilderBase(object): return join("$BUILD_DIR", "lib", basename(self.path)) def get_inc_dirs(self): - return [self.src_dir] + items = [self.src_dir] + if all([isdir(join(self.path, d)) for d in ("inc", "src")]): + items.append(join(self.path, "inc")) + return items @property def build_flags(self): @@ -383,24 +386,26 @@ class LibBuilderBase(object): for lb in self._circular_deps: self.env.AppendUnique(CPPPATH=lb.get_inc_dirs()) - if not self._is_built: - self.env.AppendUnique(CPPPATH=self.get_inc_dirs()) + if self._is_built: + return libs + self._is_built = True - if self.lib_ldf_mode == "off": - for lb in self.envorigin.GetLibBuilders(): - if self == lb or not lb.is_built: - continue - for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): - self.env.AppendUnique(**{key: lb.env.get(key)}) + self.env.AppendUnique(CPPPATH=self.get_inc_dirs()) - if self.lib_archive: - libs.append( - self.env.BuildLibrary(self.build_dir, self.src_dir, - self.src_filter)) - else: - self.env.BuildSources(self.build_dir, self.src_dir, - self.src_filter) - self._is_built = True + if self.lib_ldf_mode == "off": + for lb in self.envorigin.GetLibBuilders(): + if self == lb or not lb.is_built: + continue + for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): + self.env.AppendUnique(**{key: lb.env.get(key)}) + + if self.lib_archive: + libs.append( + self.env.BuildLibrary(self.build_dir, self.src_dir, + self.src_filter)) + else: + self.env.BuildSources(self.build_dir, self.src_dir, + self.src_filter) return libs @@ -408,45 +413,6 @@ class UnknownLibBuilder(LibBuilderBase): pass -class ProjectAsLibBuilder(LibBuilderBase): - - def __init__(self, *args, **kwargs): - LibBuilderBase.__init__(self, *args, **kwargs) - self._is_built = True - - @property - def src_dir(self): - return self.env.subst("$PROJECTSRC_DIR") - - @property - def lib_ldf_mode(self): - mode = LibBuilderBase.lib_ldf_mode.fget(self) - if not mode.startswith("chain"): - return mode - # parse all project files - return "deep+" if "+" in mode else "deep" - - @property - def src_filter(self): - return self.env.get("SRC_FILTER", LibBuilderBase.src_filter.fget(self)) - - def process_extra_options(self): - # skip for project, options are already processed - pass - - def search_deps_recursive(self, search_paths=None): - for dep in self.env.get("LIB_DEPS", []): - for token in ("@", "="): - if token in dep: - dep, _ = dep.split(token, 1) - for lb in self.envorigin.GetLibBuilders(): - if lb.name == dep: - if lb not in self.depbuilders: - self.depend_recursive(lb) - break - return LibBuilderBase.search_deps_recursive(self, search_paths) - - class ArduinoLibBuilder(LibBuilderBase): def load_manifest(self): @@ -598,6 +564,46 @@ class PlatformIOLibBuilder(LibBuilderBase): return inc_dirs +class ProjectAsLibBuilder(LibBuilderBase): + + @property + def src_dir(self): + return self.env.subst("$PROJECTSRC_DIR") + + @property + def lib_ldf_mode(self): + mode = LibBuilderBase.lib_ldf_mode.fget(self) + if not mode.startswith("chain"): + return mode + # parse all project files + return "deep+" if "+" in mode else "deep" + + @property + def src_filter(self): + return self.env.get("SRC_FILTER", LibBuilderBase.src_filter.fget(self)) + + def process_extra_options(self): + # skip for project, options are already processed + pass + + def search_deps_recursive(self, search_paths=None): + for dep in self.env.get("LIB_DEPS", []): + for token in ("@", "="): + if token in dep: + dep, _ = dep.split(token, 1) + for lb in self.envorigin.GetLibBuilders(): + if lb.name == dep: + if lb not in self.depbuilders: + self.depend_recursive(lb) + break + return LibBuilderBase.search_deps_recursive(self, search_paths) + + def build(self): + self._is_built = True # do not build Project now + self.env.AppendUnique(CPPPATH=self.get_inc_dirs()) + return LibBuilderBase.build(self) + + def GetLibBuilders(env): # pylint: disable=too-many-branches if "__PIO_LIB_BUILDERS" in DefaultEnvironment(): @@ -664,7 +670,7 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches return items -def BuildDependentLibraries(env, src_dir): +def BuildProjectLibraries(env): lib_builders = env.GetLibBuilders() def correct_found_libs(): @@ -693,7 +699,7 @@ def BuildDependentLibraries(env, src_dir): print "Collected %d compatible libraries" % len(lib_builders) print "Looking for dependencies..." - project = ProjectAsLibBuilder(env, src_dir) + project = ProjectAsLibBuilder(env, "$PROJECT_DIR") project.env = env project.search_deps_recursive() @@ -717,5 +723,5 @@ def exists(_): def generate(env): env.AddMethod(GetLibBuilders) - env.AddMethod(BuildDependentLibraries) + env.AddMethod(BuildProjectLibraries) return env diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 79e8d212..cbe4c3e5 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -63,7 +63,7 @@ def BuildProgram(env): _append_pio_macros() # build dependent libs - deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR") + deplibs = env.BuildProjectLibraries() # append specified LD_SCRIPT if ("LDSCRIPT_PATH" in env @@ -79,7 +79,6 @@ def BuildProgram(env): env.ProcessFlags(env.get("SRC_BUILD_FLAGS")) env.Append( - CPPPATH=["$PROJECTSRC_DIR"], LIBS=deplibs, LIBPATH=["$BUILD_DIR"], PIOBUILDFILES=env.CollectBuildFiles( diff --git a/tox.ini b/tox.ini index 7ced7a1c..d0974980 100644 --- a/tox.ini +++ b/tox.ini @@ -31,6 +31,7 @@ basepython = python2.7 deps = sphinx sphinx_rtd_theme + restructuredtext-lint commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html sphinx-build -W -b latex -d {envtmpdir}/doctrees docs docs/_build/latex From 7f63928d21f97cf5e9144f7b9775bcb8bab139ce Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 2 Aug 2017 01:06:06 +0300 Subject: [PATCH 68/70] New lib_archive option to control library archiving and linking behaviour // Resolve #993 --- HISTORY.rst | 3 +++ docs | 2 +- platformio/builder/main.py | 1 + platformio/builder/tools/piolib.py | 2 +- platformio/commands/run.py | 10 +++++----- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 09688163..3d769625 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,9 @@ PlatformIO 3.0 * Pre/Post extra scripting for advanced control of PIO Build System (`issue #891 `_) +* New `lib_archive `_ + option to control library archiving and linking behaviour + (`issue #993 `_) * Add "inc" folder automatically to CPPPATH when "src" is available (works for project and library) (`issue #1003 `_) * Use a root of library when filtering source code using diff --git a/docs b/docs index 6dcdabb9..ebd68b4b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 6dcdabb99f74d2ba181e666cc1818697c255e271 +Subproject commit ebd68b4bac5ea3dcb526637dce1f782cc2ce570d diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 7df25c85..f811c13a 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -50,6 +50,7 @@ commonvars.AddVariables( ("LIB_DEPS",), ("LIB_IGNORE",), ("LIB_EXTRA_DIRS",), + ("LIB_ARCHIVE",), # board options ("BOARD",), diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 4e6f3b02..ddc8229e 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -169,7 +169,7 @@ class LibBuilderBase(object): @property def lib_archive(self): - return True + return self.env.get("LIB_ARCHIVE", "") != "false" @staticmethod def validate_ldf_mode(mode): diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 5c35c4d2..fd7a29a0 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -132,11 +132,11 @@ class EnvironmentProcessor(object): "upload_protocol", "upload_speed", "upload_flags", "upload_resetmethod", "lib_deps", "lib_ignore", "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "piotest", "test_transport", "test_ignore", "test_port", - "debug_tool", "debug_port", "debug_init_cmds", - "debug_extra_cmds", "debug_server", "debug_init_break", - "debug_load_cmd", "monitor_port", "monitor_baud", - "monitor_rts", "monitor_dtr") + "lib_archive", "piotest", "test_transport", "test_ignore", + "test_port", "debug_tool", "debug_port", + "debug_init_cmds", "debug_extra_cmds", "debug_server", + "debug_init_break", "debug_load_cmd", "monitor_port", + "monitor_baud", "monitor_rts", "monitor_dtr") IGNORE_BUILD_OPTIONS = ("test_transport", "test_filter", "test_ignore", "test_port", "debug_tool", "debug_port", From f0f1d0a61a4025f68e7086b116ef32e5bd8fcd7d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 2 Aug 2017 01:08:07 +0300 Subject: [PATCH 69/70] Bump version to 3.4.1rc1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index b4f15d85..379bae29 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1b1") +VERSION = (3, 4, "1rc1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From e959710d6d4865bbc6a6157299e306a2df0b1b91 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 2 Aug 2017 16:51:19 +0300 Subject: [PATCH 70/70] Version bump to 3.4.1 (issues #891, #982, #993, #1000, #1001, #1003 ) --- HISTORY.rst | 2 +- platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3d769625..ad714683 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,7 @@ Release Notes PlatformIO 3.0 -------------- -3.4.1 (2017-??-??) +3.4.1 (2017-08-02) ~~~~~~~~~~~~~~~~~~ * Pre/Post extra scripting for advanced control of PIO Build System diff --git a/platformio/__init__.py b/platformio/__init__.py index 379bae29..6e3f3cc4 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "1rc1") +VERSION = (3, 4, 1) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"