Skip to content

Commit

Permalink
Merge branch 'release/v5.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Dec 30, 2020
2 parents 4b3f2e1 + 34e12e5 commit 3f3c8ca
Show file tree
Hide file tree
Showing 30 changed files with 257 additions and 146 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
submodules: "recursive"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -26,7 +26,8 @@ jobs:
- name: Run on Linux
if: startsWith(matrix.os, 'ubuntu')
env:
PIO_INSTALL_DEVPLATFORMS_IGNORE: "ststm8,infineonxmc,siwigsm,intel_mcs51,aceinna_imu"
PIO_INSTALL_DEVPLATFORMS_OWNERNAMES: "platformio"
PIO_INSTALL_DEVPLATFORMS_IGNORE: "ststm8,infineonxmc,intel_mcs51"
run: |
# ChipKIT issue: install 32-bit support for GCC PIC32
sudo apt-get install libc6-i386
Expand All @@ -40,7 +41,8 @@ jobs:
- name: Run on macOS
if: startsWith(matrix.os, 'macos')
env:
PIO_INSTALL_DEVPLATFORMS_IGNORE: "ststm8,infineonxmc,siwigsm,microchippic32,gd32v,nuclei,lattice_ice40"
PIO_INSTALL_DEVPLATFORMS_OWNERNAMES: "platformio"
PIO_INSTALL_DEVPLATFORMS_IGNORE: "ststm8,infineonxmc,microchippic32,lattice_ice40,gd32v"
run: |
df -h
tox -e testexamples
Expand All @@ -50,7 +52,8 @@ jobs:
env:
PLATFORMIO_CORE_DIR: C:/pio
PLATFORMIO_WORKSPACE_DIR: C:/pio-workspace/$PROJECT_HASH
PIO_INSTALL_DEVPLATFORMS_IGNORE: "ststm8,infineonxmc,siwigsm,riscv_gap"
PIO_INSTALL_DEVPLATFORMS_OWNERNAMES: "platformio"
PIO_INSTALL_DEVPLATFORMS_IGNORE: "ststm8,infineonxmc,riscv_gap"
run: |
tox -e testexamples
Expand Down
18 changes: 17 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ PlatformIO Core 5

**A professional collaborative platform for embedded development**

5.0.4 (2020-12-30)
~~~~~~~~~~~~~~~~~~

- Added "Core" suffix when showing PlatformIO Core version using ``pio --version`` command
- Improved ``.ccls`` configuration file for Emacs, Vim, and Sublime Text integrations
- Updated analysis tools:

* `Cppcheck <https://docs.platformio.org/page/plus/check-tools/cppcheck.html>`__ v2.3 with improved C++ parser and several new MISRA rules
* `PVS-Studio <https://docs.platformio.org/page/plus/check-tools/pvs-studio.html>`__ v7.11 with new diagnostics and updated mass suppression mechanism

- Show a warning message about deprecated support for Python 2 and Python 3.5
- Do not provide "intelliSenseMode" option when generating configuration for VSCode C/C++ extension
- Fixed a "git-sh-setup: file not found" error when installing project dependencies from Git VCS (`issue #3740 <https://github.com/platformio/platformio-core/issues/3740>`_)
- Fixed an issue with package publishing on Windows when Unix permissions are not preserved (`issue #3776 <https://github.com/platformio/platformio-core/issues/3776>`_)

5.0.3 (2020-11-12)
~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -128,7 +143,8 @@ Please check `Migration guide from 4.x to 5.0 <https://docs.platformio.org/page/
- Display system-wide information using a new `pio system info <https://docs.platformio.org/page/core/userguide/system/cmd_info.html>`__ command (`issue #3521 <https://github.com/platformio/platformio-core/issues/3521>`_)
- Remove unused data using a new `pio system prune <https://docs.platformio.org/page/core/userguide/system/cmd_prune.html>`__ command (`issue #3522 <https://github.com/platformio/platformio-core/issues/3522>`_)
- Show ignored project environments only in the verbose mode (`issue #3641 <https://github.com/platformio/platformio-core/issues/3641>`_)
- Do not escape compiler arguments in VSCode template on Windows.
- Do not escape compiler arguments in VSCode template on Windows
- Drop support for Python 2 and 3.5.

.. _release_notes_4:

Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 282 files
2 changes: 1 addition & 1 deletion examples
12 changes: 6 additions & 6 deletions platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import sys

VERSION = (5, 0, 3)
VERSION = (5, 0, 4)
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio"
Expand All @@ -31,11 +31,11 @@
)
__url__ = "https://platformio.org"

__author__ = "PlatformIO"
__email__ = "contact@platformio.org"
__author__ = "PlatformIO Labs"
__email__ = "contact@piolabs.com"

__license__ = "Apache Software License"
__copyright__ = "Copyright 2014-present PlatformIO"
__copyright__ = "Copyright 2014-present PlatformIO Labs"

__accounts_api__ = "https://api.accounts.platformio.org"
__registry_api__ = [
Expand All @@ -51,9 +51,9 @@
"contrib-pysite": "~2.%d%d.0" % (sys.version_info.major, sys.version_info.minor),
"tool-unity": "~1.20500.0",
"tool-scons": "~2.20501.7" if sys.version_info.major == 2 else "~4.40001.0",
"tool-cppcheck": "~1.210.0",
"tool-cppcheck": "~1.230.0",
"tool-clangtidy": "~1.100000.0",
"tool-pvs-studio": "~7.9.0",
"tool-pvs-studio": "~7.11.0",
}

__check_internet_hosts__ = [
Expand Down
2 changes: 1 addition & 1 deletion platformio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@click.command(
cls=PlatformioCLI, context_settings=dict(help_option_names=["-h", "--help"])
)
@click.version_option(__version__, prog_name="PlatformIO")
@click.version_option(__version__, prog_name="PlatformIO Core")
@click.option("--force", "-f", is_flag=True, help="DEPRECATE")
@click.option("--caller", "-c", help="Caller ID (service)")
@click.option("--no-ansi", is_flag=True, help="Do not print ANSI control characters")
Expand Down
29 changes: 24 additions & 5 deletions platformio/commands/check/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,29 @@ def clean_up(self):
if os.path.isfile(f):
os.remove(f)

@staticmethod
def is_check_successful(cmd_result):
return cmd_result["returncode"] == 0

def execute_check_cmd(self, cmd):
result = proc.exec_command(
cmd,
stdout=proc.LineBufferedAsyncPipe(self.on_tool_output),
stderr=proc.LineBufferedAsyncPipe(self.on_tool_output),
)

if not self.is_check_successful(result):
click.echo(
"\nError: Failed to execute check command! Exited with code %d."
% result["returncode"]
)
if self.options.get("verbose"):
click.echo(result["out"])
click.echo(result["err"])
self._bad_input = True

return result

@staticmethod
def get_project_target_files(patterns):
c_extension = (".c",)
Expand Down Expand Up @@ -200,11 +223,7 @@ def check(self, on_defect_callback=None):
if self.options.get("verbose"):
click.echo(" ".join(cmd))

proc.exec_command(
cmd,
stdout=proc.LineBufferedAsyncPipe(self.on_tool_output),
stderr=proc.LineBufferedAsyncPipe(self.on_tool_output),
)
self.execute_check_cmd(cmd)

else:
if self.options.get("verbose"):
Expand Down
6 changes: 6 additions & 0 deletions platformio/commands/check/tools/clangtidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def parse_defect(self, raw_line):

return DefectItem(severity, category, message, file_, line, column, defect_id)

@staticmethod
def is_check_successful(cmd_result):
# Note: Clang-Tidy returns 1 for not critical compilation errors,
# so 0 and 1 are only acceptable values
return cmd_result["returncode"] < 2

def configure_command(self):
tool_path = join(get_core_package_dir("tool-clangtidy"), "clang-tidy")

Expand Down
13 changes: 7 additions & 6 deletions platformio/commands/check/tools/cppcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def configure_command(
cmd = [
tool_path,
"--addon-python=%s" % proc.get_pythonexe_path(),
"--error-exitcode=1",
"--error-exitcode=3",
"--verbose" if self.options.get("verbose") else "--quiet",
]

Expand Down Expand Up @@ -220,6 +220,11 @@ def clean_up(self):
if os.path.isfile(dump_file):
os.remove(dump_file)

@staticmethod
def is_check_successful(cmd_result):
# Cppcheck is configured to return '3' if a defect is found
return cmd_result["returncode"] in (0, 3)

def check(self, on_defect_callback=None):
self._on_defect_callback = on_defect_callback
project_files = self.get_project_target_files(self.options["patterns"])
Expand All @@ -238,11 +243,7 @@ def check(self, on_defect_callback=None):
if self.options.get("verbose"):
click.echo(" ".join(cmd))

proc.exec_command(
cmd,
stdout=proc.LineBufferedAsyncPipe(self.on_tool_output),
stderr=proc.LineBufferedAsyncPipe(self.on_tool_output),
)
self.execute_check_cmd(cmd)

self.clean_up()

Expand Down
18 changes: 13 additions & 5 deletions platformio/commands/check/tools/pvsstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ def __init__(self, *args, **kwargs):
)
)

def tool_output_filter(self, line):
if "license was not entered" in line.lower():
self._bad_input = True
return line

def _process_defects(self, defects):
for defect in defects:
if not isinstance(defect, DefectItem):
Expand Down Expand Up @@ -203,6 +208,12 @@ def clean_up(self):
if os.path.isdir(self._tmp_dir):
shutil.rmtree(self._tmp_dir)

@staticmethod
def is_check_successful(cmd_result):
return (
"license" not in cmd_result["err"].lower() and cmd_result["returncode"] == 0
)

def check(self, on_defect_callback=None):
self._on_defect_callback = on_defect_callback
for scope, files in self.get_project_target_files(
Expand All @@ -219,11 +230,8 @@ def check(self, on_defect_callback=None):
self._bad_input = True
continue

result = proc.exec_command(cmd)
# pylint: disable=unsupported-membership-test
if result["returncode"] != 0 or "license" in result["err"].lower():
self._bad_input = True
click.echo(result["err"])
result = self.execute_check_cmd(cmd)
if result["returncode"] != 0:
continue

self._process_defects(self.parse_defects(self._tmp_output_file))
Expand Down
12 changes: 12 additions & 0 deletions platformio/commands/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from platformio.compat import ensure_python3
from platformio.package.meta import PackageSpec, PackageType
from platformio.package.pack import PackagePacker
from platformio.package.unpack import FileUnpacker, TARArchiver


def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
Expand Down Expand Up @@ -81,6 +82,17 @@ def package_pack(package, output):
)
def package_publish(package, owner, released_at, private, notify):
assert ensure_python3()

# publish .tar.gz instantly without repacking
if not os.path.isdir(package) and isinstance(
FileUnpacker.new_archiver(package), TARArchiver
):
response = RegistryClient().publish_package(
package, owner, released_at, private, notify
)
click.secho(response.get("message"), fg="green")
return

with tempfile.TemporaryDirectory() as tmp_dir: # pylint: disable=no-member
with fs.cd(tmp_dir):
p = PackagePacker(package)
Expand Down
7 changes: 4 additions & 3 deletions platformio/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ def ci_strings_are_equal(a, b):


def ensure_python3(raise_exception=True):
if not raise_exception or not PY2:
return not PY2
compatible = sys.version_info >= (3, 6)
if not raise_exception or compatible:
return compatible
raise UserSideException(
"Python 3.5 or later is required for this operation. \n"
"Python 3.6 or later is required for this operation. \n"
"Please install the latest Python 3 and reinstall PlatformIO Core using "
"installation script:\n"
"https://docs.platformio.org/page/core/installation.html"
Expand Down
18 changes: 4 additions & 14 deletions platformio/ide/tpls/emacs/.ccls.tpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
% 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
{{"%c"}} {{ !cc_flags }}
{{"%cpp"}} {{ !cxx_flags }}

% for include in filter_includes(includes):
-I{{ include }}
-I{{ !include }}
% end

% for define in defines:
-D{{ define }}
-D{{ !define }}
% end
6 changes: 0 additions & 6 deletions platformio/ide/tpls/emacs/.clang_complete.tpl

This file was deleted.

18 changes: 4 additions & 14 deletions platformio/ide/tpls/sublimetext/.ccls.tpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
% 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
{{"%c"}} {{ !cc_flags }}
{{"%cpp"}} {{ !cxx_flags }}

% for include in filter_includes(includes):
-I{{ include }}
-I{{ !include }}
% end

% for define in defines:
-D{{ define }}
-D{{ !define }}
% end
18 changes: 4 additions & 14 deletions platformio/ide/tpls/vim/.ccls.tpl
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
% 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)
%
%
clang
{{ cxx_path }}

% if cc_stds:
{{"%c"}} -std=c{{ cc_stds[-1] }}
% end
% if cxx_stds:
{{"%cpp"}} -std=c++{{ cxx_stds[-1] }}
% end
{{"%c"}} {{ !cc_flags }}
{{"%cpp"}} {{ !cxx_flags }}

% for include in filter_includes(includes):
-I{{ include }}
-I{{ !include }}
% end

% for define in defines:
Expand Down
6 changes: 0 additions & 6 deletions platformio/ide/tpls/vim/.clang_complete.tpl

This file was deleted.

9 changes: 0 additions & 9 deletions platformio/ide/tpls/vim/.gcc-flags.json.tpl

This file was deleted.

Loading

0 comments on commit 3f3c8ca

Please sign in to comment.