Skip to content

Commit 4504080

Browse files
committed
Merge branch 'release/v3.6.4'
2 parents 6db47ce + 367e4d6 commit 4504080

File tree

14 files changed

+112
-60
lines changed

14 files changed

+112
-60
lines changed

HISTORY.rst

+18-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,27 @@ Release Notes
44
PlatformIO 3.0
55
--------------
66

7+
3.6.4 (2019-01-23)
8+
~~~~~~~~~~~~~~~~~~
9+
10+
* Improved Project Generator for IDEs:
11+
12+
- Use full path to PlatformIO CLI when generating a project
13+
(`issue #1674 <https://github.com/platformio/platformio-core/issues/1674>`_)
14+
- CLion: Improved project portability using "${CMAKE_CURRENT_LIST_DIR}" instead of full path
15+
- Eclipse: Provide language standard to a project C/C++ indexer
16+
(`issue #1010 <https://github.com/platformio/platformio-core/issues/1010>`_)
17+
18+
* Fixed an issue with incorrect detecting of compatibility (LDF) between generic library and Arduino or ARM mbed frameworks
19+
* Fixed "Runtime Error: Dictionary size changed during iteration"
20+
(`issue #2003 <https://github.com/platformio/platformio-core/issues/2003>`_)
21+
* Fixed an error "Could not extract item..." when extracting TAR archive with symbolic items on Windows platform
22+
(`issue #2015 <https://github.com/platformio/platformio-core/issues/2015>`_)
23+
724
3.6.3 (2018-12-12)
825
~~~~~~~~~~~~~~~~~~
926

10-
* Ignore *.asm and *.ASM files when building Arduino-based library (compatibility with Arduino builder)
27+
* Ignore ``*.asm`` and ``*.ASM`` files when building Arduino-based library (compatibility with Arduino builder)
1128
* Fixed spurious project's "Problems" for `PlatformIO IDE for VSCode <http://docs.platformio.org/page/ide/vscode.html>`__ when ARM mbed framework is used
1229
* Fixed an issue with a broken headers list when generating ".clang_complete" for `Emacs <http://docs.platformio.org/page/ide/emacs.html>`__
1330
(`issue #1960 <https://github.com/platformio/platformio-core/issues/1960>`_)
@@ -50,7 +67,6 @@ PlatformIO 3.0
5067
(`issue #1873 <https://github.com/platformio/platformio-core/issues/1873>`_)
5168
* Fixed an issue with incorrect handling of a custom package name when using `platformio lib install <http://docs.platformio.org/page/userguide/lib/cmd_install.html>`__ or `platformio platform install <http://docs.platformio.org/page/userguide/platforms/cmd_install.html>`__ commands
5269

53-
5470
3.6.0 (2018-08-06)
5571
~~~~~~~~~~~~~~~~~~
5672

docs

Submodule docs updated 61 files

examples

platformio/__init__.py

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

1515
import sys
1616

17-
VERSION = (3, 6, 3)
17+
VERSION = (3, 6, 4)
1818
__version__ = ".".join([str(s) for s in VERSION])
1919

2020
__title__ = "platformio"

platformio/app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ def delete(self, keys=None):
226226
newlines = []
227227
with open(self._db_path) as fp:
228228
for line in fp.readlines():
229+
line = line.strip()
229230
if "=" not in line:
230231
continue
231-
line = line.strip()
232232
expire, path = line.split("=")
233233
if time() < int(expire) and isfile(path) and \
234234
path not in paths_for_delete:

platformio/builder/tools/piolib.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import hashlib
2121
import os
22+
import re
2223
import sys
2324
from glob import glob
2425
from os.path import (basename, commonprefix, dirname, isdir, isfile, join,
@@ -64,6 +65,9 @@ def get_used_frameworks(env, path):
6465
if isfile(join(path, "module.json")):
6566
return ["mbed"]
6667

68+
include_re = re.compile(
69+
r'^#include\s+(<|")(Arduino|mbed)\.h(<|")', flags=re.MULTILINE)
70+
6771
# check source files
6872
for root, _, files in os.walk(path, followlinks=True):
6973
for fname in files:
@@ -72,9 +76,9 @@ def get_used_frameworks(env, path):
7276
continue
7377
with open(join(root, fname)) as f:
7478
content = f.read()
75-
if "Arduino.h" in content:
79+
if "Arduino.h" in content and include_re.search(content):
7680
return ["arduino"]
77-
elif "mbed.h" in content:
81+
elif "mbed.h" in content and include_re.search(content):
7882
return ["mbed"]
7983
return []
8084

platformio/ide/projectgenerator.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import json
1616
import os
1717
import re
18+
import sys
1819
from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath
1920

2021
import bottle
@@ -146,7 +147,8 @@ def _gather_tplvars(self):
146147
"project_libdeps_dir": util.get_projectlibdeps_dir(),
147148
"systype": util.get_systype(),
148149
"platformio_path": self._fix_os_path(
149-
util.where_is_program("platformio")),
150+
sys.argv[0] if isfile(sys.argv[0])
151+
else util.where_is_program("platformio")),
150152
"env_pathsep": os.pathsep,
151153
"env_path": self._fix_os_path(os.getenv("PATH"))
152154
}) # yapf: disable
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
set(ENV{PATH} "{{env_path}}")
2-
set(PLATFORMIO_CMD "{{platformio_path}}")
1+
% def _normalize_path(path):
2+
% if project_dir in path:
3+
% path = path.replace(project_dir, "${CMAKE_CURRENT_LIST_DIR}")
4+
% elif user_home_dir in path:
5+
% if "windows" in systype:
6+
% path = path.replace(user_home_dir, "$ENV{HOMEDRIVE}$ENV{HOMEPATH}")
7+
% else:
8+
% path = path.replace(user_home_dir, "$ENV{HOME}")
9+
% end
10+
% end
11+
% return path.replace("\\", "/")
12+
% end
13+
14+
set(PLATFORMIO_CMD "{{ _normalize_path(platformio_path) }}")
315

4-
SET(CMAKE_C_COMPILER "{{cc_path.replace("\\", "/")}}")
5-
SET(CMAKE_CXX_COMPILER "{{cxx_path.replace("\\", "/")}}")
16+
SET(CMAKE_C_COMPILER "{{ _normalize_path(cc_path) }}")
17+
SET(CMAKE_CXX_COMPILER "{{ _normalize_path(cxx_path) }}")
618
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "{{cxx_flags}}")
719
SET(CMAKE_C_FLAGS_DISTRIBUTION "{{cc_flags}}")
820
set(CMAKE_CXX_STANDARD 11)
@@ -13,15 +25,7 @@ add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
1325
% end
1426

1527
% for include in includes:
16-
% if include.startswith(user_home_dir):
17-
% if "windows" in systype:
18-
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
19-
% else:
20-
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
21-
% end
22-
% else:
23-
include_directories("{{include.replace("\\", "/")}}")
24-
% end
28+
include_directories("{{ _normalize_path(include) }}")
2529
% end
2630

27-
FILE(GLOB_RECURSE SRC_LIST "{{project_src_dir.replace("\\", "/")}}/*.*" "{{project_lib_dir.replace("\\", "/")}}/*.*" "{{project_libdeps_dir.replace("\\", "/")}}/*.*")
31+
FILE(GLOB_RECURSE SRC_LIST "{{ _normalize_path(project_src_dir) }}/*.*" "{{ _normalize_path(project_lib_dir) }}/*.*" "{{ _normalize_path(project_libdeps_dir) }}/*.*")

platformio/ide/tpls/eclipse/.settings/language.settings.xml.tpl

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
% import re
2+
% STD_RE = re.compile(r"(\-std=[a-z\+]+\d+)")
3+
% cxx_stds = STD_RE.findall(cxx_flags)
4+
% cxx_std = cxx_stds[-1] if cxx_stds else ""
5+
%
16
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
27
<project>
38
<configuration id="0.910961921" name="Default">
@@ -6,9 +11,9 @@
611
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
712
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
813
% if "windows" in systype:
9-
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
14+
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
1015
% else:
11-
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
16+
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
1217
% end
1318
<language-scope id="org.eclipse.cdt.core.gcc"/>
1419
<language-scope id="org.eclipse.cdt.core.g++"/>
@@ -21,9 +26,9 @@
2126
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
2227
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
2328
% if "windows" in systype:
24-
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
29+
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
2530
% else:
26-
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
31+
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} {{ cxx_std }} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
2732
% end
2833
<language-scope id="org.eclipse.cdt.core.gcc"/>
2934
<language-scope id="org.eclipse.cdt.core.g++"/>

platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl

+27-19
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"cmd":
66
[
7-
"platformio",
7+
"{{ platformio_path }}",
88
"-f", "-c", "sublimetext",
99
"run"
1010
],
@@ -14,7 +14,7 @@
1414
{
1515
"cmd":
1616
[
17-
"platformio",
17+
"{{ platformio_path }}",
1818
"-f", "-c", "sublimetext",
1919
"run"
2020
],
@@ -23,38 +23,38 @@
2323
{
2424
"cmd":
2525
[
26-
"platformio",
26+
"{{ platformio_path }}",
2727
"-f", "-c", "sublimetext",
2828
"run",
2929
"--target",
30-
"clean"
30+
"upload"
3131
],
32-
"name": "Clean"
32+
"name": "Upload"
3333
},
3434
{
3535
"cmd":
3636
[
37-
"platformio",
37+
"{{ platformio_path }}",
3838
"-f", "-c", "sublimetext",
39-
"test"
39+
"run",
40+
"--target",
41+
"clean"
4042
],
41-
"name": "Test"
43+
"name": "Clean"
4244
},
4345
{
4446
"cmd":
4547
[
46-
"platformio",
48+
"{{ platformio_path }}",
4749
"-f", "-c", "sublimetext",
48-
"run",
49-
"--target",
50-
"upload"
50+
"test"
5151
],
52-
"name": "Upload"
52+
"name": "Test"
5353
},
5454
{
5555
"cmd":
5656
[
57-
"platformio",
57+
"{{ platformio_path }}",
5858
"-f", "-c", "sublimetext",
5959
"run",
6060
"--target",
@@ -65,7 +65,7 @@
6565
{
6666
"cmd":
6767
[
68-
"platformio",
68+
"{{ platformio_path }}",
6969
"-f", "-c", "sublimetext",
7070
"run",
7171
"--target",
@@ -76,16 +76,24 @@
7676
{
7777
"cmd":
7878
[
79-
"platformio",
79+
"{{ platformio_path }}",
8080
"-f", "-c", "sublimetext",
8181
"update"
8282
],
8383
"name": "Update platforms and libraries"
84+
},
85+
{
86+
"cmd":
87+
[
88+
"{{ platformio_path }}",
89+
"-f", "-c", "sublimetext",
90+
"upgrade"
91+
],
92+
"name": "Upgrade PlatformIO Core"
8493
}
8594
],
8695
"working_dir": "${project_path:${folder}}",
87-
"selector": "source.c, source.c++",
88-
"path": "{{env_path}}"
96+
"selector": "source.c, source.c++"
8997
}
9098
],
9199
"folders":
@@ -98,7 +106,7 @@
98106
{
99107
"sublimegdb_workingdir": "{{project_dir}}",
100108
"sublimegdb_exec_cmd": "",
101-
"sublimegdb_commandline": "{{platformio_path}} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit"
109+
"sublimegdb_commandline": "{{ platformio_path }} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit"
102110
103111
}
104112
}

platformio/unpacker.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from os import chmod
16-
from os.path import exists, islink, join
16+
from os.path import exists, join
1717
from tarfile import open as tarfile_open
1818
from time import mktime
1919
from zipfile import ZipFile
@@ -56,6 +56,10 @@ def get_items(self):
5656
def get_item_filename(self, item):
5757
return item.name
5858

59+
@staticmethod
60+
def islink(item):
61+
return item.islnk() or item.issym()
62+
5963

6064
class ZIPArchive(ArchiveBase):
6165

@@ -80,6 +84,9 @@ def get_items(self):
8084
def get_item_filename(self, item):
8185
return item.filename
8286

87+
def islink(self, item):
88+
raise NotImplementedError()
89+
8390
def after_extract(self, item, dest_dir):
8491
self.preserve_permissions(item, dest_dir)
8592
self.preserve_mtime(item, dest_dir)
@@ -120,7 +127,9 @@ def unpack(self, dest_dir=".", with_progress=True):
120127
for item in self._unpacker.get_items():
121128
filename = self._unpacker.get_item_filename(item)
122129
item_path = join(dest_dir, filename)
123-
if not islink(item_path) and not exists(item_path):
124-
raise exception.ExtractArchiveItemError(filename, dest_dir)
125-
130+
try:
131+
if not self._unpacker.islink(item) and not exists(item_path):
132+
raise exception.ExtractArchiveItemError(filename, dest_dir)
133+
except NotImplementedError:
134+
pass
126135
return True

platformio/util.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -794,17 +794,20 @@ def merge_dicts(d1, d2, path=None):
794794
return d1
795795

796796

797+
def get_file_contents(path):
798+
try:
799+
with open(path) as f:
800+
return f.read()
801+
except UnicodeDecodeError:
802+
with open(path, encoding="latin-1") as f:
803+
return f.read()
804+
805+
797806
def ensure_udev_rules():
798807

799808
def _rules_to_set(rules_path):
800-
result = set([])
801-
with open(rules_path, "rb") as fp:
802-
for line in fp.readlines():
803-
line = line.strip()
804-
if not line or line.startswith("#"):
805-
continue
806-
result.add(line)
807-
return result
809+
return set(l.strip() for l in get_file_contents(rules_path).split("\n")
810+
if l.strip() and not l.startswith("#"))
808811

809812
if "linux" not in get_systype():
810813
return None

tests/commands/test_lib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_global_lib_list(clirunner, validate_cliresult):
170170
]
171171
versions2 = [
172172
173-
'[email protected]', '[email protected]', 'PJON@07fe9aa', 'PJON@1fb26fd',
173+
'[email protected]', 'PJON@07fe9aa', 'PJON@1fb26fd',
174174
'PubSubClient@bef5814', 'RFcontrol@77d4eb3f8a', '[email protected]'
175175
]
176176
assert set(versions1) >= set(versions2)

tests/test_examples.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def pytest_generate_tests(metafunc):
3737
if not p.is_embedded():
3838
continue
3939
# issue with "version `CXXABI_1.3.9' not found (required by sdcc)"
40-
if "linux" in util.get_systype() and p.name == "intel_mcs51":
40+
if "linux" in util.get_systype() and p.name in ("intel_mcs51",
41+
"ststm8"):
4142
continue
4243
examples_dir = join(p.get_dir(), "examples")
4344
assert isdir(examples_dir)

0 commit comments

Comments
 (0)