Merge branch 'release/v5.0.3'

This commit is contained in:
Ivan Kravets
2020-11-12 17:57:30 +02:00
19 changed files with 129 additions and 55 deletions

View File

@ -8,6 +8,16 @@ PlatformIO Core 5
**A professional collaborative platform for embedded development** **A professional collaborative platform for embedded development**
5.0.3 (2020-11-12)
~~~~~~~~~~~~~~~~~~
- Added an error selector for `Sublime Text <https://docs.platformio.org/page/integration/ide/sublimetext.html>`__ build runner (`issue #3733 <https://github.com/platformio/platformio-core/issues/3733>`_)
- Generate a working "projectEnvName" for PlatformIO IDE's debugger for VSCode
- Force VSCode's intelliSenseMode to "gcc-x64" when GCC toolchain is used
- Print ignored test suites and environments in the test summary report only in verbose mode (`issue #3726 <https://github.com/platformio/platformio-core/issues/3726>`_)
- Fixed an issue when the package manager tries to install a built-in library from the registry (`issue #3662 <https://github.com/platformio/platformio-core/issues/3662>`_)
- Fixed an issue when `pio package pack <https://docs.platformio.org/page/core/userguide/package/cmd_pack.html>`__ ignores some folders (`issue #3730 <https://github.com/platformio/platformio-core/issues/3730>`_)
5.0.2 (2020-10-30) 5.0.2 (2020-10-30)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

2
docs

Submodule docs updated: deae09a880...8d9e8ef02b

View File

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

View File

@ -255,6 +255,8 @@ def get_cid():
uid = None uid = None
if os.getenv("C9_UID"): if os.getenv("C9_UID"):
uid = os.getenv("C9_UID") uid = os.getenv("C9_UID")
elif os.getenv("GITPOD_GIT_USER_NAME"):
uid = os.getenv("GITPOD_GIT_USER_NAME")
elif os.getenv("CHE_API", os.getenv("CHE_API_ENDPOINT")): elif os.getenv("CHE_API", os.getenv("CHE_API_ENDPOINT")):
try: try:
uid = json.loads( uid = json.loads(

View File

@ -149,15 +149,19 @@ def project_init(
): ):
if not silent: if not silent:
if project_dir == os.getcwd(): if project_dir == os.getcwd():
click.secho("\nThe current working directory", fg="yellow", nl=False) click.secho("\nThe current working directory ", fg="yellow", nl=False)
click.secho(" %s " % project_dir, fg="cyan", nl=False) try:
click.secho("will be used for the project.", fg="yellow") click.secho(project_dir, fg="cyan", nl=False)
except UnicodeEncodeError:
click.secho(json.dumps(project_dir), fg="cyan", nl=False)
click.secho(" will be used for the project.", fg="yellow")
click.echo("") click.echo("")
click.echo( click.echo("The next files/directories have been created in ", nl=False)
"The next files/directories have been created in %s" try:
% click.style(project_dir, fg="cyan") click.secho(project_dir, fg="cyan")
) except UnicodeEncodeError:
click.secho(json.dumps(project_dir), fg="cyan")
click.echo( click.echo(
"%s - Put project header files here" % click.style("include", fg="cyan") "%s - Put project header files here" % click.style("include", fg="cyan")
) )

View File

@ -177,7 +177,7 @@ def cli( # pylint: disable=redefined-builtin
if without_testing: if without_testing:
return return
print_testing_summary(results) print_testing_summary(results, verbose)
command_failed = any(r.get("succeeded") is False for r in results) command_failed = any(r.get("succeeded") is False for r in results)
if command_failed: if command_failed:
@ -222,7 +222,7 @@ def print_processing_footer(result):
) )
def print_testing_summary(results): def print_testing_summary(results, verbose=False):
click.echo() click.echo()
tabular_data = [] tabular_data = []
@ -236,6 +236,8 @@ def print_testing_summary(results):
failed_nums += 1 failed_nums += 1
status_str = click.style("FAILED", fg="red") status_str = click.style("FAILED", fg="red")
elif result.get("succeeded") is None: elif result.get("succeeded") is None:
if not verbose:
continue
status_str = "IGNORED" status_str = "IGNORED"
else: else:
succeeded_nums += 1 succeeded_nums += 1

View File

@ -4,7 +4,7 @@
% cxx_stds = STD_RE.findall(cxx_flags) % cxx_stds = STD_RE.findall(cxx_flags)
% %
% %
clang {{ cxx_path }}
% if cc_stds: % if cc_stds:
{{"%c"}} -std=c{{ cc_stds[-1] }} {{"%c"}} -std=c{{ cc_stds[-1] }}

View File

@ -1,3 +1,13 @@
% import re
%
% cpp_standards_remap = {
% "0x": "11",
% "1y": "14",
% "1z": "17",
% "2a": "20",
% "2b": "23"
% }
win32 { win32 {
HOMEDIR += $$(USERPROFILE) HOMEDIR += $$(USERPROFILE)
} }
@ -27,3 +37,9 @@ HEADERS += {{file}}
SOURCES += {{file}} SOURCES += {{file}}
% end % end
% end % end
% STD_RE = re.compile(r"\-std=[a-z\+]+(\w+)")
% cxx_stds = STD_RE.findall(cxx_flags)
% if cxx_stds:
CONFIG += c++{{ cpp_standards_remap.get(cxx_stds[-1], cxx_stds[-1]) }}
% end

View File

@ -0,0 +1,22 @@
% import re
% STD_RE = re.compile(r"\-std=[a-z\+]+(\w+)")
% cc_stds = STD_RE.findall(cc_flags)
% cxx_stds = STD_RE.findall(cxx_flags)
%
%
{{ cxx_path }}
% if cc_stds:
{{"%c"}} -std=c{{ cc_stds[-1] }}
% end
% if cxx_stds:
{{"%cpp"}} -std=c++{{ cxx_stds[-1] }}
% end
% for include in filter_includes(includes):
-I{{ include }}
% end
% for define in defines:
-D{{ define }}
% end

View File

@ -5,9 +5,10 @@
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"run" "run"
], ],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "PlatformIO", "name": "PlatformIO",
"variants": "variants":
[ [
@ -15,78 +16,73 @@
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"run" "run"
], ],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Build" "name": "Build"
}, },
{ {
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"run", "run",
"--target", "--target",
"upload" "upload"
], ],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Upload" "name": "Upload"
}, },
{ {
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"run", "run",
"--target", "--target",
"clean" "clean"
], ],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Clean" "name": "Clean"
}, },
{ {
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"test" "test"
], ],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Test" "name": "Test"
}, },
{ {
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"run",
"--target",
"program"
],
"name": "Upload using Programmer"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"run", "run",
"--target", "--target",
"uploadfs" "uploadfs"
], ],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Upload SPIFFS image" "name": "Upload SPIFFS image"
}, },
{ {
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"update" "update"
], ],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Update platforms and libraries" "name": "Update platforms and libraries"
}, },
{ {
"cmd": "cmd":
[ [
"{{ platformio_path }}", "{{ platformio_path }}",
"-f", "-c", "sublimetext", "-c", "sublimetext",
"upgrade" "upgrade"
], ],
"name": "Upgrade PlatformIO Core" "name": "Upgrade PlatformIO Core"

View File

@ -118,7 +118,9 @@
% end % end
"" ""
], ],
"intelliSenseMode": "clang-x64", % if compiler_type == "gcc":
"intelliSenseMode": "gcc-x64",
% end
% if cc_stds: % if cc_stds:
"cStandard": "c{{ cc_stds[-1] }}", "cStandard": "c{{ cc_stds[-1] }}",
% end % end

View File

@ -19,13 +19,18 @@
"request": "launch", "request": "launch",
"name": "PIO Debug", "name": "PIO Debug",
"executable": "{{ _escape_path(prog_path) }}", "executable": "{{ _escape_path(prog_path) }}",
"projectEnvName": "{{ env_name }}",
"toolchainBinDir": "{{ _escape_path(dirname(gdb_path)) }}", "toolchainBinDir": "{{ _escape_path(dirname(gdb_path)) }}",
% if svd_path: % if svd_path:
"svdPath": "{{ _escape_path(svd_path) }}", "svdPath": "{{ _escape_path(svd_path) }}",
% end % end
"preLaunchTask": { "preLaunchTask": {
"type": "PlatformIO", "type": "PlatformIO",
% if len(config.envs()) > 1:
"task": "Pre-Debug ({{ env_name }})"
% else:
"task": "Pre-Debug" "task": "Pre-Debug"
% end
}, },
"internalConsoleOptions": "openOnSessionStart" "internalConsoleOptions": "openOnSessionStart"
}, },
@ -34,6 +39,7 @@
"request": "launch", "request": "launch",
"name": "PIO Debug (skip Pre-Debug)", "name": "PIO Debug (skip Pre-Debug)",
"executable": "{{ _escape_path(prog_path) }}", "executable": "{{ _escape_path(prog_path) }}",
"projectEnvName": "{{ env_name }}",
"toolchainBinDir": "{{ _escape_path(dirname(gdb_path)) }}", "toolchainBinDir": "{{ _escape_path(dirname(gdb_path)) }}",
% if svd_path: % if svd_path:
"svdPath": "{{ _escape_path(svd_path) }}", "svdPath": "{{ _escape_path(svd_path) }}",

View File

@ -73,17 +73,20 @@ def on_platformio_exception(e):
def set_caller(caller=None): def set_caller(caller=None):
caller = caller or getenv("PLATFORMIO_CALLER") caller = caller or getenv("PLATFORMIO_CALLER")
if not caller: if caller:
if getenv("VSCODE_PID") or getenv("VSCODE_NLS_CONFIG"): return app.set_session_var("caller_id", caller)
caller = "vscode" if getenv("VSCODE_PID") or getenv("VSCODE_NLS_CONFIG"):
elif is_container(): caller = "vscode"
if getenv("C9_UID"): elif getenv("GITPOD_INSTANCE_ID") or getenv("GITPOD_WORKSPACE_URL"):
caller = "C9" caller = "gitpod"
elif getenv("USER") == "cabox": elif is_container():
caller = "CA" if getenv("C9_UID"):
elif getenv("CHE_API", getenv("CHE_API_ENDPOINT")): caller = "C9"
caller = "Che" elif getenv("USER") == "cabox":
app.set_session_var("caller_id", caller) caller = "CA"
elif getenv("CHE_API", getenv("CHE_API_ENDPOINT")):
caller = "Che"
return app.set_session_var("caller_id", caller)
class Upgrader(object): class Upgrader(object):

View File

@ -127,7 +127,13 @@ class LibraryPackageManager(BasePackageManager): # pylint: disable=too-many-anc
for key, value in dependency.items() for key, value in dependency.items()
if key in ("authors", "platforms", "frameworks") if key in ("authors", "platforms", "frameworks")
} }
return self._install(spec, search_filters=search_filters or None, silent=silent) try:
return self._install(
spec, search_filters=search_filters or None, silent=silent
)
except UnknownPackageError:
pass
return None
def uninstall_dependencies(self, pkg, silent=False): def uninstall_dependencies(self, pkg, silent=False):
assert isinstance(pkg, PackageItem) assert isinstance(pkg, PackageItem)

View File

@ -141,7 +141,7 @@ class ExampleSchema(StrictSchema):
name = fields.Str( name = fields.Str(
required=True, required=True,
validate=[ validate=[
validate.Length(min=1, max=100), validate.Length(min=1, max=255),
validate.Regexp( validate.Regexp(
r"^[a-zA-Z\d\-\_/]+$", error="Only [a-zA-Z0-9-_/] chars are allowed" r"^[a-zA-Z\d\-\_/]+$", error="Only [a-zA-Z0-9-_/] chars are allowed"
), ),

View File

@ -46,6 +46,8 @@ class PackagePacker(object):
".git/", ".git/",
".hg/", ".hg/",
".svn/", ".svn/",
]
EXCLUDE_EXTRA = [
# Tests # Tests
"tests?", "tests?",
# Docs # Docs
@ -120,7 +122,6 @@ class PackagePacker(object):
src = tmp_dir src = tmp_dir
src = self.find_source_root(src) src = self.find_source_root(src)
manifest = self.load_manifest(src) manifest = self.load_manifest(src)
filename = self.get_archive_name( filename = self.get_archive_name(
manifest["name"], manifest["name"],
@ -188,7 +189,7 @@ class PackagePacker(object):
return dst return dst
def compute_src_filters(self, src, include, exclude): def compute_src_filters(self, src, include, exclude):
exclude_default = self.EXCLUDE_DEFAULT[:] exclude_extra = self.EXCLUDE_EXTRA[:]
# extend with library extra filters # extend with library extra filters
if any( if any(
os.path.isfile(os.path.join(src, name)) os.path.isfile(os.path.join(src, name))
@ -198,11 +199,15 @@ class PackagePacker(object):
ManifestFileType.MODULE_JSON, ManifestFileType.MODULE_JSON,
) )
): ):
exclude_default.extend(self.EXCLUDE_LIBRARY_EXTRA) exclude_extra.extend(self.EXCLUDE_LIBRARY_EXTRA)
result = ["+<%s>" % p for p in include or ["*", ".*"]] result = ["+<%s>" % p for p in include or ["*", ".*"]]
result += ["-<%s>" % p for p in self.EXCLUDE_DEFAULT]
# exclude items declared in manifest
result += ["-<%s>" % p for p in exclude or []] result += ["-<%s>" % p for p in exclude or []]
result += ["-<%s>" % p for p in exclude_default] # apply extra excludes if no custom "export" field in manifest
if not include and not exclude:
result += ["-<%s>" % p for p in exclude_extra]
# automatically include manifests # automatically include manifests
result += ["+<%s>" % p for p in self.INCLUDE_DEFAULT] result += ["+<%s>" % p for p in self.INCLUDE_DEFAULT]
return result return result

View File

@ -236,7 +236,9 @@ def test_global_lib_update_check(clirunner, validate_cliresult):
result = clirunner.invoke(cmd_lib, ["-g", "update", "--dry-run", "--json-output"]) result = clirunner.invoke(cmd_lib, ["-g", "update", "--dry-run", "--json-output"])
validate_cliresult(result) validate_cliresult(result)
output = json.loads(result.output) output = json.loads(result.output)
assert set(["ESPAsyncTCP", "NeoPixelBus"]) == set(lib["name"] for lib in output) assert set(["Adafruit PN532", "ESPAsyncTCP", "NeoPixelBus"]) == set(
lib["name"] for lib in output
)
def test_global_lib_update(clirunner, validate_cliresult): def test_global_lib_update(clirunner, validate_cliresult):
@ -256,7 +258,7 @@ def test_global_lib_update(clirunner, validate_cliresult):
result = clirunner.invoke(cmd_lib, ["-g", "update"]) result = clirunner.invoke(cmd_lib, ["-g", "update"])
validate_cliresult(result) validate_cliresult(result)
assert result.output.count("[Detached]") == 1 assert result.output.count("[Detached]") == 1
assert result.output.count("[Up-to-date]") == 15 assert result.output.count("[Up-to-date]") == 14
# update unknown library # update unknown library
result = clirunner.invoke(cmd_lib, ["-g", "update", "Unknown"]) result = clirunner.invoke(cmd_lib, ["-g", "update", "Unknown"])

View File

@ -34,9 +34,7 @@ def test_local_env():
if result["returncode"] != 1: if result["returncode"] != 1:
pytest.fail(str(result)) pytest.fail(str(result))
# pylint: disable=unsupported-membership-test # pylint: disable=unsupported-membership-test
assert all([s in result["err"] for s in ("PASSED", "IGNORED", "FAILED")]), result[ assert all([s in result["err"] for s in ("PASSED", "FAILED")]), result["out"]
"out"
]
def test_multiple_env_build(clirunner, validate_cliresult, tmpdir): def test_multiple_env_build(clirunner, validate_cliresult, tmpdir):