Merge branch 'release/v3.6.4'

This commit is contained in:
Ivan Kravets
2019-01-23 20:51:48 +02:00
14 changed files with 122 additions and 70 deletions

View File

@@ -4,10 +4,27 @@ Release Notes
PlatformIO 3.0 PlatformIO 3.0
-------------- --------------
3.6.4 (2019-01-23)
~~~~~~~~~~~~~~~~~~
* Improved Project Generator for IDEs:
- Use full path to PlatformIO CLI when generating a project
(`issue #1674 <https://github.com/platformio/platformio-core/issues/1674>`_)
- CLion: Improved project portability using "${CMAKE_CURRENT_LIST_DIR}" instead of full path
- Eclipse: Provide language standard to a project C/C++ indexer
(`issue #1010 <https://github.com/platformio/platformio-core/issues/1010>`_)
* Fixed an issue with incorrect detecting of compatibility (LDF) between generic library and Arduino or ARM mbed frameworks
* Fixed "Runtime Error: Dictionary size changed during iteration"
(`issue #2003 <https://github.com/platformio/platformio-core/issues/2003>`_)
* Fixed an error "Could not extract item..." when extracting TAR archive with symbolic items on Windows platform
(`issue #2015 <https://github.com/platformio/platformio-core/issues/2015>`_)
3.6.3 (2018-12-12) 3.6.3 (2018-12-12)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
* Ignore *.asm and *.ASM files when building Arduino-based library (compatibility with Arduino builder) * Ignore ``*.asm`` and ``*.ASM`` files when building Arduino-based library (compatibility with Arduino builder)
* Fixed spurious project's "Problems" for `PlatformIO IDE for VSCode <http://docs.platformio.org/page/ide/vscode.html>`__ when ARM mbed framework is used * Fixed spurious project's "Problems" for `PlatformIO IDE for VSCode <http://docs.platformio.org/page/ide/vscode.html>`__ when ARM mbed framework is used
* Fixed an issue with a broken headers list when generating ".clang_complete" for `Emacs <http://docs.platformio.org/page/ide/emacs.html>`__ * Fixed an issue with a broken headers list when generating ".clang_complete" for `Emacs <http://docs.platformio.org/page/ide/emacs.html>`__
(`issue #1960 <https://github.com/platformio/platformio-core/issues/1960>`_) (`issue #1960 <https://github.com/platformio/platformio-core/issues/1960>`_)
@@ -50,7 +67,6 @@ PlatformIO 3.0
(`issue #1873 <https://github.com/platformio/platformio-core/issues/1873>`_) (`issue #1873 <https://github.com/platformio/platformio-core/issues/1873>`_)
* 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 * 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
3.6.0 (2018-08-06) 3.6.0 (2018-08-06)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

2
docs

Submodule docs updated: c0dc83570a...a48c700ba1

View File

@@ -14,7 +14,7 @@
import sys import sys
VERSION = (3, 6, 3) VERSION = (3, 6, 4)
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@@ -226,9 +226,9 @@ class ContentCache(object):
newlines = [] newlines = []
with open(self._db_path) as fp: with open(self._db_path) as fp:
for line in fp.readlines(): for line in fp.readlines():
line = line.strip()
if "=" not in line: if "=" not in line:
continue continue
line = line.strip()
expire, path = line.split("=") expire, path = line.split("=")
if time() < int(expire) and isfile(path) and \ if time() < int(expire) and isfile(path) and \
path not in paths_for_delete: path not in paths_for_delete:

View File

@@ -19,6 +19,7 @@ from __future__ import absolute_import
import hashlib import hashlib
import os import os
import re
import sys import sys
from glob import glob from glob import glob
from os.path import (basename, commonprefix, dirname, isdir, isfile, join, from os.path import (basename, commonprefix, dirname, isdir, isfile, join,
@@ -64,6 +65,9 @@ class LibBuilderFactory(object):
if isfile(join(path, "module.json")): if isfile(join(path, "module.json")):
return ["mbed"] return ["mbed"]
include_re = re.compile(
r'^#include\s+(<|")(Arduino|mbed)\.h(<|")', flags=re.MULTILINE)
# check source files # check source files
for root, _, files in os.walk(path, followlinks=True): for root, _, files in os.walk(path, followlinks=True):
for fname in files: for fname in files:
@@ -72,9 +76,9 @@ class LibBuilderFactory(object):
continue continue
with open(join(root, fname)) as f: with open(join(root, fname)) as f:
content = f.read() content = f.read()
if "Arduino.h" in content: if "Arduino.h" in content and include_re.search(content):
return ["arduino"] return ["arduino"]
elif "mbed.h" in content: elif "mbed.h" in content and include_re.search(content):
return ["mbed"] return ["mbed"]
return [] return []

View File

@@ -15,6 +15,7 @@
import json import json
import os import os
import re import re
import sys
from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath
import bottle import bottle
@@ -146,7 +147,8 @@ class ProjectGenerator(object):
"project_libdeps_dir": util.get_projectlibdeps_dir(), "project_libdeps_dir": util.get_projectlibdeps_dir(),
"systype": util.get_systype(), "systype": util.get_systype(),
"platformio_path": self._fix_os_path( "platformio_path": self._fix_os_path(
util.where_is_program("platformio")), sys.argv[0] if isfile(sys.argv[0])
else util.where_is_program("platformio")),
"env_pathsep": os.pathsep, "env_pathsep": os.pathsep,
"env_path": self._fix_os_path(os.getenv("PATH")) "env_path": self._fix_os_path(os.getenv("PATH"))
}) # yapf: disable }) # yapf: disable

View File

@@ -1,8 +1,20 @@
set(ENV{PATH} "{{env_path}}") % def _normalize_path(path):
set(PLATFORMIO_CMD "{{platformio_path}}") % if project_dir in path:
% path = path.replace(project_dir, "${CMAKE_CURRENT_LIST_DIR}")
% elif user_home_dir in path:
% if "windows" in systype:
% path = path.replace(user_home_dir, "$ENV{HOMEDRIVE}$ENV{HOMEPATH}")
% else:
% path = path.replace(user_home_dir, "$ENV{HOME}")
% end
% end
% return path.replace("\\", "/")
% end
SET(CMAKE_C_COMPILER "{{cc_path.replace("\\", "/")}}") set(PLATFORMIO_CMD "{{ _normalize_path(platformio_path) }}")
SET(CMAKE_CXX_COMPILER "{{cxx_path.replace("\\", "/")}}")
SET(CMAKE_C_COMPILER "{{ _normalize_path(cc_path) }}")
SET(CMAKE_CXX_COMPILER "{{ _normalize_path(cxx_path) }}")
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "{{cxx_flags}}") SET(CMAKE_CXX_FLAGS_DISTRIBUTION "{{cxx_flags}}")
SET(CMAKE_C_FLAGS_DISTRIBUTION "{{cc_flags}}") SET(CMAKE_C_FLAGS_DISTRIBUTION "{{cc_flags}}")
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
@@ -13,15 +25,7 @@ add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
% end % end
% for include in includes: % for include in includes:
% if include.startswith(user_home_dir): include_directories("{{ _normalize_path(include) }}")
% if "windows" in systype:
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% else:
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% end
% else:
include_directories("{{include.replace("\\", "/")}}")
% end
% end % end
FILE(GLOB_RECURSE SRC_LIST "{{project_src_dir.replace("\\", "/")}}/*.*" "{{project_lib_dir.replace("\\", "/")}}/*.*" "{{project_libdeps_dir.replace("\\", "/")}}/*.*") FILE(GLOB_RECURSE SRC_LIST "{{ _normalize_path(project_src_dir) }}/*.*" "{{ _normalize_path(project_lib_dir) }}/*.*" "{{ _normalize_path(project_libdeps_dir) }}/*.*")

View File

@@ -1,3 +1,8 @@
% import re
% STD_RE = re.compile(r"(\-std=[a-z\+]+\d+)")
% cxx_stds = STD_RE.findall(cxx_flags)
% cxx_std = cxx_stds[-1] if cxx_stds else ""
%
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project> <project>
<configuration id="0.910961921" name="Default"> <configuration id="0.910961921" name="Default">
@@ -6,9 +11,9 @@
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
% if "windows" in systype: % if "windows" in systype:
<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"> <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">
% else: % else:
<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"> <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">
% end % end
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
@@ -21,9 +26,9 @@
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
% if "windows" in systype: % if "windows" in systype:
<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"> <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">
% else: % else:
<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"> <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">
% end % end
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>

View File

@@ -4,7 +4,7 @@
{ {
"cmd": "cmd":
[ [
"platformio", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-f", "-c", "sublimetext",
"run" "run"
], ],
@@ -14,7 +14,7 @@
{ {
"cmd": "cmd":
[ [
"platformio", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-f", "-c", "sublimetext",
"run" "run"
], ],
@@ -23,27 +23,7 @@
{ {
"cmd": "cmd":
[ [
"platformio", "{{ platformio_path }}",
"-f", "-c", "sublimetext",
"run",
"--target",
"clean"
],
"name": "Clean"
},
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext",
"test"
],
"name": "Test"
},
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext", "-f", "-c", "sublimetext",
"run", "run",
"--target", "--target",
@@ -54,7 +34,27 @@
{ {
"cmd": "cmd":
[ [
"platformio", "{{ platformio_path }}",
"-f", "-c", "sublimetext",
"run",
"--target",
"clean"
],
"name": "Clean"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"test"
],
"name": "Test"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext", "-f", "-c", "sublimetext",
"run", "run",
"--target", "--target",
@@ -65,7 +65,7 @@
{ {
"cmd": "cmd":
[ [
"platformio", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-f", "-c", "sublimetext",
"run", "run",
"--target", "--target",
@@ -76,16 +76,24 @@
{ {
"cmd": "cmd":
[ [
"platformio", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-f", "-c", "sublimetext",
"update" "update"
], ],
"name": "Update platforms and libraries" "name": "Update platforms and libraries"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"upgrade"
],
"name": "Upgrade PlatformIO Core"
} }
], ],
"working_dir": "${project_path:${folder}}", "working_dir": "${project_path:${folder}}",
"selector": "source.c, source.c++", "selector": "source.c, source.c++"
"path": "{{env_path}}"
} }
], ],
"folders": "folders":
@@ -98,7 +106,7 @@
{ {
"sublimegdb_workingdir": "{{project_dir}}", "sublimegdb_workingdir": "{{project_dir}}",
"sublimegdb_exec_cmd": "", "sublimegdb_exec_cmd": "",
"sublimegdb_commandline": "{{platformio_path}} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit" "sublimegdb_commandline": "{{ platformio_path }} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit"
} }
} }

View File

@@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
from os import chmod from os import chmod
from os.path import exists, islink, join from os.path import exists, join
from tarfile import open as tarfile_open from tarfile import open as tarfile_open
from time import mktime from time import mktime
from zipfile import ZipFile from zipfile import ZipFile
@@ -56,6 +56,10 @@ class TARArchive(ArchiveBase):
def get_item_filename(self, item): def get_item_filename(self, item):
return item.name return item.name
@staticmethod
def islink(item):
return item.islnk() or item.issym()
class ZIPArchive(ArchiveBase): class ZIPArchive(ArchiveBase):
@@ -80,6 +84,9 @@ class ZIPArchive(ArchiveBase):
def get_item_filename(self, item): def get_item_filename(self, item):
return item.filename return item.filename
def islink(self, item):
raise NotImplementedError()
def after_extract(self, item, dest_dir): def after_extract(self, item, dest_dir):
self.preserve_permissions(item, dest_dir) self.preserve_permissions(item, dest_dir)
self.preserve_mtime(item, dest_dir) self.preserve_mtime(item, dest_dir)
@@ -120,7 +127,9 @@ class FileUnpacker(object):
for item in self._unpacker.get_items(): for item in self._unpacker.get_items():
filename = self._unpacker.get_item_filename(item) filename = self._unpacker.get_item_filename(item)
item_path = join(dest_dir, filename) item_path = join(dest_dir, filename)
if not islink(item_path) and not exists(item_path): try:
if not self._unpacker.islink(item) and not exists(item_path):
raise exception.ExtractArchiveItemError(filename, dest_dir) raise exception.ExtractArchiveItemError(filename, dest_dir)
except NotImplementedError:
pass
return True return True

View File

@@ -794,17 +794,20 @@ def merge_dicts(d1, d2, path=None):
return d1 return d1
def get_file_contents(path):
try:
with open(path) as f:
return f.read()
except UnicodeDecodeError:
with open(path, encoding="latin-1") as f:
return f.read()
def ensure_udev_rules(): def ensure_udev_rules():
def _rules_to_set(rules_path): def _rules_to_set(rules_path):
result = set([]) return set(l.strip() for l in get_file_contents(rules_path).split("\n")
with open(rules_path, "rb") as fp: if l.strip() and not l.startswith("#"))
for line in fp.readlines():
line = line.strip()
if not line or line.startswith("#"):
continue
result.add(line)
return result
if "linux" not in get_systype(): if "linux" not in get_systype():
return None return None

View File

@@ -170,7 +170,7 @@ def test_global_lib_list(clirunner, validate_cliresult):
] ]
versions2 = [ versions2 = [
'ArduinoJson@5.8.2', 'ArduinoJson@5.10.1', 'AsyncMqttClient@0.8.2', 'ArduinoJson@5.8.2', 'ArduinoJson@5.10.1', 'AsyncMqttClient@0.8.2',
'AsyncTCP@1.0.1', 'NeoPixelBus@2.2.4', 'PJON@07fe9aa', 'PJON@1fb26fd', 'NeoPixelBus@2.2.4', 'PJON@07fe9aa', 'PJON@1fb26fd',
'PubSubClient@bef5814', 'RFcontrol@77d4eb3f8a', 'RadioHead-1.62@0.0.0' 'PubSubClient@bef5814', 'RFcontrol@77d4eb3f8a', 'RadioHead-1.62@0.0.0'
] ]
assert set(versions1) >= set(versions2) assert set(versions1) >= set(versions2)

View File

@@ -37,7 +37,8 @@ def pytest_generate_tests(metafunc):
if not p.is_embedded(): if not p.is_embedded():
continue continue
# issue with "version `CXXABI_1.3.9' not found (required by sdcc)" # issue with "version `CXXABI_1.3.9' not found (required by sdcc)"
if "linux" in util.get_systype() and p.name == "intel_mcs51": if "linux" in util.get_systype() and p.name in ("intel_mcs51",
"ststm8"):
continue continue
examples_dir = join(p.get_dir(), "examples") examples_dir = join(p.get_dir(), "examples")
assert isdir(examples_dir) assert isdir(examples_dir)