Skip to content

Commit d80a9c8

Browse files
committed
Merge branch 'release/v4.3.0'
2 parents 80acd52 + 6414e1d commit d80a9c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+894
-883
lines changed

.appveyor.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ environment:
77
matrix:
88
- TOXENV: "py27"
99
PLATFORMIO_BUILD_CACHE_DIR: C:\Temp\PIO_Build_Cache_P2_{build}
10+
PYTHON_DIRS: C:\Python27-x64;C:\Python27-x64\Scripts
1011

1112
- TOXENV: "py36"
1213
PLATFORMIO_BUILD_CACHE_DIR: C:\Temp\PIO_Build_Cache_P3_{build}
14+
PYTHON_DIRS: C:\Python36-x64;C:\Python36-x64\Scripts
1315

1416
install:
1517
- cmd: git submodule update --init --recursive
16-
- cmd: SET PATH=C:\MinGW\bin;%PATH%
18+
- cmd: SET PATH=%PYTHON_DIRS%;C:\MinGW\bin;%PATH%
1719
- cmd: SET PLATFORMIO_CORE_DIR=C:\.pio
1820
- cmd: pip install --force-reinstall tox
1921

.style.yapf

-3
This file was deleted.

HISTORY.rst

+33-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,38 @@ Release Notes
66
PlatformIO Core 4
77
-----------------
88

9+
4.3.0 (2020-03-19)
10+
~~~~~~~~~~~~~~~~~~
11+
12+
* Initial support for an official `PlatformIO for CLion IDE <https://docs.platformio.org/page/integration/ide/clion.html>`__ plugin:
13+
14+
- Smart C and C++ editor
15+
- Code refactoring
16+
- On-the-fly code analysis
17+
- "New PlatformIO Project" wizard
18+
- Building, Uploading, Testing
19+
- Integrated debugger (inline variable view, conditional breakpoints, expressions, watchpoints, peripheral registers, multi-thread support, etc.)
20+
21+
* `Device Monitor 2.0 <https://docs.platformio.org/page/core/userguide/device/cmd_monitor.html>`__
22+
23+
- Added **PlatformIO Device Monitor Filter API** (dev-platforms can extend base device monitor with a custom functionality, such as exception decoding) (`pull #3383 <https://github.com/platformio/platformio-core/pull/3383>`_)
24+
- Configure project device monitor with `monitor_filters <https://docs.platformio.org/page/projectconf/section_env_monitor.html#monitor-filters>`__ option
25+
- `Capture device monitor output to a file <https://docs.platformio.org/page/core/userguide/device/cmd_monitor.html#capture-output-to-a-file>`__ with ``log2file`` filter (`issue #670 <https://github.com/platformio/platformio-core/issues/670>`_)
26+
- Show a timestamp for each new line with ``time`` filter (`issue #981 <https://github.com/platformio/platformio-core/issues/981>`_)
27+
- Send a text to device on ENTER with ``send_on_enter`` filter (`issue #926 <https://github.com/platformio/platformio-core/issues/926>`_)
28+
- Show a hexadecimal representation of the data (code point of each character) with ``hexlify`` filter
29+
30+
* New standalone (1-script) `PlatformIO Core Installer <https://github.com/platformio/platformio-core-installer>`_
31+
* Initial support for `Renode <https://docs.platformio.org/page/plus/debug-tools/qemu.html>`__ simulation framework (`issue #3401 <https://github.com/platformio/platformio-core/issues/3401>`_)
32+
* Added support for Arm Mbed "module.json" ``dependencies`` field (`issue #3400 <https://github.com/platformio/platformio-core/issues/3400>`_)
33+
* Improved support for Arduino "library.properties" ``depends`` field
34+
* Fixed an issue when quitting from PlatformIO IDE does not shutdown PIO Home server
35+
* Fixed an issue "the JSON object must be str, not 'bytes'" when PIO Home is used with Python 3.5 (`issue #3396 <https://github.com/platformio/platformio-core/issues/3396>`_)
36+
* Fixed an issue when Python 2 does not keep encoding when converting ".ino" (`issue #3393 <https://github.com/platformio/platformio-core/issues/3393>`_)
37+
* Fixed an issue when ``"libArchive": false`` in "library.json" does not work (`issue #3403 <https://github.com/platformio/platformio-core/issues/3403>`_)
38+
* Fixed an issue when not all commands in `compilation database "compile_commands.json" <https://docs.platformio.org/page/integration/compile_commands.html>`__ use absolute paths (`pull #3415 <https://github.com/platformio/platformio-core/pull/3415>`_)
39+
* Fixed an issue when unknown transport is used for `PIO Unit Testing <https://docs.platformio.org/page/plus/unit-testing.html>`__ engine (`issue #3422 <https://github.com/platformio/platformio-core/issues/3422>`_)
40+
941
4.2.1 (2020-02-17)
1042
~~~~~~~~~~~~~~~~~~
1143

@@ -34,7 +66,7 @@ PlatformIO Core 4
3466
- Show computed project configuration with a new `platformio project config <https://docs.platformio.org/page/userguide/project/cmd_config.html>`_ command or dump to JSON with ``platformio project config --json-output`` (`issue #3335 <https://github.com/platformio/platformio-core/issues/3335>`_)
3567
- Moved ``platformio init`` command to `platformio project init <https://docs.platformio.org/page/userguide/project/cmd_init.html>`_
3668

37-
* Generate `compilation database "compile_commands.json" <https://docs.platformio.org/page/faq.html#compilation-database-compile-commands-json>`_ (`issue #2990 <https://github.com/platformio/platformio-core/issues/2990>`_)
69+
* Generate `compilation database "compile_commands.json" <https://docs.platformio.org/page/integration/compile_commands.html>`__ (`issue #2990 <https://github.com/platformio/platformio-core/issues/2990>`_)
3870
* Control debug flags and optimization level with a new `debug_build_flags <https://docs.platformio.org/page/projectconf/section_env_debug.html#debug-build-flags>`__ option
3971
* Install a dev-platform with ALL declared packages using a new ``--with-all-packages`` option for `pio platform install <https://docs.platformio.org/page/userguide/platforms/cmd_install.html>`__ command (`issue #3345 <https://github.com/platformio/platformio-core/issues/3345>`_)
4072
* Added support for "pythonPackages" in `platform.json <https://docs.platformio.org/page/platforms/creating_platform.html#manifest-file-platform-json>`__ manifest (PlatformIO Package Manager will install dependent Python packages from PyPi registry automatically when dev-platform is installed)

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ Instruments
5858
* `Continuous Integration <https://docs.platformio.org/page/ci/index.html?utm_source=github&utm_medium=core>`_
5959
* `Advanced Scripting API <https://docs.platformio.org/page/projectconf/advanced_scripting.html?utm_source=github&utm_medium=core>`_
6060

61-
PIO Plus
62-
--------
61+
Professional
62+
------------
6363

6464
* `PIO Check <https://docs.platformio.org/page/plus/pio-check.html?utm_source=github&utm_medium=core>`_
6565
* `PIO Remote <https://docs.platformio.org/page/plus/pio-remote.html?utm_source=github&utm_medium=core>`_

docs

Submodule docs updated 163 files

platformio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
VERSION = (4, 2, 1)
15+
VERSION = (4, 3, 0)
1616
__version__ = ".".join([str(s) for s in VERSION])
1717

1818
__title__ = "platformio"

platformio/builder/tools/compilation_db.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ def EmitCompilationDbEntry(target, source, env):
7676
:return: target(s), source(s)
7777
"""
7878

79+
# Resolve absolute path of toolchain
80+
for cmd in ("CC", "CXX", "AS"):
81+
if cmd not in env:
82+
continue
83+
if os.path.isabs(env[cmd]):
84+
continue
85+
env[cmd] = where_is_program(
86+
env.subst("$%s" % cmd), env.subst("${ENV['PATH']}")
87+
)
88+
7989
dbtarget = __CompilationDbNode(source)
8090

8191
entry = env.__COMPILATIONDB_Entry(
@@ -195,14 +205,6 @@ def generate(env, **kwargs):
195205
)
196206

197207
def CompilationDatabase(env, target):
198-
# Resolve absolute path of toolchain
199-
for cmd in ("CC", "CXX", "AS"):
200-
if cmd not in env:
201-
continue
202-
env[cmd] = where_is_program(
203-
env.subst("$%s" % cmd), env.subst("${ENV['PATH']}")
204-
)
205-
206208
result = env.__COMPILATIONDB_Database(target=target, source=[])
207209

208210
env.AlwaysBuild(result)

platformio/builder/tools/piolib.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from __future__ import absolute_import
1919

2020
import hashlib
21+
import io
2122
import os
2223
import re
2324
import sys
@@ -82,7 +83,8 @@ def get_used_frameworks(env, path):
8283
fname, piotool.SRC_BUILD_EXT + piotool.SRC_HEADER_EXT
8384
):
8485
continue
85-
content = fs.get_file_contents(join(root, fname))
86+
with io.open(join(root, fname), errors="ignore") as fp:
87+
content = fp.read()
8688
if not content:
8789
continue
8890
if "Arduino.h" in content and include_re.search(content):
@@ -716,9 +718,11 @@ def extra_script(self):
716718

717719
@property
718720
def lib_archive(self):
719-
unique_value = "_not_declared_%s" % id(self)
720-
global_value = self.env.GetProjectOption("lib_archive", unique_value)
721-
if global_value != unique_value:
721+
missing = object()
722+
global_value = self.env.GetProjectConfig().getraw(
723+
"env:" + self.env["PIOENV"], "lib_archive", missing
724+
)
725+
if global_value != missing:
722726
return global_value
723727
return self._manifest.get("build", {}).get(
724728
"libArchive", LibBuilderBase.lib_archive.fget(self)

platformio/builder/tools/piomaxlen.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from os import makedirs
1919
from os.path import isdir, isfile, join
2020

21-
from platformio import fs
2221
from platformio.compat import WINDOWS, hashlib_encode_data
2322

2423
# Windows CLI has limit with command length to 8192
@@ -67,7 +66,8 @@ def _file_long_data(env, data):
6766
)
6867
if isfile(tmp_file):
6968
return tmp_file
70-
fs.write_file_contents(tmp_file, data)
69+
with open(tmp_file, "w") as fp:
70+
fp.write(data)
7171
return tmp_file
7272

7373

platformio/builder/tools/piomisc.py

+40-7
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@
1515
from __future__ import absolute_import
1616

1717
import atexit
18+
import io
1819
import re
1920
import sys
2021
from os import environ, remove, walk
2122
from os.path import basename, isdir, isfile, join, realpath, relpath, sep
2223
from tempfile import mkstemp
2324

25+
import click
2426
from SCons.Action import Action # pylint: disable=import-error
2527
from SCons.Script import ARGUMENTS # pylint: disable=import-error
2628

2729
from platformio import fs, util
28-
from platformio.compat import glob_escape
30+
from platformio.compat import get_filesystem_encoding, get_locale_encoding, glob_escape
2931
from platformio.managers.core import get_core_package_dir
3032
from platformio.proc import exec_command
3133

@@ -48,6 +50,39 @@ class InoToCPPConverter(object):
4850
def __init__(self, env):
4951
self.env = env
5052
self._main_ino = None
53+
self._safe_encoding = None
54+
55+
def read_safe_contents(self, path):
56+
error_reported = False
57+
for encoding in (
58+
"utf-8",
59+
None,
60+
get_filesystem_encoding(),
61+
get_locale_encoding(),
62+
"latin-1",
63+
):
64+
try:
65+
with io.open(path, encoding=encoding) as fp:
66+
contents = fp.read()
67+
self._safe_encoding = encoding
68+
return contents
69+
except UnicodeDecodeError:
70+
if not error_reported:
71+
error_reported = True
72+
click.secho(
73+
"Unicode decode error has occurred, please remove invalid "
74+
"(non-ASCII or non-UTF8) characters from %s file or convert it to UTF-8"
75+
% path,
76+
fg="yellow",
77+
err=True,
78+
)
79+
return ""
80+
81+
def write_safe_contents(self, path, contents):
82+
with io.open(
83+
path, "w", encoding=self._safe_encoding, errors="backslashreplace"
84+
) as fp:
85+
return fp.write(contents)
5186

5287
def is_main_node(self, contents):
5388
return self.DETECTMAIN_RE.search(contents)
@@ -62,7 +97,7 @@ def merge(self, nodes):
6297
assert nodes
6398
lines = []
6499
for node in nodes:
65-
contents = fs.get_file_contents(node.get_path())
100+
contents = self.read_safe_contents(node.get_path())
66101
_lines = ['# 1 "%s"' % node.get_path().replace("\\", "/"), contents]
67102
if self.is_main_node(contents):
68103
lines = _lines + lines
@@ -78,16 +113,14 @@ def merge(self, nodes):
78113
def process(self, contents):
79114
out_file = self._main_ino + ".cpp"
80115
assert self._gcc_preprocess(contents, out_file)
81-
contents = fs.get_file_contents(out_file)
116+
contents = self.read_safe_contents(out_file)
82117
contents = self._join_multiline_strings(contents)
83-
fs.write_file_contents(
84-
out_file, self.append_prototypes(contents), errors="backslashreplace"
85-
)
118+
self.write_safe_contents(out_file, self.append_prototypes(contents))
86119
return out_file
87120

88121
def _gcc_preprocess(self, contents, out_file):
89122
tmp_path = mkstemp()[1]
90-
fs.write_file_contents(tmp_path, contents, errors="backslashreplace")
123+
self.write_safe_contents(tmp_path, contents)
91124
self.env.Execute(
92125
self.env.VerboseAction(
93126
'$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format(

platformio/builder/tools/pioproject.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from __future__ import absolute_import
1616

17-
from platformio.project.config import ProjectConfig, ProjectOptions
17+
from platformio.project.config import MISSING, ProjectConfig, ProjectOptions
1818

1919

2020
def GetProjectConfig(env):
@@ -25,7 +25,7 @@ def GetProjectOptions(env, as_dict=False):
2525
return env.GetProjectConfig().items(env=env["PIOENV"], as_dict=as_dict)
2626

2727

28-
def GetProjectOption(env, option, default=None):
28+
def GetProjectOption(env, option, default=MISSING):
2929
return env.GetProjectConfig().get("env:" + env["PIOENV"], option, default)
3030

3131

0 commit comments

Comments
 (0)