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**
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)
~~~~~~~~~~~~~~~~~~

2
docs

Submodule docs updated: deae09a880...8d9e8ef02b

View File

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

View File

@ -255,6 +255,8 @@ def get_cid():
uid = None
if 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")):
try:
uid = json.loads(

View File

@ -149,15 +149,19 @@ def project_init(
):
if not silent:
if project_dir == os.getcwd():
click.secho("\nThe current working directory", fg="yellow", nl=False)
click.secho(" %s " % project_dir, fg="cyan", nl=False)
click.secho("will be used for the project.", fg="yellow")
click.secho("\nThe current working directory ", fg="yellow", nl=False)
try:
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(
"The next files/directories have been created in %s"
% click.style(project_dir, fg="cyan")
)
click.echo("The next files/directories have been created in ", nl=False)
try:
click.secho(project_dir, fg="cyan")
except UnicodeEncodeError:
click.secho(json.dumps(project_dir), fg="cyan")
click.echo(
"%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:
return
print_testing_summary(results)
print_testing_summary(results, verbose)
command_failed = any(r.get("succeeded") is False for r in results)
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()
tabular_data = []
@ -236,6 +236,8 @@ def print_testing_summary(results):
failed_nums += 1
status_str = click.style("FAILED", fg="red")
elif result.get("succeeded") is None:
if not verbose:
continue
status_str = "IGNORED"
else:
succeeded_nums += 1

View File

@ -4,7 +4,7 @@
% cxx_stds = STD_RE.findall(cxx_flags)
%
%
clang
{{ cxx_path }}
% if cc_stds:
{{"%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 {
HOMEDIR += $$(USERPROFILE)
}
@ -27,3 +37,9 @@ HEADERS += {{file}}
SOURCES += {{file}}
% 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":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"run"
],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "PlatformIO",
"variants":
[
@ -15,78 +16,73 @@
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"run"
],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Build"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"run",
"--target",
"upload"
],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Upload"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"run",
"--target",
"clean"
],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Clean"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"test"
],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Test"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"run",
"--target",
"program"
],
"name": "Upload using Programmer"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"run",
"--target",
"uploadfs"
],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Upload SPIFFS image"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"update"
],
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"name": "Update platforms and libraries"
},
{
"cmd":
[
"{{ platformio_path }}",
"-f", "-c", "sublimetext",
"-c", "sublimetext",
"upgrade"
],
"name": "Upgrade PlatformIO Core"

View File

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

View File

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

View File

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

View File

@ -127,7 +127,13 @@ class LibraryPackageManager(BasePackageManager): # pylint: disable=too-many-anc
for key, value in dependency.items()
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):
assert isinstance(pkg, PackageItem)

View File

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

View File

@ -46,6 +46,8 @@ class PackagePacker(object):
".git/",
".hg/",
".svn/",
]
EXCLUDE_EXTRA = [
# Tests
"tests?",
# Docs
@ -120,7 +122,6 @@ class PackagePacker(object):
src = tmp_dir
src = self.find_source_root(src)
manifest = self.load_manifest(src)
filename = self.get_archive_name(
manifest["name"],
@ -188,7 +189,7 @@ class PackagePacker(object):
return dst
def compute_src_filters(self, src, include, exclude):
exclude_default = self.EXCLUDE_DEFAULT[:]
exclude_extra = self.EXCLUDE_EXTRA[:]
# extend with library extra filters
if any(
os.path.isfile(os.path.join(src, name))
@ -198,11 +199,15 @@ class PackagePacker(object):
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 self.EXCLUDE_DEFAULT]
# exclude items declared in manifest
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
result += ["+<%s>" % p for p in self.INCLUDE_DEFAULT]
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"])
validate_cliresult(result)
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):
@ -256,7 +258,7 @@ def test_global_lib_update(clirunner, validate_cliresult):
result = clirunner.invoke(cmd_lib, ["-g", "update"])
validate_cliresult(result)
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
result = clirunner.invoke(cmd_lib, ["-g", "update", "Unknown"])

View File

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