Skip to content

Commit 80acd52

Browse files
committed
Merge branch 'release/v4.2.1'
2 parents f7d4bf5 + 82f36a1 commit 80acd52

File tree

15 files changed

+217
-68
lines changed

15 files changed

+217
-68
lines changed

HISTORY.rst

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
Release Notes
22
=============
33

4-
.. _release_notes_4_0:
4+
.. _release_notes_4:
5+
6+
PlatformIO Core 4
7+
-----------------
8+
9+
4.2.1 (2020-02-17)
10+
~~~~~~~~~~~~~~~~~~
11+
12+
* Improved VSCode template with special ``forceInclude`` field for direct includes via ``-include`` flag (`issue #3379 <https://github.com/platformio/platformio-core/issues/3379>`_)
13+
* Improved support of PIO Home on card-sized PC (Raspberry Pi, etc.) (`issue #3313 <https://github.com/platformio/platformio-core/issues/3313>`_)
14+
* Froze "marshmallow" dependency to 2.X for Python 2 (`issue #3380 <https://github.com/platformio/platformio-core/issues/3380>`_)
15+
* Fixed "TypeError: unsupported operand type(s)" when system environment variable is used by project configuration parser (`issue #3377 <https://github.com/platformio/platformio-core/issues/3377>`_)
16+
* Fixed an issue when Library Dependency Finder (LDF) ignores custom "libLDFMode" and "libCompatMode" options in `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__
17+
* Fixed an issue when generating of compilation database "compile_commands.json" does not work with Python 2.7 (`issue #3378 <https://github.com/platformio/platformio-core/issues/3378>`_)
518

6-
PlatformIO Core 4.0
7-
-------------------
819

920
4.2.0 (2020-02-12)
1021
~~~~~~~~~~~~~~~~~~
@@ -182,8 +193,8 @@ PlatformIO Core 4.0
182193
- Fixed "systemd-udevd" warnings in `99-platformio-udev.rules <http://docs.platformio.org/page/faq.html#platformio-udev-rules>`__ (`issue #2442 <https://github.com/platformio/platformio-core/issues/2442>`_)
183194
- Fixed an issue when package cache (Library Manager) expires too fast (`issue #2559 <https://github.com/platformio/platformio-core/issues/2559>`_)
184195

185-
PlatformIO Core 3.0
186-
-------------------
196+
PlatformIO Core 3
197+
-----------------
187198

188199
3.6.7 (2019-04-23)
189200
~~~~~~~~~~~~~~~~~~
@@ -783,8 +794,8 @@ PlatformIO Core 3.0
783794
(`issue #742 <https://github.com/platformio/platformio-core/issues/742>`_)
784795
* Stopped supporting Python 2.6
785796

786-
PlatformIO Core 2.0
787-
--------------------
797+
PlatformIO Core 2
798+
-----------------
788799

789800
2.11.2 (2016-08-02)
790801
~~~~~~~~~~~~~~~~~~~
@@ -1569,8 +1580,8 @@ PlatformIO Core 2.0
15691580
* Fixed bug with creating copies of source files
15701581
(`issue #177 <https://github.com/platformio/platformio-core/issues/177>`_)
15711582

1572-
PlatformIO Core 1.0
1573-
-------------------
1583+
PlatformIO Core 1
1584+
-----------------
15741585

15751586
1.5.0 (2015-05-15)
15761587
~~~~~~~~~~~~~~~~~~
@@ -1760,8 +1771,8 @@ PlatformIO Core 1.0
17601771
error (`issue #81 <https://github.com/platformio/platformio-core/issues/81>`_)
17611772
* Several bug fixes, increased stability and performance improvements
17621773

1763-
PlatformIO Core 0.0
1764-
-------------------
1774+
PlatformIO Core Preview
1775+
-----------------------
17651776

17661777
0.10.2 (2015-01-06)
17671778
~~~~~~~~~~~~~~~~~~~

platformio/__init__.py

Lines changed: 1 addition & 1 deletion
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, 0)
15+
VERSION = (4, 2, 1)
1616
__version__ = ".".join([str(s) for s in VERSION])
1717

1818
__title__ = "platformio"

platformio/builder/tools/compilation_db.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import SCons
2626

2727
from platformio.builder.tools.platformio import SRC_ASM_EXT, SRC_C_EXT, SRC_CXX_EXT
28+
from platformio.proc import where_is_program
2829

2930
# Implements the ability for SCons to emit a compilation database for the MongoDB project. See
3031
# http://clang.llvm.org/docs/JSONCompilationDatabase.html for details on what a compilation
@@ -49,7 +50,7 @@ def __init__(self, value):
4950
self.Decider(changed_since_last_build_node)
5051

5152

52-
def changed_since_last_build_node(child, target, prev_ni, node):
53+
def changed_since_last_build_node(*args, **kwargs):
5354
""" Dummy decider to force always building"""
5455
return True
5556

@@ -145,7 +146,6 @@ def ScanCompilationDb(node, env, path):
145146

146147

147148
def generate(env, **kwargs):
148-
149149
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
150150

151151
env["COMPILATIONDB_COMSTR"] = kwargs.get(
@@ -195,6 +195,14 @@ def generate(env, **kwargs):
195195
)
196196

197197
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+
198206
result = env.__COMPILATIONDB_Database(target=target, source=[])
199207

200208
env.AlwaysBuild(result)

platformio/builder/tools/piolib.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,22 +727,16 @@ def lib_archive(self):
727727
@property
728728
def lib_ldf_mode(self):
729729
return self.validate_ldf_mode(
730-
self.env.GetProjectOption(
731-
"lib_ldf_mode",
732-
self._manifest.get("build", {}).get(
733-
"libLDFMode", LibBuilderBase.lib_ldf_mode.fget(self)
734-
),
730+
self._manifest.get("build", {}).get(
731+
"libLDFMode", LibBuilderBase.lib_ldf_mode.fget(self)
735732
)
736733
)
737734

738735
@property
739736
def lib_compat_mode(self):
740737
return self.validate_compat_mode(
741-
self.env.GetProjectOption(
742-
"lib_compat_mode",
743-
self._manifest.get("build", {}).get(
744-
"libCompatMode", LibBuilderBase.lib_compat_mode.fget(self)
745-
),
738+
self._manifest.get("build", {}).get(
739+
"libCompatMode", LibBuilderBase.lib_compat_mode.fget(self)
746740
)
747741
)
748742

platformio/commands/debug/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def spawn(self, patterns): # pylint: disable=too-many-branches
5858
"\nCould not launch Debug Server '%s'. Please check that it "
5959
"is installed and is included in a system PATH\n\n"
6060
"See documentation or contact [email protected]:\n"
61-
"http://docs.platformio.org/page/plus/debugging.html\n"
61+
"https://docs.platformio.org/page/plus/debugging.html\n"
6262
% server_executable
6363
)
6464

platformio/commands/home/command.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222

2323
from platformio import exception
2424
from platformio.compat import WINDOWS
25-
from platformio.managers.core import get_core_package_dir, inject_contrib_pysite
25+
from platformio.managers.core import (
26+
build_contrib_pysite_deps,
27+
get_core_package_dir,
28+
inject_contrib_pysite,
29+
)
2630

2731

2832
@click.command("home", short_help="PIO Home")
@@ -50,7 +54,13 @@ def cli(port, host, no_open, shutdown_timeout):
5054

5155
# import contrib modules
5256
inject_contrib_pysite()
53-
from autobahn.twisted.resource import WebSocketResource
57+
58+
try:
59+
from autobahn.twisted.resource import WebSocketResource
60+
except: # pylint: disable=bare-except
61+
build_contrib_pysite_deps(get_core_package_dir("contrib-pysite"))
62+
from autobahn.twisted.resource import WebSocketResource
63+
5464
from twisted.internet import reactor
5565
from twisted.web import server
5666

platformio/commands/run/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def handle_legacy_libdeps(project_dir, config):
3636
"DEPRECATED! A legacy library storage `{0}` has been found in a "
3737
"project. \nPlease declare project dependencies in `platformio.ini`"
3838
" file using `lib_deps` option and remove `{0}` folder."
39-
"\nMore details -> http://docs.platformio.org/page/projectconf/"
39+
"\nMore details -> https://docs.platformio.org/page/projectconf/"
4040
"section_env_library.html#lib-deps".format(legacy_libdeps_dir),
4141
fg="yellow",
4242
)

platformio/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,6 @@ class TestDirNotExists(PlatformioException):
301301
"A test folder '{0}' does not exist.\nPlease create 'test' "
302302
"directory in project's root and put a test set.\n"
303303
"More details about Unit "
304-
"Testing: http://docs.platformio.org/page/plus/"
304+
"Testing: https://docs.platformio.org/page/plus/"
305305
"unit-testing.html"
306306
)

platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl

Lines changed: 76 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
{
2-
"configurations": [
3-
{
4-
"name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
5-
},
6-
{
1+
% import os
72
% import platform
8-
% from os.path import commonprefix, dirname, isdir
3+
% import re
4+
%
5+
% import click
96
%
107
% systype = platform.system().lower()
118
%
@@ -17,38 +14,79 @@
1714
% return " " in flag and systype == "windows"
1815
% end
1916
%
20-
% def _split_flags(flags):
17+
% def split_args(args_string):
18+
% return click.parser.split_arg_string(to_unix_path(args_string))
19+
% end
20+
%
21+
% def filter_args(args, allowed, ignore=None):
22+
% if not allowed:
23+
% return []
24+
% end
25+
%
26+
% ignore = ignore or []
2127
% result = []
2228
% i = 0
23-
% flags = flags.strip()
24-
% while i < len(flags):
25-
% current_arg = []
26-
% while i < len(flags) and flags[i] != " ":
27-
% if flags[i] == '"':
28-
% quotes_idx = flags.find('"', i + 1)
29-
% current_arg.extend(flags[i + 1:quotes_idx])
30-
% i = quotes_idx + 1
31-
% else:
32-
% current_arg.append(flags[i])
33-
% i = i + 1
34-
% end
35-
% end
36-
% arg = "".join(current_arg)
37-
% if arg.strip():
38-
% result.append(arg.strip())
29+
% length = len(args)
30+
% while(i < length):
31+
% if any(args[i].startswith(f) for f in allowed) and not any(
32+
% args[i].startswith(f) for f in ignore):
33+
% result.append(args[i])
34+
% if i + 1 < length and not args[i + 1].startswith("-"):
35+
% i += 1
36+
% result.append(args[i])
37+
% end
3938
% end
40-
% i = i + 1
39+
% i += 1
40+
% end
41+
% return result
42+
% end
43+
%
44+
% def _find_abs_path(inc, inc_paths):
45+
% for path in inc_paths:
46+
% if os.path.isfile(os.path.join(path, inc)):
47+
% return os.path.join(path, inc)
48+
% end
49+
% end
50+
% return inc
51+
% end
52+
%
53+
% def _find_forced_includes(flags, inc_paths):
54+
% result = []
55+
% for f in flags:
56+
% inc = ""
57+
% if f.startswith("-include") and f.split("-include")[1].strip():
58+
% inc = f.split("-include")[1].strip()
59+
% elif not f.startswith("-"):
60+
% inc = f
61+
% end
62+
% if inc:
63+
% result.append(_find_abs_path(inc, inc_paths))
64+
% end
4165
% end
4266
% return result
4367
% end
4468
%
4569
% cleaned_includes = []
4670
% for include in includes:
47-
% if "toolchain-" not in dirname(commonprefix([include, cc_path])) and isdir(include):
71+
% if "toolchain-" not in os.path.dirname(os.path.commonprefix(
72+
% [include, cc_path])) and os.path.isdir(include):
4873
% cleaned_includes.append(include)
4974
% end
5075
% end
5176
%
77+
% STD_RE = re.compile(r"\-std=[a-z\+]+(\d+)")
78+
% cc_stds = STD_RE.findall(cc_flags)
79+
% cxx_stds = STD_RE.findall(cxx_flags)
80+
% cc_m_flags = split_args(cc_flags)
81+
% forced_includes = _find_forced_includes(
82+
% filter_args(cc_m_flags, ["-include"]), cleaned_includes)
83+
%
84+
{
85+
"configurations": [
86+
{
87+
"name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
88+
},
89+
{
5290
% if systype == "windows":
5391
"name": "Win32",
5492
% elif systype == "darwin":
@@ -79,21 +117,26 @@
79117
""
80118
],
81119
"intelliSenseMode": "clang-x64",
82-
% import re
83-
% STD_RE = re.compile(r"\-std=[a-z\+]+(\d+)")
84-
% cc_stds = STD_RE.findall(cc_flags)
85-
% cxx_stds = STD_RE.findall(cxx_flags)
86-
%
87120
% if cc_stds:
88121
"cStandard": "c{{ cc_stds[-1] }}",
89122
% end
90123
% if cxx_stds:
91124
"cppStandard": "c++{{ cxx_stds[-1] }}",
125+
% end
126+
% if forced_includes:
127+
"forcedInclude": [
128+
% for include in forced_includes:
129+
"{{ include }}",
130+
% end
131+
""
132+
],
92133
% end
93134
"compilerPath": "{{ cc_path }}",
94135
"compilerArgs": [
95-
% for flag in [ '"%s"' % _escape(f) if _escape_required(f) else f for f in _split_flags(
96-
% cc_flags) if f.startswith(("-m", "-i", "@"))]:
136+
% for flag in [
137+
% '"%s"' % _escape(f) if _escape_required(f) else f
138+
% for f in filter_args(cc_m_flags, ["-m", "-i", "@"], ["-include"])
139+
% ]:
97140
"{{ flag }}",
98141
% end
99142
""

0 commit comments

Comments
 (0)