From c870c09d67b6846c1058ed3c84ba0ac87129d3b1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 1 Nov 2022 20:54:20 +0200 Subject: [PATCH 01/49] Bump version to 6.1.6a1 --- HISTORY.rst | 3 +++ platformio/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 1068c138..3cc5f75f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -13,6 +13,9 @@ PlatformIO Core 6 **A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.** +6.1.6 (2022-??-??) +~~~~~~~~~~~~~~~~~~ + 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 01be8126..be75cf45 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (6, 1, 5) +VERSION = (6, 1, "6a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 1dd62361c7e38da884adaadea1fd67338c0a7127 Mon Sep 17 00:00:00 2001 From: Norbert Szulc Date: Wed, 2 Nov 2022 12:06:03 +0100 Subject: [PATCH 02/49] Add list_logical_devices to public (#4450) * Add list_logical_devices to public https://github.com/maxgerhardt/platform-raspberrypi/issues/15 * Sort imports Co-authored-by: Ivan Kravets --- platformio/public.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/public.py b/platformio/public.py index 681ab126..0c22b3b9 100644 --- a/platformio/public.py +++ b/platformio/public.py @@ -14,7 +14,7 @@ # pylint: disable=unused-import -from platformio.device.list.util import list_serial_ports +from platformio.device.list.util import list_logical_devices, list_serial_ports from platformio.device.monitor.filters.base import DeviceMonitorFilterBase from platformio.fs import to_unix_path from platformio.platform.base import PlatformBase From 30fc00098dc956c499a82bb7480519e47f76dddb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 2 Nov 2022 13:08:36 +0200 Subject: [PATCH 03/49] Black formatting --- platformio/package/download.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platformio/package/download.py b/platformio/package/download.py index 73969dc9..5045e856 100644 --- a/platformio/package/download.py +++ b/platformio/package/download.py @@ -72,7 +72,9 @@ class FileDownloader: def start(self, with_progress=True, silent=False): label = "Downloading" file_size = self.get_size() - itercontent = self._http_response.iter_content(chunk_size=io.DEFAULT_BUFFER_SIZE) + itercontent = self._http_response.iter_content( + chunk_size=io.DEFAULT_BUFFER_SIZE + ) try: with open(self._destination, "wb") as fp: if file_size == -1 or not with_progress or silent: From 32c2e33edfd5c66923aa1b3b32c6d76df9c1246f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 5 Nov 2022 11:47:34 +0200 Subject: [PATCH 04/49] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index f82e7f42..71741fe7 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f82e7f42668b0f27963ba21792eb72f2504582de +Subproject commit 71741fe70c5bdb031a0182de027ac7dbe0ac02d5 From ca7a10039252f021ab6cd878987c8642c78bbafe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 5 Nov 2022 12:03:06 +0200 Subject: [PATCH 05/49] Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license) --- HISTORY.rst | 2 ++ platformio/device/list/util.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3cc5f75f..099cf332 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,6 +16,8 @@ PlatformIO Core 6 6.1.6 (2022-??-??) ~~~~~~~~~~~~~~~~~~ +* Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license) + 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/device/list/util.py b/platformio/device/list/util.py index 2c1d0385..297f43fc 100644 --- a/platformio/device/list/util.py +++ b/platformio/device/list/util.py @@ -18,8 +18,6 @@ import re import time from glob import glob -import zeroconf - from platformio import __version__, exception, proc from platformio.compat import IS_MACOS, IS_WINDOWS @@ -84,6 +82,8 @@ def list_logical_devices(): def list_mdns_services(): + import zeroconf + class mDNSListener: def __init__(self): self._zc = zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All) From 7f8784e2a8efd32b78c2931780a941d654eee31d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 5 Nov 2022 12:04:36 +0200 Subject: [PATCH 06/49] PyLint fix --- platformio/device/list/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/device/list/util.py b/platformio/device/list/util.py index 297f43fc..94443f4f 100644 --- a/platformio/device/list/util.py +++ b/platformio/device/list/util.py @@ -82,7 +82,7 @@ def list_logical_devices(): def list_mdns_services(): - import zeroconf + import zeroconf # pylint: disable=import-outside-toplevel class mDNSListener: def __init__(self): From b11925a9ecf0a1a2d094461095253006672de32a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 5 Nov 2022 12:04:50 +0200 Subject: [PATCH 07/49] Bump version to 6.1.6a2 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index be75cf45..db994f74 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (6, 1, "6a1") +VERSION = (6, 1, "6a2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 93ce9b0c5ee230ff65d8ce96597e1ed09066316a Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Fri, 18 Nov 2022 11:23:33 +0100 Subject: [PATCH 08/49] add missing space (#4463) --- scripts/99-platformio-udev.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index 760b5743..5a298e15 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -76,7 +76,7 @@ ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", MODE="0666", ENV{ID_MM_DEVICE # FireBeetle-ESP32 ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7522", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" -#Wio Terminal +# Wio Terminal ATTRS{idVendor}=="2886", ATTRS{idProduct}=="[08]02d", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" # Raspberry Pi Pico From 3277ac3a18754d08a0afb54691b62bbe280a81f3 Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Fri, 18 Nov 2022 11:24:04 +0100 Subject: [PATCH 09/49] ci: update actions (#4464) * ci: update actions * ci: update actions * ci: update actions * ci: use py3.9 for docs --- .github/workflows/docs.yml | 14 +++++++------- .github/workflows/examples.yml | 2 +- .github/workflows/projects.yml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f11b0006..35802033 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: Docs +name: Documentation on: [push, pull_request] @@ -7,13 +7,13 @@ jobs: name: Build Docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: "recursive" - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.9 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -40,7 +40,7 @@ jobs: - name: Save artifact if: ${{ github.event_name == 'push' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: docs path: ./docs.tar.gz @@ -57,7 +57,7 @@ jobs: if: ${{ github.event_name == 'push' }} steps: - name: Download artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: docs - name: Unpack artifact @@ -78,7 +78,7 @@ jobs: fi - name: Checkout latest Docs continue-on-error: true - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: ${{ env.DOCS_REPO }} path: ${{ env.DOCS_DIR }} diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 115817c4..6bb258e0 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -20,7 +20,7 @@ jobs: submodules: "recursive" - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: "3.9" diff --git a/.github/workflows/projects.yml b/.github/workflows/projects.yml index 34c30144..0077a3bd 100644 --- a/.github/workflows/projects.yml +++ b/.github/workflows/projects.yml @@ -45,7 +45,7 @@ jobs: submodules: "recursive" - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.9 @@ -53,7 +53,7 @@ jobs: run: pip install -U . - name: Check out ${{ matrix.project.repository }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: "recursive" repository: ${{ matrix.project.repository }} From 476bf2092343fdc33b6109e842cce95572defa06 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Nov 2022 13:34:08 +0200 Subject: [PATCH 10/49] Update CI scripts --- .github/workflows/core.yml | 6 +++--- .github/workflows/deployment.yml | 2 +- .github/workflows/projects.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index e566e02c..623720db 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -8,12 +8,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.6", "3.9", "3.11"] exclude: - os: macos-latest python-version: "3.6" - os: windows-latest - python-version: "3.10" + python-version: "3.11" runs-on: ${{ matrix.os }} @@ -23,7 +23,7 @@ jobs: submodules: "recursive" - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 9d652a7d..ff353c31 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -17,7 +17,7 @@ jobs: submodules: "recursive" - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: "3.9" diff --git a/.github/workflows/projects.yml b/.github/workflows/projects.yml index 0077a3bd..080b8162 100644 --- a/.github/workflows/projects.yml +++ b/.github/workflows/projects.yml @@ -32,7 +32,7 @@ jobs: repository: "1technophile/OpenMQTTGateway" folder: "OpenMQTTGateway" config_dir: "OpenMQTTGateway" - env_name: "esp32-m5atom" + env_name: "esp32-m5atom-lite" os: [ubuntu-latest, windows-latest, macos-latest] exclude: - os: windows-latest From bf769e1a9e608c64b4744f0c12f8f48eb762c003 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Nov 2022 13:39:36 +0200 Subject: [PATCH 11/49] Update deps --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a4b8a3c8..e348cf9d 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ minimal_requirements = [ home_requirements = [ "aiofiles==%s" % ("0.8.0" if PY36 else "22.1.*"), "ajsonrpc==1.*", - "starlette==%s" % ("0.19.1" if PY36 else "0.21.*"), + "starlette==%s" % ("0.19.1" if PY36 else "0.22.*"), "uvicorn==%s" % ("0.16.0" if PY36 else "0.19.*"), "wsproto==%s" % ("1.0.0" if PY36 else "1.2.*"), ] From 7e6cb84c879a3d5080bd53183f80575d10a45cd5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Nov 2022 15:44:49 +0200 Subject: [PATCH 12/49] Add "env.IsCleanTarget()" to the Build API --- platformio/builder/main.py | 9 ++++----- platformio/builder/tools/piotarget.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 36121743..b56dc2a2 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -157,11 +157,6 @@ if env.subst("$BUILD_CACHE_DIR"): os.makedirs(env.subst("$BUILD_CACHE_DIR")) env.CacheDir("$BUILD_CACHE_DIR") -is_clean_all = "cleanall" in COMMAND_LINE_TARGETS -if env.GetOption("clean") or is_clean_all: - env.PioClean(is_clean_all) - env.Exit(0) - if not int(ARGUMENTS.get("PIOVERBOSE", 0)): click.echo("Verbose mode can be enabled via `-v, --verbose` option") @@ -185,6 +180,10 @@ env.SConsignFile( for item in env.GetExtraScripts("pre"): env.SConscript(item, exports="env") +if env.IsCleanTarget(): + env.CleanProject("cleanall" in COMMAND_LINE_TARGETS) + env.Exit(0) + env.SConscript("$BUILD_SCRIPT") if "UPLOAD_FLAGS" in env: diff --git a/platformio/builder/tools/piotarget.py b/platformio/builder/tools/piotarget.py index 51333e4d..f2dc774d 100644 --- a/platformio/builder/tools/piotarget.py +++ b/platformio/builder/tools/piotarget.py @@ -16,6 +16,7 @@ import os from SCons.Action import Action # pylint: disable=import-error from SCons.Script import ARGUMENTS # pylint: disable=import-error +from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error from SCons.Script import AlwaysBuild # pylint: disable=import-error from platformio import compat, fs @@ -27,7 +28,11 @@ def VerboseAction(_, act, actstr): return Action(act, actstr) -def PioClean(env, clean_all=False): +def IsCleanTarget(env): + return env.GetOption("clean") or ("cleanall" in COMMAND_LINE_TARGETS) + + +def CleanProject(env, clean_all=False): def _relpath(path): if compat.IS_WINDOWS: prefix = os.getcwd()[:2].lower() @@ -103,7 +108,8 @@ def exists(_): def generate(env): env.AddMethod(VerboseAction) - env.AddMethod(PioClean) + env.AddMethod(IsCleanTarget) + env.AddMethod(CleanProject) env.AddMethod(AddTarget) env.AddMethod(AddPlatformTarget) env.AddMethod(AddCustomTarget) From b35f1ea5727b9870c58c9d073ad5872a004a78da Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Nov 2022 15:48:39 +0200 Subject: [PATCH 13/49] Added support for Python 3.11 --- .github/workflows/core.yml | 5 ----- HISTORY.rst | 1 + platformio/compat.py | 5 +---- tox.ini | 4 ++-- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 623720db..6257376a 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -9,11 +9,6 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ["3.6", "3.9", "3.11"] - exclude: - - os: macos-latest - python-version: "3.6" - - os: windows-latest - python-version: "3.11" runs-on: ${{ matrix.os }} diff --git a/HISTORY.rst b/HISTORY.rst index 099cf332..a1a9aec8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,6 +16,7 @@ PlatformIO Core 6 6.1.6 (2022-??-??) ~~~~~~~~~~~~~~~~~~ +* Added support for Python 3.11 * Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license) 6.1.5 (2022-11-01) diff --git a/platformio/compat.py b/platformio/compat.py index 9cf9161e..17b4cc0a 100644 --- a/platformio/compat.py +++ b/platformio/compat.py @@ -85,10 +85,7 @@ def get_filesystem_encoding(): def get_locale_encoding(): - try: - return locale.getdefaultlocale()[1] - except ValueError: - return None + return locale.getpreferredencoding() def get_object_members(obj, ignore_private=True): diff --git a/tox.ini b/tox.ini index 8972933e..c5cc66d3 100644 --- a/tox.ini +++ b/tox.ini @@ -19,8 +19,8 @@ known_third_party=OpenSSL, SCons, jsonrpc, twisted, zope [pytest] filterwarnings = error - # SCons - ignore:.*_ImportRedirect.find_spec() + # Bottle + ignore:.*'cgi' is deprecated and slated for removal [testenv] passenv = * From bf7fb159413a5c333874afe5e6c59d5b8622dae7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Nov 2022 19:51:19 +0200 Subject: [PATCH 14/49] =?UTF-8?q?Made=20assets=20(templates,=20"99-platfor?= =?UTF-8?q?mio-udev.rules")=20part=20of=20Python=E2=80=99s=20module=20//?= =?UTF-8?q?=20Resolve=20#4458?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 1 + docs | 2 +- .../assets/system}/99-platformio-udev.rules | 0 .../ide-projects}/atom/.clang_complete.tpl | 0 .../ide-projects}/atom/.gcc-flags.json.tpl | 0 .../ide-projects}/atom/.gitignore.tpl | 0 .../ide-projects}/clion/.gitignore.tpl | 0 .../ide-projects}/clion/CMakeLists.txt.tpl | 0 .../clion/CMakeListsPrivate.txt.tpl | 0 .../codeblocks/platformio.cbp.tpl | 0 .../ide-projects}/eclipse/.cproject.tpl | 0 .../ide-projects}/eclipse/.project.tpl | 0 .../.settings/PlatformIO Debugger.launch.tpl | 0 .../.settings/language.settings.xml.tpl | 0 .../.settings/org.eclipse.cdt.core.prefs.tpl | 0 .../templates/ide-projects}/emacs/.ccls.tpl | 0 .../ide-projects}/emacs/.gitignore.tpl | 0 .../netbeans/nbproject/configurations.xml.tpl | 0 .../nbproject/private/configurations.xml.tpl | 0 .../nbproject/private/launcher.properties.tpl | 0 .../nbproject/private/private.xml.tpl | 0 .../netbeans/nbproject/project.xml.tpl | 0 .../ide-projects}/qtcreator/.gitignore.tpl | 0 .../ide-projects}/qtcreator/Makefile.tpl | 0 .../qtcreator/platformio.cflags.tpl | 0 .../qtcreator/platformio.config.tpl | 0 .../qtcreator/platformio.creator.tpl | 0 .../qtcreator/platformio.cxxflags.tpl | 0 .../qtcreator/platformio.files.tpl | 0 .../qtcreator/platformio.includes.tpl | 0 .../ide-projects}/sublimetext/.ccls.tpl | 0 .../platformio.sublime-project.tpl | 0 .../templates/ide-projects}/vim/.ccls.tpl | 0 .../ide-projects}/vim/.gitignore.tpl | 0 .../platformio.vcxproj.filters.tpl | 0 .../visualstudio/platformio.vcxproj.tpl | 0 .../ide-projects}/vscode/.gitignore.tpl | 0 .../vscode/.vscode/c_cpp_properties.json.tpl | 0 .../vscode/.vscode/extensions.json.tpl | 0 .../vscode/.vscode/launch.json.tpl | 0 platformio/fs.py | 6 +++++- platformio/project/integration/generator.py | 20 +++++++++++-------- setup.py | 13 ++++++------ 43 files changed, 25 insertions(+), 17 deletions(-) rename {scripts => platformio/assets/system}/99-platformio-udev.rules (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/atom/.clang_complete.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/atom/.gcc-flags.json.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/atom/.gitignore.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/clion/.gitignore.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/clion/CMakeLists.txt.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/clion/CMakeListsPrivate.txt.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/codeblocks/platformio.cbp.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/eclipse/.cproject.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/eclipse/.project.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/eclipse/.settings/PlatformIO Debugger.launch.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/eclipse/.settings/language.settings.xml.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/eclipse/.settings/org.eclipse.cdt.core.prefs.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/emacs/.ccls.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/emacs/.gitignore.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/netbeans/nbproject/configurations.xml.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/netbeans/nbproject/private/configurations.xml.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/netbeans/nbproject/private/launcher.properties.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/netbeans/nbproject/private/private.xml.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/netbeans/nbproject/project.xml.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/.gitignore.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/Makefile.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/platformio.cflags.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/platformio.config.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/platformio.creator.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/platformio.cxxflags.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/platformio.files.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/qtcreator/platformio.includes.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/sublimetext/.ccls.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/sublimetext/platformio.sublime-project.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/vim/.ccls.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/vim/.gitignore.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/visualstudio/platformio.vcxproj.filters.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/visualstudio/platformio.vcxproj.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/vscode/.gitignore.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/vscode/.vscode/c_cpp_properties.json.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/vscode/.vscode/extensions.json.tpl (100%) rename platformio/{project/integration/tpls => assets/templates/ide-projects}/vscode/.vscode/launch.json.tpl (100%) diff --git a/HISTORY.rst b/HISTORY.rst index a1a9aec8..c65b827a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,6 +17,7 @@ PlatformIO Core 6 ~~~~~~~~~~~~~~~~~~ * Added support for Python 3.11 +* Made assets (templates, ``99-platformio-udev.rules``) part of Python's module (`issue #4458 `_) * Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license) 6.1.5 (2022-11-01) diff --git a/docs b/docs index 71741fe7..19dff224 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 71741fe70c5bdb031a0182de027ac7dbe0ac02d5 +Subproject commit 19dff224639b6f2e97062841349fd48269ef1923 diff --git a/scripts/99-platformio-udev.rules b/platformio/assets/system/99-platformio-udev.rules similarity index 100% rename from scripts/99-platformio-udev.rules rename to platformio/assets/system/99-platformio-udev.rules diff --git a/platformio/project/integration/tpls/atom/.clang_complete.tpl b/platformio/assets/templates/ide-projects/atom/.clang_complete.tpl similarity index 100% rename from platformio/project/integration/tpls/atom/.clang_complete.tpl rename to platformio/assets/templates/ide-projects/atom/.clang_complete.tpl diff --git a/platformio/project/integration/tpls/atom/.gcc-flags.json.tpl b/platformio/assets/templates/ide-projects/atom/.gcc-flags.json.tpl similarity index 100% rename from platformio/project/integration/tpls/atom/.gcc-flags.json.tpl rename to platformio/assets/templates/ide-projects/atom/.gcc-flags.json.tpl diff --git a/platformio/project/integration/tpls/atom/.gitignore.tpl b/platformio/assets/templates/ide-projects/atom/.gitignore.tpl similarity index 100% rename from platformio/project/integration/tpls/atom/.gitignore.tpl rename to platformio/assets/templates/ide-projects/atom/.gitignore.tpl diff --git a/platformio/project/integration/tpls/clion/.gitignore.tpl b/platformio/assets/templates/ide-projects/clion/.gitignore.tpl similarity index 100% rename from platformio/project/integration/tpls/clion/.gitignore.tpl rename to platformio/assets/templates/ide-projects/clion/.gitignore.tpl diff --git a/platformio/project/integration/tpls/clion/CMakeLists.txt.tpl b/platformio/assets/templates/ide-projects/clion/CMakeLists.txt.tpl similarity index 100% rename from platformio/project/integration/tpls/clion/CMakeLists.txt.tpl rename to platformio/assets/templates/ide-projects/clion/CMakeLists.txt.tpl diff --git a/platformio/project/integration/tpls/clion/CMakeListsPrivate.txt.tpl b/platformio/assets/templates/ide-projects/clion/CMakeListsPrivate.txt.tpl similarity index 100% rename from platformio/project/integration/tpls/clion/CMakeListsPrivate.txt.tpl rename to platformio/assets/templates/ide-projects/clion/CMakeListsPrivate.txt.tpl diff --git a/platformio/project/integration/tpls/codeblocks/platformio.cbp.tpl b/platformio/assets/templates/ide-projects/codeblocks/platformio.cbp.tpl similarity index 100% rename from platformio/project/integration/tpls/codeblocks/platformio.cbp.tpl rename to platformio/assets/templates/ide-projects/codeblocks/platformio.cbp.tpl diff --git a/platformio/project/integration/tpls/eclipse/.cproject.tpl b/platformio/assets/templates/ide-projects/eclipse/.cproject.tpl similarity index 100% rename from platformio/project/integration/tpls/eclipse/.cproject.tpl rename to platformio/assets/templates/ide-projects/eclipse/.cproject.tpl diff --git a/platformio/project/integration/tpls/eclipse/.project.tpl b/platformio/assets/templates/ide-projects/eclipse/.project.tpl similarity index 100% rename from platformio/project/integration/tpls/eclipse/.project.tpl rename to platformio/assets/templates/ide-projects/eclipse/.project.tpl diff --git a/platformio/project/integration/tpls/eclipse/.settings/PlatformIO Debugger.launch.tpl b/platformio/assets/templates/ide-projects/eclipse/.settings/PlatformIO Debugger.launch.tpl similarity index 100% rename from platformio/project/integration/tpls/eclipse/.settings/PlatformIO Debugger.launch.tpl rename to platformio/assets/templates/ide-projects/eclipse/.settings/PlatformIO Debugger.launch.tpl diff --git a/platformio/project/integration/tpls/eclipse/.settings/language.settings.xml.tpl b/platformio/assets/templates/ide-projects/eclipse/.settings/language.settings.xml.tpl similarity index 100% rename from platformio/project/integration/tpls/eclipse/.settings/language.settings.xml.tpl rename to platformio/assets/templates/ide-projects/eclipse/.settings/language.settings.xml.tpl diff --git a/platformio/project/integration/tpls/eclipse/.settings/org.eclipse.cdt.core.prefs.tpl b/platformio/assets/templates/ide-projects/eclipse/.settings/org.eclipse.cdt.core.prefs.tpl similarity index 100% rename from platformio/project/integration/tpls/eclipse/.settings/org.eclipse.cdt.core.prefs.tpl rename to platformio/assets/templates/ide-projects/eclipse/.settings/org.eclipse.cdt.core.prefs.tpl diff --git a/platformio/project/integration/tpls/emacs/.ccls.tpl b/platformio/assets/templates/ide-projects/emacs/.ccls.tpl similarity index 100% rename from platformio/project/integration/tpls/emacs/.ccls.tpl rename to platformio/assets/templates/ide-projects/emacs/.ccls.tpl diff --git a/platformio/project/integration/tpls/emacs/.gitignore.tpl b/platformio/assets/templates/ide-projects/emacs/.gitignore.tpl similarity index 100% rename from platformio/project/integration/tpls/emacs/.gitignore.tpl rename to platformio/assets/templates/ide-projects/emacs/.gitignore.tpl diff --git a/platformio/project/integration/tpls/netbeans/nbproject/configurations.xml.tpl b/platformio/assets/templates/ide-projects/netbeans/nbproject/configurations.xml.tpl similarity index 100% rename from platformio/project/integration/tpls/netbeans/nbproject/configurations.xml.tpl rename to platformio/assets/templates/ide-projects/netbeans/nbproject/configurations.xml.tpl diff --git a/platformio/project/integration/tpls/netbeans/nbproject/private/configurations.xml.tpl b/platformio/assets/templates/ide-projects/netbeans/nbproject/private/configurations.xml.tpl similarity index 100% rename from platformio/project/integration/tpls/netbeans/nbproject/private/configurations.xml.tpl rename to platformio/assets/templates/ide-projects/netbeans/nbproject/private/configurations.xml.tpl diff --git a/platformio/project/integration/tpls/netbeans/nbproject/private/launcher.properties.tpl b/platformio/assets/templates/ide-projects/netbeans/nbproject/private/launcher.properties.tpl similarity index 100% rename from platformio/project/integration/tpls/netbeans/nbproject/private/launcher.properties.tpl rename to platformio/assets/templates/ide-projects/netbeans/nbproject/private/launcher.properties.tpl diff --git a/platformio/project/integration/tpls/netbeans/nbproject/private/private.xml.tpl b/platformio/assets/templates/ide-projects/netbeans/nbproject/private/private.xml.tpl similarity index 100% rename from platformio/project/integration/tpls/netbeans/nbproject/private/private.xml.tpl rename to platformio/assets/templates/ide-projects/netbeans/nbproject/private/private.xml.tpl diff --git a/platformio/project/integration/tpls/netbeans/nbproject/project.xml.tpl b/platformio/assets/templates/ide-projects/netbeans/nbproject/project.xml.tpl similarity index 100% rename from platformio/project/integration/tpls/netbeans/nbproject/project.xml.tpl rename to platformio/assets/templates/ide-projects/netbeans/nbproject/project.xml.tpl diff --git a/platformio/project/integration/tpls/qtcreator/.gitignore.tpl b/platformio/assets/templates/ide-projects/qtcreator/.gitignore.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/.gitignore.tpl rename to platformio/assets/templates/ide-projects/qtcreator/.gitignore.tpl diff --git a/platformio/project/integration/tpls/qtcreator/Makefile.tpl b/platformio/assets/templates/ide-projects/qtcreator/Makefile.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/Makefile.tpl rename to platformio/assets/templates/ide-projects/qtcreator/Makefile.tpl diff --git a/platformio/project/integration/tpls/qtcreator/platformio.cflags.tpl b/platformio/assets/templates/ide-projects/qtcreator/platformio.cflags.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/platformio.cflags.tpl rename to platformio/assets/templates/ide-projects/qtcreator/platformio.cflags.tpl diff --git a/platformio/project/integration/tpls/qtcreator/platformio.config.tpl b/platformio/assets/templates/ide-projects/qtcreator/platformio.config.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/platformio.config.tpl rename to platformio/assets/templates/ide-projects/qtcreator/platformio.config.tpl diff --git a/platformio/project/integration/tpls/qtcreator/platformio.creator.tpl b/platformio/assets/templates/ide-projects/qtcreator/platformio.creator.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/platformio.creator.tpl rename to platformio/assets/templates/ide-projects/qtcreator/platformio.creator.tpl diff --git a/platformio/project/integration/tpls/qtcreator/platformio.cxxflags.tpl b/platformio/assets/templates/ide-projects/qtcreator/platformio.cxxflags.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/platformio.cxxflags.tpl rename to platformio/assets/templates/ide-projects/qtcreator/platformio.cxxflags.tpl diff --git a/platformio/project/integration/tpls/qtcreator/platformio.files.tpl b/platformio/assets/templates/ide-projects/qtcreator/platformio.files.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/platformio.files.tpl rename to platformio/assets/templates/ide-projects/qtcreator/platformio.files.tpl diff --git a/platformio/project/integration/tpls/qtcreator/platformio.includes.tpl b/platformio/assets/templates/ide-projects/qtcreator/platformio.includes.tpl similarity index 100% rename from platformio/project/integration/tpls/qtcreator/platformio.includes.tpl rename to platformio/assets/templates/ide-projects/qtcreator/platformio.includes.tpl diff --git a/platformio/project/integration/tpls/sublimetext/.ccls.tpl b/platformio/assets/templates/ide-projects/sublimetext/.ccls.tpl similarity index 100% rename from platformio/project/integration/tpls/sublimetext/.ccls.tpl rename to platformio/assets/templates/ide-projects/sublimetext/.ccls.tpl diff --git a/platformio/project/integration/tpls/sublimetext/platformio.sublime-project.tpl b/platformio/assets/templates/ide-projects/sublimetext/platformio.sublime-project.tpl similarity index 100% rename from platformio/project/integration/tpls/sublimetext/platformio.sublime-project.tpl rename to platformio/assets/templates/ide-projects/sublimetext/platformio.sublime-project.tpl diff --git a/platformio/project/integration/tpls/vim/.ccls.tpl b/platformio/assets/templates/ide-projects/vim/.ccls.tpl similarity index 100% rename from platformio/project/integration/tpls/vim/.ccls.tpl rename to platformio/assets/templates/ide-projects/vim/.ccls.tpl diff --git a/platformio/project/integration/tpls/vim/.gitignore.tpl b/platformio/assets/templates/ide-projects/vim/.gitignore.tpl similarity index 100% rename from platformio/project/integration/tpls/vim/.gitignore.tpl rename to platformio/assets/templates/ide-projects/vim/.gitignore.tpl diff --git a/platformio/project/integration/tpls/visualstudio/platformio.vcxproj.filters.tpl b/platformio/assets/templates/ide-projects/visualstudio/platformio.vcxproj.filters.tpl similarity index 100% rename from platformio/project/integration/tpls/visualstudio/platformio.vcxproj.filters.tpl rename to platformio/assets/templates/ide-projects/visualstudio/platformio.vcxproj.filters.tpl diff --git a/platformio/project/integration/tpls/visualstudio/platformio.vcxproj.tpl b/platformio/assets/templates/ide-projects/visualstudio/platformio.vcxproj.tpl similarity index 100% rename from platformio/project/integration/tpls/visualstudio/platformio.vcxproj.tpl rename to platformio/assets/templates/ide-projects/visualstudio/platformio.vcxproj.tpl diff --git a/platformio/project/integration/tpls/vscode/.gitignore.tpl b/platformio/assets/templates/ide-projects/vscode/.gitignore.tpl similarity index 100% rename from platformio/project/integration/tpls/vscode/.gitignore.tpl rename to platformio/assets/templates/ide-projects/vscode/.gitignore.tpl diff --git a/platformio/project/integration/tpls/vscode/.vscode/c_cpp_properties.json.tpl b/platformio/assets/templates/ide-projects/vscode/.vscode/c_cpp_properties.json.tpl similarity index 100% rename from platformio/project/integration/tpls/vscode/.vscode/c_cpp_properties.json.tpl rename to platformio/assets/templates/ide-projects/vscode/.vscode/c_cpp_properties.json.tpl diff --git a/platformio/project/integration/tpls/vscode/.vscode/extensions.json.tpl b/platformio/assets/templates/ide-projects/vscode/.vscode/extensions.json.tpl similarity index 100% rename from platformio/project/integration/tpls/vscode/.vscode/extensions.json.tpl rename to platformio/assets/templates/ide-projects/vscode/.vscode/extensions.json.tpl diff --git a/platformio/project/integration/tpls/vscode/.vscode/launch.json.tpl b/platformio/assets/templates/ide-projects/vscode/.vscode/launch.json.tpl similarity index 100% rename from platformio/project/integration/tpls/vscode/.vscode/launch.json.tpl rename to platformio/assets/templates/ide-projects/vscode/.vscode/launch.json.tpl diff --git a/platformio/fs.py b/platformio/fs.py index 60111694..bd17950b 100644 --- a/platformio/fs.py +++ b/platformio/fs.py @@ -50,6 +50,10 @@ def get_source_dir(): return os.path.dirname(curpath) +def get_assets_dir(): + return os.path.join(get_source_dir(), "assets") + + def load_json(file_path): try: with open(file_path, mode="r", encoding="utf8") as f: @@ -99,7 +103,7 @@ def calculate_folder_size(path): def get_platformio_udev_rules_path(): return os.path.abspath( - os.path.join(get_source_dir(), "..", "scripts", "99-platformio-udev.rules") + os.path.join(get_assets_dir(), "system", "99-platformio-udev.rules") ) diff --git a/platformio/project/integration/generator.py b/platformio/project/integration/generator.py index 7ffd05e3..4a4eb480 100644 --- a/platformio/project/integration/generator.py +++ b/platformio/project/integration/generator.py @@ -15,7 +15,6 @@ import codecs import os import sys -from pathlib import Path import bottle @@ -51,12 +50,17 @@ class ProjectGenerator: return envname @staticmethod - def get_supported_ides(): + def get_ide_tpls_dir(): + return os.path.join(fs.get_assets_dir(), "templates", "ide-projects") + + @classmethod + def get_supported_ides(cls): + tpls_dir = cls.get_ide_tpls_dir() return sorted( [ - item.name - for item in (Path(__file__).parent / "tpls").iterdir() - if item.is_dir() + name + for name in os.listdir(tpls_dir) + if os.path.isdir(os.path.join(tpls_dir, name)) ] ) @@ -132,12 +136,12 @@ class ProjectGenerator: def get_tpls(self): tpls = [] - tpls_dir = str(Path(__file__).parent / "tpls" / self.ide) - for root, _, files in os.walk(tpls_dir): + ide_tpls_dir = os.path.join(self.get_ide_tpls_dir(), self.ide) + for root, _, files in os.walk(ide_tpls_dir): for f in files: if not f.endswith(".tpl"): continue - _relpath = root.replace(tpls_dir, "") + _relpath = root.replace(ide_tpls_dir, "") if _relpath.startswith(os.sep): _relpath = _relpath[1:] tpls.append((_relpath, os.path.join(root, f))) diff --git a/setup.py b/setup.py index e348cf9d..95877bd6 100644 --- a/setup.py +++ b/setup.py @@ -61,15 +61,14 @@ setup( license=__license__, install_requires=minimal_requirements + home_requirements, python_requires=">=3.6", - packages=find_packages(exclude=["tests.*", "tests"]) + ["scripts"], + packages=find_packages(include=["platformio", "platformio.*"]), package_data={ "platformio": [ - "project/integration/tpls/*/.*.tpl", - "project/integration/tpls/*/*.tpl", - "project/integration/tpls/*/*/*.tpl", - "project/integration/tpls/*/.*/*.tpl", - ], - "scripts": ["99-platformio-udev.rules"], + "assets/**/*.rules", + "assets/**/*.tpl", + "assets/**/.*.tpl", # include hidden files + "assets/**/.*/*.tpl", # include hidden folders + ] }, entry_points={ "console_scripts": [ From ec5bf1b5e78cf6baa180e8efb51db4e9a30e5546 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Nov 2022 19:52:02 +0200 Subject: [PATCH 15/49] Bump version to 6.1.6a3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index db994f74..f36f1e0a 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (6, 1, "6a2") +VERSION = (6, 1, "6a3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From fb09077c388306094aef3b08676912f709a65b1d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 18 Nov 2022 21:56:09 +0200 Subject: [PATCH 16/49] Update docs.yml --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 35802033..2765b55d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: Documentation +name: Docs on: [push, pull_request] From 5ec5660fa65c766b9278f447c785117ff59d7c79 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 22 Nov 2022 20:06:00 +0200 Subject: [PATCH 17/49] Update deps --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 95877bd6..1e3997b9 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ home_requirements = [ "aiofiles==%s" % ("0.8.0" if PY36 else "22.1.*"), "ajsonrpc==1.*", "starlette==%s" % ("0.19.1" if PY36 else "0.22.*"), - "uvicorn==%s" % ("0.16.0" if PY36 else "0.19.*"), + "uvicorn==%s" % ("0.16.0" if PY36 else "0.20.*"), "wsproto==%s" % ("1.0.0" if PY36 else "1.2.*"), ] From bf3942e7cc119a8151dbf0dcb4ab2f0dc993e023 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 25 Nov 2022 02:20:06 +0200 Subject: [PATCH 18/49] Use full paths to the assets (issue with setuptools) --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 1e3997b9..00b47251 100644 --- a/setup.py +++ b/setup.py @@ -64,10 +64,10 @@ setup( packages=find_packages(include=["platformio", "platformio.*"]), package_data={ "platformio": [ - "assets/**/*.rules", - "assets/**/*.tpl", - "assets/**/.*.tpl", # include hidden files - "assets/**/.*/*.tpl", # include hidden folders + "assets/system/99-platformio-udev.rules", + "assets/templates/ide-projects/*/*.tpl", + "assets/templates/ide-projects/*/.*.tpl", # include hidden files + "assets/templates/ide-projects/*/.*/*.tpl", # include hidden folders ] }, entry_points={ From a1d979859453e3f72245e84c59f327213adf9474 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 25 Nov 2022 02:20:38 +0200 Subject: [PATCH 19/49] Bump version to 6.1.6a4 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index f36f1e0a..fa19e21d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (6, 1, "6a3") +VERSION = (6, 1, "6a4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 190ebcccfefc50dea9310ff801c8853f147fef28 Mon Sep 17 00:00:00 2001 From: Dror Gluska Date: Mon, 28 Nov 2022 19:57:36 +0200 Subject: [PATCH 20/49] add library.json schema (#4476) --- platformio/assets/schema/library.json | 484 ++++++++++++++++++++++++++ 1 file changed, 484 insertions(+) create mode 100644 platformio/assets/schema/library.json diff --git a/platformio/assets/schema/library.json b/platformio/assets/schema/library.json new file mode 100644 index 00000000..30c67372 --- /dev/null +++ b/platformio/assets/schema/library.json @@ -0,0 +1,484 @@ +{ + "$id": "https://example.com/library.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "library.json schema", + "type": "object", + "properties": { + "name": { + "type": "string", + "maxLength": 50, + "description": "A name of a library.\nMust be unique in the PlatformIO Registry\nShould be slug style for simplicity, consistency, and compatibility. Example: HelloWorld\nCan contain a-z, digits, and dashes (but not start/end with them)\nConsecutive dashes and [:;/,@<>] chars are not allowed.", + "required": true + }, + "version": { + "type": "string", + "maxLength": 20, + "description": "A version of a current library source code. Can contain a-z, digits, dots or dash and should be Semantic Versioning compatible.", + "required": true + }, + "description": { + "type": "string", + "maxLength": 255, + "description": "The field helps users to identify and search for your library with a brief description. Describe the hardware devices (sensors, boards and etc.) which are suitable with it.", + "required": true + }, + "keywords": { + "anyOf": [ + { + "type": "string", + "maxLength": 255 + }, + { + "type": "array", + "items": { + "type": "string", + "maxLength": 255 + } + } + ], + "description": "Used for search by keyword. Helps to make your library easier to discover without people needing to know its name.\nThe keyword should be lowercased, can contain a-z, digits and dash (but not start/end with them). A list from the keywords can be specified with separator , or declared as Array.", + "required": true + }, + "homepage": { + "type": "string", + "maxLength": 255, + "description": "Home page of a library (if is different from repository url).", + "required": false + }, + "repository": { + "type": "object", + "properties": { + "type": { + "enum": [ + "git", + "hg", + "svn" + ], + "description": "only “git”, “hg” or “svn” are supported" + }, + "url": { + "type": "string" + }, + "branch": { + "type": "string", + "description": "if is not specified, default branch will be used. This field will be ignored if tag/release exists with the value of version." + } + }, + "description": "The repository in which the source code can be found.", + "required": false + }, + "authors": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "required": true, + "description": "Full name" + }, + "email": { + "type": "string" + }, + "url": { + "type": "string", + "description": "An author’s contact page" + }, + "maintainer": { + "type": "boolean", + "description": "Specify “maintainer” status" + } + } + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "required": true, + "description": "Full name" + }, + "email": { + "type": "string" + }, + "url": { + "type": "string", + "description": "An author’s contact page" + }, + "maintainer": { + "type": "boolean", + "description": "Specify “maintainer” status" + } + } + } + } + ], + "description": "An author contact information\nIf authors field is not defined, PlatformIO will try to fetch data from VCS provider (Github, Gitlab, etc) if repository is declared.", + "required": false + }, + "license": { + "type": "string", + "description": "A SPDX license ID or SPDX Expression. You can check the full list of SPDX license IDs (see “Identifier” column).", + "required": false + }, + "frameworks": { + "anyOf": [ + { + "type": "string", + "description": "espidf, freertos, *, etc'" + }, + { + "type": "array", + "items": { + "type": "string", + "description": "espidf, freertos, *, etc'" + } + } + ], + "description": "A list with compatible frameworks. The available framework names are defined in the Frameworks section.\nIf the library is compatible with the all frameworks, then do not declare this field or you use *", + "required": false + }, + "platforms": { + "anyOf": [ + { + "type": "string", + "description": "atmelavr, espressif8266, *, etc'" + }, + { + "type": "array", + "items": { + "type": "string", + "description": "atmelavr, espressif8266, *, etc'" + } + } + ], + "description": "A list with compatible development platforms. The available platform name are defined in Development Platforms section.\nIf the library is compatible with the all platforms, then do not declare this field or use *.\nPlatformIO does not check platforms for compatibility in default mode. See Compatibility Mode for details. If you need a strict checking for compatible platforms for a library, please set libCompatMode to strict.", + "required": false + }, + "headers": { + "anyOf": [ + { + "type": "string", + "description": "MyLibrary.h" + }, + { + "type": "array", + "items": { + "type": "string", + "description": "FooCore.h, FooFeature.h" + } + } + ], + "description": "A list of header files that can be included in a project source files using #include <...> directive.", + "required": false + }, + "examples": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "base": { + "type": "string" + }, + "files": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "description": "A list of example patterns.", + "required": "false" + }, + "dependencies": { + "anyOf": [ + { + "type": "object", + "properties": { + "owner": { + "type": "string", + "description": "an owner name (username) from the PlatformIO Registry" + }, + "name": { + "type": "string", + "description": "library name" + }, + "version": { + "type": "string", + "description": "Version Requirements or Package Specifications" + }, + "frameworks": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "project compatible Frameworks" + }, + "platforms": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": " project compatible Development Platforms" + } + } + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "owner": { + "type": "string", + "description": "an owner name (username) from the PlatformIO Registry" + }, + "name": { + "type": "string", + "description": "library name" + }, + "version": { + "type": "string", + "description": "Version Requirements or Package Specifications" + }, + "frameworks": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "project compatible Frameworks" + }, + "platforms": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": " project compatible Development Platforms" + } + } + } + } + ], + "description": "A list of dependent libraries that will be automatically installed.", + "required": false + }, + "export": { + "type": "object", + "properties": { + "include": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Export only files that matched declared patterns.\n* - matches everything\n? - matches any single character\n[seq] - matches any character in seq\n[!seq] - matches any character not in seq" + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Exclude the directories and files which match with exclude patterns." + } + }, + "description": "This option is useful if you need to exclude extra data (test code, docs, images, PDFs, etc). It allows one to reduce the size of the final archive.\nTo check which files will be included in the final packages, please use pio pkg pack command.", + "required": false + }, + "scripts": { + "type": "object", + "properties": { + "postinstall": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "runs a script AFTER the package has been installed.\nRun a custom Python script located in the package “scripts” folder AFTER the package is installed. Please note that you don’t need to specify a Python interpreter for Python scripts" + }, + "preuninstall": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "runs a script BEFORE the package is removed.\nRun a custom Bash script BEFORE the package is uninstalled. The script is declared as a list of command arguments and is located at the root of a package" + } + }, + "description": "Execute custom scripts during the special Package Management CLI life cycle events", + "required": false + }, + "build": { + "type": "object", + "properties": { + "flags": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Extra flags to control preprocessing, compilation, assembly, and linking processes. More details build_flags.\nKeep in mind when operating with the -I flag (directories to be searched for header files). The path should be relative to the root directory where the library.json manifest is located." + }, + "unflags": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Remove base/initial flags which were set by development platform. More details build_unflags." + }, + "includeDir": { + "type": "string", + "description": "Custom directory to be searched for header files. A default value is include and means that folder is located at the root of a library.\nThe Library Dependency Finder (LDF) will pick a library automatically only when a project or other dependent libraries include any header file located in includeDir or srcDir.", + "required": false + }, + "srcDir": { + "type": "string", + "description": "Custom location of library source code. A default value is src and means that folder is located in the root of a library.", + "required": "false" + }, + "srcFilter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Specify which source files should be included/excluded from build process. The path in filter should be relative to the srcDir option of a library.\nSee syntax for build_src_filter.\nPlease note that you can generate source filter “on-the-fly” using extraScript", + "required": false + }, + "extraScript": { + "type": "string", + "description": "Launch extra script before a build process.", + "required": "false" + }, + "libArchive": { + "type": "boolean", + "description": "Create an archive (*.a, static library) from the object files and link it into a firmware (program). This is default behavior of PlatformIO Build System (\"libArchive\": true).\nSetting \"libArchive\": false will instruct PlatformIO Build System to link object files directly (in-line). This could be useful if you need to override weak symbols defined in framework or other libraries.\nYou can disable library archiving globally using lib_archive option in “platformio.ini” (Project Configuration File).", + "required": "false" + }, + "libLDFMode": { + "anyOf": [ + { + "enum": [ + "off" + ], + "description": "“Manual mode”, does not process source files of a project and dependencies. Builds only the libraries that are specified in manifests (library.json, module.json) or using lib_deps option." + }, + { + "enum": [ + "chain" + ], + "description": "[DEFAULT] Parses ALL C/C++ source files of the project and follows only by nested includes (#include ..., chain...) from the libraries. It also parses C, CC, CPP files from libraries which have the same name as included header file. Does not evaluate C/C++ Preprocessor conditional syntax." + }, + { + "enum": [ + "deep" + ], + "description": "Parses ALL C/C++ source files of the project and parses ALL C/C++ source files of the each found dependency (recursively). Does not evaluate C/C++ Preprocessor conditional syntax." + }, + { + "enum": [ + "chain+" + ], + "description": "The same behavior as for the chain but evaluates C/C++ Preprocessor conditional syntax." + }, + { + "enum": [ + "deep+" + ], + "description": "The same behavior as for the deep but evaluates C/C++ Preprocessor conditional syntax." + } + ], + "description": "Specify Library Dependency Finder Mode. See Dependency Finder Mode for details.", + "required": false + }, + "libCompatMode": { + "type": "string", + "description": "Specify Library Compatibility Mode. See Compatibility Mode for details.", + "required": false + }, + "builder": { + "anyOf": [ + { + "enum": [ + "PlatformIOLibBuilder" + ], + "description": "Default Builder" + }, + { + "enum": [ + "ArduinoLibBuilder" + ] + }, + { + "enum": [ + "MbedLibBuilder" + ] + } + ], + "description": "Override default PlatformIOLibBuilder with another builder.", + "required": false + } + }, + "required": false + } + } +} \ No newline at end of file From 2141a09736c35feeed2a87bd67becc3a7385be5a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 28 Nov 2022 22:44:57 +0200 Subject: [PATCH 21/49] A JSON Schema for library.json // Resolve #1903 --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 19dff224..8a6c9704 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 19dff224639b6f2e97062841349fd48269ef1923 +Subproject commit 8a6c9704335b6f0d371b52f7b2f4c48ddfea7ce6 From 527d61296f151e4bf9cae0bd506b9874c1571f7b Mon Sep 17 00:00:00 2001 From: mjysci Date: Wed, 30 Nov 2022 18:52:55 +0800 Subject: [PATCH 22/49] add udev rule for AIR32F103 board (#4481) --- platformio/assets/system/99-platformio-udev.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platformio/assets/system/99-platformio-udev.rules b/platformio/assets/system/99-platformio-udev.rules index 5a298e15..a5897f8f 100644 --- a/platformio/assets/system/99-platformio-udev.rules +++ b/platformio/assets/system/99-platformio-udev.rules @@ -82,6 +82,9 @@ ATTRS{idVendor}=="2886", ATTRS{idProduct}=="[08]02d", MODE="0666", ENV{ID_MM_DEV # Raspberry Pi Pico ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="[01]*", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" +# AIR32F103 +ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1" + # # Debuggers From 5de541e49301a66119f58acf6b03748ae294be6c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 30 Nov 2022 21:17:06 +0200 Subject: [PATCH 23/49] Update SPDX Data List to 3.19 --- platformio/package/manifest/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/package/manifest/schema.py b/platformio/package/manifest/schema.py index 1e5f935a..937bbf91 100644 --- a/platformio/package/manifest/schema.py +++ b/platformio/package/manifest/schema.py @@ -276,7 +276,7 @@ class ManifestSchema(BaseSchema): @staticmethod @memoized(expire="1h") def load_spdx_licenses(): - version = "3.18" + version = "3.19" spdx_data_url = ( "https://raw.githubusercontent.com/spdx/license-list-data/" "v%s/json/licenses.json" % version From 48655ad728c25c6af67da913c36651e27fdd05ad Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Mon, 5 Dec 2022 11:58:01 +0200 Subject: [PATCH 24/49] Update Clang-Tidy to v15.0.5 // Resolve #4420 --- HISTORY.rst | 1 + platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index c65b827a..c36c40b4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,6 +19,7 @@ PlatformIO Core 6 * Added support for Python 3.11 * Made assets (templates, ``99-platformio-udev.rules``) part of Python's module (`issue #4458 `_) * Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license) +* Updated `Clang-Tidy `__ check tool to v15.0.5 with new diagnostics and bugfixes 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index fa19e21d..eb542a8d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -49,7 +49,7 @@ __core_packages__ = { "contrib-pysite": "~2.%d%d.0" % (sys.version_info.major, sys.version_info.minor), "tool-scons": "~4.40400.0", "tool-cppcheck": "~1.270.0", - "tool-clangtidy": "~1.120001.0", + "tool-clangtidy": "~1.150005.0", "tool-pvs-studio": "~7.18.0", } From 38f03224d3ecc4fb790260e70a2028ee88534293 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Dec 2022 16:07:48 +0200 Subject: [PATCH 25/49] Switch to ubuntu-20.04 (supports Python 3.6) --- .github/workflows/core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 6257376a..445e6e0e 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-20.04, windows-latest, macos-latest] python-version: ["3.6", "3.9", "3.11"] runs-on: ${{ matrix.os }} From 337e7fe43af5bbd62e3d019ca538d301d9d39e92 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 10 Dec 2022 11:22:52 +0200 Subject: [PATCH 26/49] Update deps --- docs | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 8a6c9704..1ed7daf2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8a6c9704335b6f0d371b52f7b2f4c48ddfea7ce6 +Subproject commit 1ed7daf2befb594e0d17201be9fbec87d2b105bf diff --git a/setup.py b/setup.py index 00b47251..fbed0e1d 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ minimal_requirements = [ home_requirements = [ "aiofiles==%s" % ("0.8.0" if PY36 else "22.1.*"), "ajsonrpc==1.*", - "starlette==%s" % ("0.19.1" if PY36 else "0.22.*"), + "starlette==%s" % ("0.19.1" if PY36 else "0.23.*"), "uvicorn==%s" % ("0.16.0" if PY36 else "0.20.*"), "wsproto==%s" % ("1.0.0" if PY36 else "1.2.*"), ] From 7bbfaab891348837d772763d34356e367e67b1c9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Dec 2022 19:36:15 +0200 Subject: [PATCH 27/49] Avoid tox 4.0 --- .github/workflows/core.yml | 2 +- tests/commands/pkg/test_install.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 445e6e0e..7b51b8be 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -25,7 +25,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox + pip install "tox<4" - name: Python Lint if: ${{ matrix.python-version != '3.6' }} diff --git a/tests/commands/pkg/test_install.py b/tests/commands/pkg/test_install.py index dcbd2d98..61ccde0d 100644 --- a/tests/commands/pkg/test_install.py +++ b/tests/commands/pkg/test_install.py @@ -443,7 +443,7 @@ def test_custom_project_libraries( ) assert pkgs_to_specs(lm.get_installed()) == [ PackageSpec("ArduinoJson@5.13.4"), - PackageSpec("Nanopb@0.4.6+4"), + PackageSpec("Nanopb@0.4.7"), ] assert config.get("env:devkit", "lib_deps") == [ "bblanchon/ArduinoJson@^5", From 4d4aec4f570262456ce7d9bc5bb88b10168e47dd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Dec 2022 19:36:41 +0200 Subject: [PATCH 28/49] Export test suite directory --- platformio/test/cli.py | 6 +++--- platformio/test/helpers.py | 14 +++++++++++++- platformio/test/reports/json.py | 1 + platformio/test/result.py | 3 ++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/platformio/test/cli.py b/platformio/test/cli.py index 1e456d4d..d0a6e53a 100644 --- a/platformio/test/cli.py +++ b/platformio/test/cli.py @@ -156,9 +156,6 @@ def cli( # pylint: disable=too-many-arguments,too-many-locals,redefined-builtin runner.start(ctx) print_suite_footer(test_suite) - # Reset custom project config - app.set_session_var("custom_project_conf", None) - stdout_report = TestReportFactory.new("stdout", test_result) stdout_report.generate(verbose=verbose or list_tests) @@ -171,6 +168,9 @@ def cli( # pylint: disable=too-many-arguments,too-many-locals,redefined-builtin custom_report = TestReportFactory.new(output_format, test_result) custom_report.generate(output_path=output_path, verbose=True) + # Reset custom project config + app.set_session_var("custom_project_conf", None) + if test_result.is_errored or test_result.get_status_nums(TestStatus.FAILED): raise exception.ReturnErrorCode(1) diff --git a/platformio/test/helpers.py b/platformio/test/helpers.py index 908173d0..01650a0b 100644 --- a/platformio/test/helpers.py +++ b/platformio/test/helpers.py @@ -35,6 +35,7 @@ def list_test_names(project_config): def list_test_suites(project_config, environments, filters, ignores): result = [] + test_dir = project_config.get("platformio", "test_dir") default_envs = project_config.default_envs() test_names = list_test_names(project_config) for env_name in project_config.envs(): @@ -58,5 +59,16 @@ def list_test_suites(project_config, environments, filters, ignores): test_name != "*" and any(fnmatch(test_name, p) for p in patterns["ignore"]), ] - result.append(TestSuite(env_name, test_name, finished=any(skip_conditions))) + result.append( + TestSuite( + env_name, + test_name, + finished=any(skip_conditions), + test_dir=os.path.abspath( + test_dir + if test_name == "*" + else os.path.join(test_dir, test_name) + ), + ) + ) return result diff --git a/platformio/test/reports/json.py b/platformio/test/reports/json.py index c22fb587..791224c7 100644 --- a/platformio/test/reports/json.py +++ b/platformio/test/reports/json.py @@ -59,6 +59,7 @@ class JsonTestReport(TestReportBase): result = dict( env_name=test_suite.env_name, test_name=test_suite.test_name, + test_dir=test_suite.test_dir, status=test_suite.status.name, duration=test_suite.duration, timestamp=datetime.datetime.fromtimestamp(test_suite.timestamp).strftime( diff --git a/platformio/test/result.py b/platformio/test/result.py index b2000b2e..091fa964 100644 --- a/platformio/test/result.py +++ b/platformio/test/result.py @@ -93,9 +93,10 @@ class TestCase: class TestSuite: - def __init__(self, env_name, test_name, finished=False): + def __init__(self, env_name, test_name, finished=False, test_dir=None): self.env_name = env_name self.test_name = test_name + self.test_dir = test_dir self.timestamp = 0 self.duration = 0 self._cases = [] From a0387bd16efbf7100dbeb05b9cfae23bd9ab016f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 14 Dec 2022 21:15:23 +0200 Subject: [PATCH 29/49] Update tox configuration --- .github/workflows/core.yml | 2 +- tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 7b51b8be..445e6e0e 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -25,7 +25,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install "tox<4" + pip install tox - name: Python Lint if: ${{ matrix.python-version != '3.6' }} diff --git a/tox.ini b/tox.ini index c5cc66d3..4e7b543a 100644 --- a/tox.ini +++ b/tox.ini @@ -44,12 +44,12 @@ commands = [testenv:testcore] commands = {envpython} --version - py.test -v --basetemp="{envtmpdir}" -k "not skip_ci" tests --ignore tests/test_examples.py + py.test -v --basetemp={envtmpdir} -k "not skip_ci" tests --ignore tests/test_examples.py [testenv:testexamples] commands = {envpython} scripts/install_devplatforms.py - py.test -v --basetemp="{envtmpdir}" tests/test_examples.py + py.test -v --basetemp={envtmpdir} tests/test_examples.py [testenv:docs] deps = From 6395a032e5dfb7ad444718ec0da08e0f9370f3c0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 15 Dec 2022 20:01:28 +0200 Subject: [PATCH 30/49] Ensure dependent packages for PIO Home are installed --- platformio/home/cli.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platformio/home/cli.py b/platformio/home/cli.py index 2d0ba1ce..55d09594 100644 --- a/platformio/home/cli.py +++ b/platformio/home/cli.py @@ -18,6 +18,7 @@ import click from platformio.home.helpers import is_port_used from platformio.home.run import run_server +from platformio.package.manager.core import get_core_package_dir @click.command("home", short_help="GUI to manage PlatformIO") @@ -48,15 +49,17 @@ from platformio.home.run import run_server ), ) def cli(port, host, no_open, shutdown_timeout, session_id): + # hook for `platformio-node-helpers` + if host == "__do_not_start__": + # download all dependent packages + get_core_package_dir("contrib-piohome") + return + # Ensure PIO Home mimetypes are known mimetypes.add_type("text/html", ".html") mimetypes.add_type("text/css", ".css") mimetypes.add_type("application/javascript", ".js") - # hook for `platformio-node-helpers` - if host == "__do_not_start__": - return - home_url = "http://%s:%d%s" % ( host, port, From 9c38cf6621173798643af5d5837caf8ca18db256 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 19 Dec 2022 16:34:54 +0200 Subject: [PATCH 31/49] Make "get_config_options_schema" public --- platformio/public.py | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio/public.py b/platformio/public.py index 0c22b3b9..49db1b54 100644 --- a/platformio/public.py +++ b/platformio/public.py @@ -20,6 +20,7 @@ from platformio.fs import to_unix_path from platformio.platform.base import PlatformBase from platformio.project.config import ProjectConfig from platformio.project.helpers import get_project_watch_lib_dirs, load_build_metadata +from platformio.project.options import get_config_options_schema from platformio.test.result import TestCase, TestCaseSource, TestStatus from platformio.test.runners.base import TestRunnerBase from platformio.test.runners.doctest import DoctestTestCaseParser From 4121882a9df97fbc545498fd76ac34be8f3f5612 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 21 Dec 2022 09:34:36 +0200 Subject: [PATCH 32/49] Split project configuration docs into the multiple pages --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 1ed7daf2..7a81d2e4 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 1ed7daf2befb594e0d17201be9fbec87d2b105bf +Subproject commit 7a81d2e419ac09e8469463d6bbef6201f2a2d961 From d0ca48661c9b28d4e1538e80554d4d202c789f1c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 29 Dec 2022 13:47:25 +0200 Subject: [PATCH 33/49] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 7a81d2e4..9a201e94 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 7a81d2e419ac09e8469463d6bbef6201f2a2d961 +Subproject commit 9a201e94ae981e26203020e5767b44783701e2ec From 75716d26fff730466e845980b76571a2da5f8df4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 4 Jan 2023 18:40:04 +0200 Subject: [PATCH 34/49] Sync docs --- docs | 2 +- scripts/docspregen.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs b/docs index 9a201e94..3b33aded 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9a201e94ae981e26203020e5767b44783701e2ec +Subproject commit 3b33aded66470a9784744ec9448c2261b5bb540f diff --git a/scripts/docspregen.py b/scripts/docspregen.py index a9a96c7b..f895c25d 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -476,13 +476,11 @@ Stable ; Latest stable version [env:latest_stable] platform = {name} - board = ... - + {board} ; Custom stable version [env:custom_stable] platform = {name}@x.y.z - board = ... - + {board} Upstream ~~~~~~~~ @@ -490,9 +488,11 @@ Upstream [env:upstream_develop] platform = {github_url}.git - board = ... -""".format( - name=p.name, title=p.title, github_url=github_url + {board}""".format( + name=p.name, + title=p.title, + github_url=github_url, + board="board = ...\n" if p.is_embedded() else "", ) ) From 8970f36f1af93c1e23b885ec67a406d729924660 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 5 Jan 2023 16:14:43 +0200 Subject: [PATCH 35/49] Docs: Remove simulators from "onboard debug" list // Resolve #150 --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 3b33aded..849a5401 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3b33aded66470a9784744ec9448c2261b5bb540f +Subproject commit 849a5401dec4b76a9491b1be5a44bab0d8cf2f7d From d43c5696cc19d6460a9fdc96bdc5c559ed081bbe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 5 Jan 2023 18:31:51 +0200 Subject: [PATCH 36/49] Lock "sphinx-rtd-theme" to the 1.1.1 --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 4e7b543a..0a51741a 100644 --- a/tox.ini +++ b/tox.ini @@ -54,9 +54,9 @@ commands = [testenv:docs] deps = sphinx - sphinx_rtd_theme + sphinx-rtd-theme==1.1.1 sphinx-notfound-page - sphinx_copybutton + sphinx-copybutton restructuredtext-lint commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html @@ -64,6 +64,6 @@ commands = [testenv:docslinkcheck] deps = sphinx - sphinx_rtd_theme + sphinx-rtd-theme commands = sphinx-build -W -b linkcheck docs docs/_build/html From 20067c5736d45911670df10d32d853566949fbff Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 13 Jan 2023 19:09:19 +0200 Subject: [PATCH 37/49] Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) --- HISTORY.rst | 2 +- platformio/device/list/util.py | 10 +++++++++- setup.py | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c36c40b4..16b8a6a1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,8 +18,8 @@ PlatformIO Core 6 * Added support for Python 3.11 * Made assets (templates, ``99-platformio-udev.rules``) part of Python's module (`issue #4458 `_) -* Import the "zeroconf" module only when a user lists mDNS devices (issue with zeroconf's LGPL license) * Updated `Clang-Tidy `__ check tool to v15.0.5 with new diagnostics and bugfixes +* Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/device/list/util.py b/platformio/device/list/util.py index 94443f4f..3589ee26 100644 --- a/platformio/device/list/util.py +++ b/platformio/device/list/util.py @@ -82,7 +82,15 @@ def list_logical_devices(): def list_mdns_services(): - import zeroconf # pylint: disable=import-outside-toplevel + try: + import zeroconf # pylint: disable=import-outside-toplevel + except ImportError: + result = proc.exec_command( + [proc.get_pythonexe_path(), "-m", "pip", "install", "zeroconf"] + ) + if result.get("returncode") != 0: + print(result.get("err")) + import zeroconf # pylint: disable=import-outside-toplevel class mDNSListener: def __init__(self): diff --git a/setup.py b/setup.py index fbed0e1d..2e1fa86c 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,6 @@ minimal_requirements = [ "requests==%s" % ("2.27.1" if PY36 else "2.*"), "semantic_version==2.10.*", "tabulate==%s" % ("0.8.10" if PY36 else "0.9.*"), - "zeroconf<1", ] home_requirements = [ From 5ee79f17248e679235e4eb548573989fd1f52fd1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 13 Jan 2023 19:55:53 +0200 Subject: [PATCH 38/49] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 849a5401..4d1b7441 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 849a5401dec4b76a9491b1be5a44bab0d8cf2f7d +Subproject commit 4d1b7441c60ba4f9f504dfc95cc9138ef16be184 From 17360b0ed2fc213200571d275b23b6d34bba0c10 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 13 Jan 2023 19:56:08 +0200 Subject: [PATCH 39/49] Show the real error message instead of "Can not remove temporary directory" when "platform.ini" is broken // Resolve #4480 --- HISTORY.rst | 1 + platformio/project/config.py | 8 +++++++- platformio/run/cli.py | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 16b8a6a1..23e756ea 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,6 +20,7 @@ PlatformIO Core 6 * Made assets (templates, ``99-platformio-udev.rules``) part of Python's module (`issue #4458 `_) * Updated `Clang-Tidy `__ check tool to v15.0.5 with new diagnostics and bugfixes * Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) +* Show the real error message instead of "Can not remove temporary directory" when "platform.ini" is broken (`issue #4480 `_) 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/project/config.py b/platformio/project/config.py index 3443863a..265fa95d 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -319,7 +319,13 @@ class ProjectConfigBase: if section == "this": section = parent_section if option == "__env__": - assert parent_section.startswith("env:") + if not parent_section.startswith("env:"): + raise exception.ProjectOptionValueError( + f"`${{this.__env__}}` is called from the `{parent_section}` " + "section that is not valid PlatformIO environment, see", + option, + section, + ) return parent_section[4:] # handle nested calls try: diff --git a/platformio/run/cli.py b/platformio/run/cli.py index adf0153f..6c647431 100644 --- a/platformio/run/cli.py +++ b/platformio/run/cli.py @@ -24,6 +24,7 @@ from tabulate import tabulate from platformio import app, exception, fs, util from platformio.device.monitor.command import device_monitor_cmd from platformio.project.config import ProjectConfig +from platformio.project.exception import ProjectError from platformio.project.helpers import find_project_dir_above, load_build_metadata from platformio.run.helpers import clean_build_dir, handle_legacy_libdeps from platformio.run.processor import EnvironmentProcessor @@ -115,6 +116,8 @@ def cli( build_dir = config.get("platformio", "build_dir") try: clean_build_dir(build_dir, config) + except ProjectError as exc: + raise exc except: # pylint: disable=bare-except click.secho( "Can not remove temporary directory `%s`. Please remove " From 2337dbd2cd36f7452f03539db44eb61fee40bd9c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 13 Jan 2023 20:50:29 +0200 Subject: [PATCH 40/49] Fix incorrect type of "examples" // Resolve #4502 --- docs | 2 +- platformio/assets/schema/library.json | 961 +++++++++++++------------- 2 files changed, 483 insertions(+), 480 deletions(-) diff --git a/docs b/docs index 4d1b7441..5a88ddff 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 4d1b7441c60ba4f9f504dfc95cc9138ef16be184 +Subproject commit 5a88ddffa3c7758b82361381bb3bcdc4aca9d6ab diff --git a/platformio/assets/schema/library.json b/platformio/assets/schema/library.json index 30c67372..370cf67f 100644 --- a/platformio/assets/schema/library.json +++ b/platformio/assets/schema/library.json @@ -1,484 +1,487 @@ { - "$id": "https://example.com/library.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "library.json schema", - "type": "object", - "properties": { - "name": { + "$id": "https://example.com/library.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "library.json schema", + "type": "object", + "properties": { + "name": { + "type": "string", + "maxLength": 50, + "description": "A name of a library.\nMust be unique in the PlatformIO Registry\nShould be slug style for simplicity, consistency, and compatibility. Example: HelloWorld\nCan contain a-z, digits, and dashes (but not start/end with them)\nConsecutive dashes and [:;/,@<>] chars are not allowed.", + "required": true + }, + "version": { + "type": "string", + "maxLength": 20, + "description": "A version of a current library source code. Can contain a-z, digits, dots or dash and should be Semantic Versioning compatible.", + "required": true + }, + "description": { + "type": "string", + "maxLength": 255, + "description": "The field helps users to identify and search for your library with a brief description. Describe the hardware devices (sensors, boards and etc.) which are suitable with it.", + "required": true + }, + "keywords": { + "anyOf": [ + { + "type": "string", + "maxLength": 255 + }, + { + "type": "array", + "items": { "type": "string", - "maxLength": 50, - "description": "A name of a library.\nMust be unique in the PlatformIO Registry\nShould be slug style for simplicity, consistency, and compatibility. Example: HelloWorld\nCan contain a-z, digits, and dashes (but not start/end with them)\nConsecutive dashes and [:;/,@<>] chars are not allowed.", - "required": true - }, - "version": { - "type": "string", - "maxLength": 20, - "description": "A version of a current library source code. Can contain a-z, digits, dots or dash and should be Semantic Versioning compatible.", - "required": true - }, - "description": { - "type": "string", - "maxLength": 255, - "description": "The field helps users to identify and search for your library with a brief description. Describe the hardware devices (sensors, boards and etc.) which are suitable with it.", - "required": true - }, - "keywords": { - "anyOf": [ - { - "type": "string", - "maxLength": 255 - }, - { - "type": "array", - "items": { - "type": "string", - "maxLength": 255 - } - } - ], - "description": "Used for search by keyword. Helps to make your library easier to discover without people needing to know its name.\nThe keyword should be lowercased, can contain a-z, digits and dash (but not start/end with them). A list from the keywords can be specified with separator , or declared as Array.", - "required": true - }, - "homepage": { - "type": "string", - "maxLength": 255, - "description": "Home page of a library (if is different from repository url).", - "required": false - }, - "repository": { - "type": "object", - "properties": { - "type": { - "enum": [ - "git", - "hg", - "svn" - ], - "description": "only “git”, “hg” or “svn” are supported" - }, - "url": { - "type": "string" - }, - "branch": { - "type": "string", - "description": "if is not specified, default branch will be used. This field will be ignored if tag/release exists with the value of version." - } - }, - "description": "The repository in which the source code can be found.", - "required": false - }, - "authors": { - "anyOf": [ - { - "type": "object", - "properties": { - "name": { - "type": "string", - "required": true, - "description": "Full name" - }, - "email": { - "type": "string" - }, - "url": { - "type": "string", - "description": "An author’s contact page" - }, - "maintainer": { - "type": "boolean", - "description": "Specify “maintainer” status" - } - } - }, - { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "required": true, - "description": "Full name" - }, - "email": { - "type": "string" - }, - "url": { - "type": "string", - "description": "An author’s contact page" - }, - "maintainer": { - "type": "boolean", - "description": "Specify “maintainer” status" - } - } - } - } - ], - "description": "An author contact information\nIf authors field is not defined, PlatformIO will try to fetch data from VCS provider (Github, Gitlab, etc) if repository is declared.", - "required": false - }, - "license": { - "type": "string", - "description": "A SPDX license ID or SPDX Expression. You can check the full list of SPDX license IDs (see “Identifier” column).", - "required": false - }, - "frameworks": { - "anyOf": [ - { - "type": "string", - "description": "espidf, freertos, *, etc'" - }, - { - "type": "array", - "items": { - "type": "string", - "description": "espidf, freertos, *, etc'" - } - } - ], - "description": "A list with compatible frameworks. The available framework names are defined in the Frameworks section.\nIf the library is compatible with the all frameworks, then do not declare this field or you use *", - "required": false - }, - "platforms": { - "anyOf": [ - { - "type": "string", - "description": "atmelavr, espressif8266, *, etc'" - }, - { - "type": "array", - "items": { - "type": "string", - "description": "atmelavr, espressif8266, *, etc'" - } - } - ], - "description": "A list with compatible development platforms. The available platform name are defined in Development Platforms section.\nIf the library is compatible with the all platforms, then do not declare this field or use *.\nPlatformIO does not check platforms for compatibility in default mode. See Compatibility Mode for details. If you need a strict checking for compatible platforms for a library, please set libCompatMode to strict.", - "required": false - }, - "headers": { - "anyOf": [ - { - "type": "string", - "description": "MyLibrary.h" - }, - { - "type": "array", - "items": { - "type": "string", - "description": "FooCore.h, FooFeature.h" - } - } - ], - "description": "A list of header files that can be included in a project source files using #include <...> directive.", - "required": false - }, - "examples": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "base": { - "type": "string" - }, - "files": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "description": "A list of example patterns.", - "required": "false" - }, - "dependencies": { - "anyOf": [ - { - "type": "object", - "properties": { - "owner": { - "type": "string", - "description": "an owner name (username) from the PlatformIO Registry" - }, - "name": { - "type": "string", - "description": "library name" - }, - "version": { - "type": "string", - "description": "Version Requirements or Package Specifications" - }, - "frameworks": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "project compatible Frameworks" - }, - "platforms": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": " project compatible Development Platforms" - } - } - }, - { - "type": "array", - "items": { - "type": "object", - "properties": { - "owner": { - "type": "string", - "description": "an owner name (username) from the PlatformIO Registry" - }, - "name": { - "type": "string", - "description": "library name" - }, - "version": { - "type": "string", - "description": "Version Requirements or Package Specifications" - }, - "frameworks": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "project compatible Frameworks" - }, - "platforms": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": " project compatible Development Platforms" - } - } - } - } - ], - "description": "A list of dependent libraries that will be automatically installed.", - "required": false - }, - "export": { - "type": "object", - "properties": { - "include": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Export only files that matched declared patterns.\n* - matches everything\n? - matches any single character\n[seq] - matches any character in seq\n[!seq] - matches any character not in seq" - }, - "exclude": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Exclude the directories and files which match with exclude patterns." - } - }, - "description": "This option is useful if you need to exclude extra data (test code, docs, images, PDFs, etc). It allows one to reduce the size of the final archive.\nTo check which files will be included in the final packages, please use pio pkg pack command.", - "required": false - }, - "scripts": { - "type": "object", - "properties": { - "postinstall": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "runs a script AFTER the package has been installed.\nRun a custom Python script located in the package “scripts” folder AFTER the package is installed. Please note that you don’t need to specify a Python interpreter for Python scripts" - }, - "preuninstall": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "runs a script BEFORE the package is removed.\nRun a custom Bash script BEFORE the package is uninstalled. The script is declared as a list of command arguments and is located at the root of a package" - } - }, - "description": "Execute custom scripts during the special Package Management CLI life cycle events", - "required": false - }, - "build": { - "type": "object", - "properties": { - "flags": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "Extra flags to control preprocessing, compilation, assembly, and linking processes. More details build_flags.\nKeep in mind when operating with the -I flag (directories to be searched for header files). The path should be relative to the root directory where the library.json manifest is located." - }, - "unflags": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "Remove base/initial flags which were set by development platform. More details build_unflags." - }, - "includeDir": { - "type": "string", - "description": "Custom directory to be searched for header files. A default value is include and means that folder is located at the root of a library.\nThe Library Dependency Finder (LDF) will pick a library automatically only when a project or other dependent libraries include any header file located in includeDir or srcDir.", - "required": false - }, - "srcDir": { - "type": "string", - "description": "Custom location of library source code. A default value is src and means that folder is located in the root of a library.", - "required": "false" - }, - "srcFilter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "Specify which source files should be included/excluded from build process. The path in filter should be relative to the srcDir option of a library.\nSee syntax for build_src_filter.\nPlease note that you can generate source filter “on-the-fly” using extraScript", - "required": false - }, - "extraScript": { - "type": "string", - "description": "Launch extra script before a build process.", - "required": "false" - }, - "libArchive": { - "type": "boolean", - "description": "Create an archive (*.a, static library) from the object files and link it into a firmware (program). This is default behavior of PlatformIO Build System (\"libArchive\": true).\nSetting \"libArchive\": false will instruct PlatformIO Build System to link object files directly (in-line). This could be useful if you need to override weak symbols defined in framework or other libraries.\nYou can disable library archiving globally using lib_archive option in “platformio.ini” (Project Configuration File).", - "required": "false" - }, - "libLDFMode": { - "anyOf": [ - { - "enum": [ - "off" - ], - "description": "“Manual mode”, does not process source files of a project and dependencies. Builds only the libraries that are specified in manifests (library.json, module.json) or using lib_deps option." - }, - { - "enum": [ - "chain" - ], - "description": "[DEFAULT] Parses ALL C/C++ source files of the project and follows only by nested includes (#include ..., chain...) from the libraries. It also parses C, CC, CPP files from libraries which have the same name as included header file. Does not evaluate C/C++ Preprocessor conditional syntax." - }, - { - "enum": [ - "deep" - ], - "description": "Parses ALL C/C++ source files of the project and parses ALL C/C++ source files of the each found dependency (recursively). Does not evaluate C/C++ Preprocessor conditional syntax." - }, - { - "enum": [ - "chain+" - ], - "description": "The same behavior as for the chain but evaluates C/C++ Preprocessor conditional syntax." - }, - { - "enum": [ - "deep+" - ], - "description": "The same behavior as for the deep but evaluates C/C++ Preprocessor conditional syntax." - } - ], - "description": "Specify Library Dependency Finder Mode. See Dependency Finder Mode for details.", - "required": false - }, - "libCompatMode": { - "type": "string", - "description": "Specify Library Compatibility Mode. See Compatibility Mode for details.", - "required": false - }, - "builder": { - "anyOf": [ - { - "enum": [ - "PlatformIOLibBuilder" - ], - "description": "Default Builder" - }, - { - "enum": [ - "ArduinoLibBuilder" - ] - }, - { - "enum": [ - "MbedLibBuilder" - ] - } - ], - "description": "Override default PlatformIOLibBuilder with another builder.", - "required": false - } - }, - "required": false + "maxLength": 255 + } } + ], + "description": "Used for search by keyword. Helps to make your library easier to discover without people needing to know its name.\nThe keyword should be lowercased, can contain a-z, digits and dash (but not start/end with them). A list from the keywords can be specified with separator , or declared as Array.", + "required": true + }, + "homepage": { + "type": "string", + "maxLength": 255, + "description": "Home page of a library (if is different from repository url).", + "required": false + }, + "repository": { + "type": "object", + "properties": { + "type": { + "enum": [ + "git", + "hg", + "svn" + ], + "description": "only “git”, “hg” or “svn” are supported" + }, + "url": { + "type": "string" + }, + "branch": { + "type": "string", + "description": "if is not specified, default branch will be used. This field will be ignored if tag/release exists with the value of version." + } + }, + "description": "The repository in which the source code can be found.", + "required": false + }, + "authors": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "required": true, + "description": "Full name" + }, + "email": { + "type": "string" + }, + "url": { + "type": "string", + "description": "An author’s contact page" + }, + "maintainer": { + "type": "boolean", + "description": "Specify “maintainer” status" + } + } + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "required": true, + "description": "Full name" + }, + "email": { + "type": "string" + }, + "url": { + "type": "string", + "description": "An author’s contact page" + }, + "maintainer": { + "type": "boolean", + "description": "Specify “maintainer” status" + } + } + } + } + ], + "description": "An author contact information\nIf authors field is not defined, PlatformIO will try to fetch data from VCS provider (Github, Gitlab, etc) if repository is declared.", + "required": false + }, + "license": { + "type": "string", + "description": "A SPDX license ID or SPDX Expression. You can check the full list of SPDX license IDs (see “Identifier” column).", + "required": false + }, + "frameworks": { + "anyOf": [ + { + "type": "string", + "description": "espidf, freertos, *, etc'" + }, + { + "type": "array", + "items": { + "type": "string", + "description": "espidf, freertos, *, etc'" + } + } + ], + "description": "A list with compatible frameworks. The available framework names are defined in the Frameworks section.\nIf the library is compatible with the all frameworks, then do not declare this field or you use *", + "required": false + }, + "platforms": { + "anyOf": [ + { + "type": "string", + "description": "atmelavr, espressif8266, *, etc'" + }, + { + "type": "array", + "items": { + "type": "string", + "description": "atmelavr, espressif8266, *, etc'" + } + } + ], + "description": "A list with compatible development platforms. The available platform name are defined in Development Platforms section.\nIf the library is compatible with the all platforms, then do not declare this field or use *.\nPlatformIO does not check platforms for compatibility in default mode. See Compatibility Mode for details. If you need a strict checking for compatible platforms for a library, please set libCompatMode to strict.", + "required": false + }, + "headers": { + "anyOf": [ + { + "type": "string", + "description": "MyLibrary.h" + }, + { + "type": "array", + "items": { + "type": "string", + "description": "FooCore.h, FooFeature.h" + } + } + ], + "description": "A list of header files that can be included in a project source files using #include <...> directive.", + "required": false + }, + "examples": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "base": { + "type": "string" + }, + "files": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "description": "A list of example patterns.", + "required": "false" + }, + "dependencies": { + "anyOf": [ + { + "type": "object", + "properties": { + "owner": { + "type": "string", + "description": "an owner name (username) from the PlatformIO Registry" + }, + "name": { + "type": "string", + "description": "library name" + }, + "version": { + "type": "string", + "description": "Version Requirements or Package Specifications" + }, + "frameworks": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "project compatible Frameworks" + }, + "platforms": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": " project compatible Development Platforms" + } + } + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "owner": { + "type": "string", + "description": "an owner name (username) from the PlatformIO Registry" + }, + "name": { + "type": "string", + "description": "library name" + }, + "version": { + "type": "string", + "description": "Version Requirements or Package Specifications" + }, + "frameworks": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "project compatible Frameworks" + }, + "platforms": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": " project compatible Development Platforms" + } + } + } + } + ], + "description": "A list of dependent libraries that will be automatically installed.", + "required": false + }, + "export": { + "type": "object", + "properties": { + "include": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Export only files that matched declared patterns.\n* - matches everything\n? - matches any single character\n[seq] - matches any character in seq\n[!seq] - matches any character not in seq" + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Exclude the directories and files which match with exclude patterns." + } + }, + "description": "This option is useful if you need to exclude extra data (test code, docs, images, PDFs, etc). It allows one to reduce the size of the final archive.\nTo check which files will be included in the final packages, please use pio pkg pack command.", + "required": false + }, + "scripts": { + "type": "object", + "properties": { + "postinstall": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "runs a script AFTER the package has been installed.\nRun a custom Python script located in the package “scripts” folder AFTER the package is installed. Please note that you don’t need to specify a Python interpreter for Python scripts" + }, + "preuninstall": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "runs a script BEFORE the package is removed.\nRun a custom Bash script BEFORE the package is uninstalled. The script is declared as a list of command arguments and is located at the root of a package" + } + }, + "description": "Execute custom scripts during the special Package Management CLI life cycle events", + "required": false + }, + "build": { + "type": "object", + "properties": { + "flags": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Extra flags to control preprocessing, compilation, assembly, and linking processes. More details build_flags.\nKeep in mind when operating with the -I flag (directories to be searched for header files). The path should be relative to the root directory where the library.json manifest is located." + }, + "unflags": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Remove base/initial flags which were set by development platform. More details build_unflags." + }, + "includeDir": { + "type": "string", + "description": "Custom directory to be searched for header files. A default value is include and means that folder is located at the root of a library.\nThe Library Dependency Finder (LDF) will pick a library automatically only when a project or other dependent libraries include any header file located in includeDir or srcDir.", + "required": false + }, + "srcDir": { + "type": "string", + "description": "Custom location of library source code. A default value is src and means that folder is located in the root of a library.", + "required": "false" + }, + "srcFilter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Specify which source files should be included/excluded from build process. The path in filter should be relative to the srcDir option of a library.\nSee syntax for build_src_filter.\nPlease note that you can generate source filter “on-the-fly” using extraScript", + "required": false + }, + "extraScript": { + "type": "string", + "description": "Launch extra script before a build process.", + "required": "false" + }, + "libArchive": { + "type": "boolean", + "description": "Create an archive (*.a, static library) from the object files and link it into a firmware (program). This is default behavior of PlatformIO Build System (\"libArchive\": true).\nSetting \"libArchive\": false will instruct PlatformIO Build System to link object files directly (in-line). This could be useful if you need to override weak symbols defined in framework or other libraries.\nYou can disable library archiving globally using lib_archive option in “platformio.ini” (Project Configuration File).", + "required": "false" + }, + "libLDFMode": { + "anyOf": [ + { + "enum": [ + "off" + ], + "description": "“Manual mode”, does not process source files of a project and dependencies. Builds only the libraries that are specified in manifests (library.json, module.json) or using lib_deps option." + }, + { + "enum": [ + "chain" + ], + "description": "[DEFAULT] Parses ALL C/C++ source files of the project and follows only by nested includes (#include ..., chain...) from the libraries. It also parses C, CC, CPP files from libraries which have the same name as included header file. Does not evaluate C/C++ Preprocessor conditional syntax." + }, + { + "enum": [ + "deep" + ], + "description": "Parses ALL C/C++ source files of the project and parses ALL C/C++ source files of the each found dependency (recursively). Does not evaluate C/C++ Preprocessor conditional syntax." + }, + { + "enum": [ + "chain+" + ], + "description": "The same behavior as for the chain but evaluates C/C++ Preprocessor conditional syntax." + }, + { + "enum": [ + "deep+" + ], + "description": "The same behavior as for the deep but evaluates C/C++ Preprocessor conditional syntax." + } + ], + "description": "Specify Library Dependency Finder Mode. See Dependency Finder Mode for details.", + "required": false + }, + "libCompatMode": { + "type": "string", + "description": "Specify Library Compatibility Mode. See Compatibility Mode for details.", + "required": false + }, + "builder": { + "anyOf": [ + { + "enum": [ + "PlatformIOLibBuilder" + ], + "description": "Default Builder" + }, + { + "enum": [ + "ArduinoLibBuilder" + ] + }, + { + "enum": [ + "MbedLibBuilder" + ] + } + ], + "description": "Override default PlatformIOLibBuilder with another builder.", + "required": false + } + }, + "required": false } + } } \ No newline at end of file From 42f1197de8913008705832054078be642e8a34cd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 14 Jan 2023 17:17:26 +0200 Subject: [PATCH 41/49] Added a new "name" configuration option to customize a project name // Resolve #4498 --- HISTORY.rst | 3 ++- docs | 2 +- platformio/project/integration/generator.py | 4 +++- platformio/project/options.py | 5 +++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 23e756ea..48725df2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,10 +17,11 @@ PlatformIO Core 6 ~~~~~~~~~~~~~~~~~~ * Added support for Python 3.11 +* Added a new `name `__ configuration option to customize a project name (`pull #4498 `_) * Made assets (templates, ``99-platformio-udev.rules``) part of Python's module (`issue #4458 `_) * Updated `Clang-Tidy `__ check tool to v15.0.5 with new diagnostics and bugfixes * Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) -* Show the real error message instead of "Can not remove temporary directory" when "platform.ini" is broken (`issue #4480 `_) +* Show the real error message instead of "Can not remove temporary directory" when |PIOCONF| is broken (`issue #4480 `_) 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/docs b/docs index 5a88ddff..5b7d5d49 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5a88ddffa3c7758b82361381bb3bcdc4aca9d6ab +Subproject commit 5b7d5d49985a4458394b2ffd91aba5780cc21fe8 diff --git a/platformio/project/integration/generator.py b/platformio/project/integration/generator.py index 4a4eb480..4ea3bbf3 100644 --- a/platformio/project/integration/generator.py +++ b/platformio/project/integration/generator.py @@ -82,7 +82,9 @@ class ProjectGenerator: tpl_vars = { "config": self.config, "systype": util.get_systype(), - "project_name": os.path.basename(self.project_dir), + "project_name": self.config.get( + "platformio", "name", os.path.basename(self.project_dir) + ), "project_dir": self.project_dir, "original_env_name": self.original_env_name, "env_name": self.env_name, diff --git a/platformio/project/options.py b/platformio/project/options.py index e1aa8280..5e200629 100644 --- a/platformio/project/options.py +++ b/platformio/project/options.py @@ -133,6 +133,11 @@ ProjectOptions = OrderedDict( # # [platformio] # + ConfigPlatformioOption( + group="generic", + name="name", + description="A project name", + ), ConfigPlatformioOption( group="generic", name="description", From de4ba4cbe1584fc865bc5aae9fe8a91c1a777684 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 14 Jan 2023 17:38:26 +0200 Subject: [PATCH 42/49] Fixed an issue with an incorrect test summary when a testcase name includes a colon // Resolve #4508 --- HISTORY.rst | 1 + platformio/test/runners/unity.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 48725df2..3e5be32d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,7 @@ PlatformIO Core 6 * Updated `Clang-Tidy `__ check tool to v15.0.5 with new diagnostics and bugfixes * Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) * Show the real error message instead of "Can not remove temporary directory" when |PIOCONF| is broken (`issue #4480 `_) +* Fixed an issue with an incorrect test summary when a testcase name includes a colon (`issue #4508 `_) 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/test/runners/unity.py b/platformio/test/runners/unity.py index a8970cf5..b7d8026b 100644 --- a/platformio/test/runners/unity.py +++ b/platformio/test/runners/unity.py @@ -29,10 +29,11 @@ class UnityTestRunner(TestRunnerBase): EXTRA_LIB_DEPS = ["throwtheswitch/Unity@^2.5.2"] - # Example: + # Examples: # test/test_foo.cpp:44:test_function_foo:FAIL: Expected 32 Was 33 + # test/group/test_foo/test_main.cpp:5:test::dummy:FAIL: Expression Evaluated To FALSE TESTCASE_PARSE_RE = re.compile( - r"(?P[^:]+):(?P\d+):(?P[^:]+):" + r"(?P[^:]+):(?P\d+):(?P[^\s]+):" r"(?PPASS|IGNORE|FAIL)(:\s*(?P.+)$)?" ) From fb5e99473fff62fbf2b3b06e98fcf9fa901fbd31 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 14 Jan 2023 19:40:53 +0200 Subject: [PATCH 43/49] Fixed an issue when extends does not override options in the right order // Resolve #4462 --- HISTORY.rst | 1 + platformio/project/config.py | 4 +++- tests/project/test_config.py | 27 ++++++++++++++++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3e5be32d..c9e03460 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -23,6 +23,7 @@ PlatformIO Core 6 * Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) * Show the real error message instead of "Can not remove temporary directory" when |PIOCONF| is broken (`issue #4480 `_) * Fixed an issue with an incorrect test summary when a testcase name includes a colon (`issue #4508 `_) +* Fixed an issue when `extends `__ does not override options in the right order (`issue #4462 `_) 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/project/config.py b/platformio/project/config.py index 265fa95d..c4e08137 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -168,7 +168,7 @@ class ProjectConfigBase: yield (section, option) if self._parser.has_option(section, "extends"): extends_queue.extend( - self.parse_multi_values(self._parser.get(section, "extends"))[::-1] + self.parse_multi_values(self._parser.get(section, "extends")) ) def options(self, section=None, env=None): @@ -249,7 +249,9 @@ class ProjectConfigBase: return None def _traverse_for_value(self, section, option, option_meta=None): + # print("_traverse_for_value", section, option) for _section, _option in self.walk_options(section): + # print(13, _section, _option) if _option == option or ( option_meta and ( diff --git a/tests/project/test_config.py b/tests/project/test_config.py index 964c0e67..6076a7d6 100644 --- a/tests/project/test_config.py +++ b/tests/project/test_config.py @@ -205,9 +205,9 @@ def test_options(config): assert config.options(env="test_extends") == [ "extends", "build_flags", + "monitor_speed", "lib_ldf_mode", "lib_compat_mode", - "monitor_speed", "custom_monitor_speed", "lib_deps", "lib_ignore", @@ -245,9 +245,9 @@ def test_sysenv_options(config): assert config.options(env="test_extends") == [ "extends", "build_flags", + "monitor_speed", "lib_ldf_mode", "lib_compat_mode", - "monitor_speed", "custom_monitor_speed", "lib_deps", "lib_ignore", @@ -427,9 +427,9 @@ def test_items(config): assert config.items(env="test_extends") == [ ("extends", ["strict_settings"]), ("build_flags", ["-D RELEASE"]), + ("monitor_speed", 115200), ("lib_ldf_mode", "chain+"), ("lib_compat_mode", "strict"), - ("monitor_speed", 115200), ("custom_monitor_speed", "115200"), ("lib_deps", ["Lib1", "Lib2"]), ("lib_ignore", ["LibIgnoreCustom"]), @@ -647,3 +647,24 @@ test_testing_command = config = ProjectConfig(str(project_conf)) testing_command = config.get("env:myenv", "test_testing_command") assert "$" not in " ".join(testing_command) + + +def test_extends_order(tmp_path: Path): + project_conf = tmp_path / "platformio.ini" + project_conf.write_text( + """ +[a] +board = test + +[b] +upload_tool = two + +[c] +upload_tool = three + +[env:native] +extends = a, b, c + """ + ) + config = ProjectConfig(str(project_conf)) + assert config.get("env:native", "upload_tool") == "three" From 2fbd766fd962c6a712a758c2e82248050b6b0fbe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 14 Jan 2023 19:43:31 +0200 Subject: [PATCH 44/49] Remove debug code --- platformio/project/config.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/platformio/project/config.py b/platformio/project/config.py index c4e08137..ee380bb9 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -249,9 +249,7 @@ class ProjectConfigBase: return None def _traverse_for_value(self, section, option, option_meta=None): - # print("_traverse_for_value", section, option) for _section, _option in self.walk_options(section): - # print(13, _section, _option) if _option == option or ( option_meta and ( From 355222b0c0c8cab18060910d273c54a053910a7e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 14 Jan 2023 20:20:15 +0200 Subject: [PATCH 45/49] Fixed an issue when "pio pkg list" and "pio pkg uninstall" commands fail if there are circular dependencies in the library.json manifests // Resolve #4475 --- HISTORY.rst | 6 ++++-- platformio/package/commands/list.py | 10 +++++++++- platformio/package/manager/_uninstall.py | 6 ++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c9e03460..5c84e5fa 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,7 @@ Release Notes ============= .. |PIOCONF| replace:: `"platformio.ini" `__ configuration file +.. |LIBRARYJSON| replace:: `library.json `__ .. |LDF| replace:: `LDF `__ .. |INTERPOLATION| replace:: `Interpolation of Values `__ .. |UNITTESTING| replace:: `Unit Testing `__ @@ -23,7 +24,8 @@ PlatformIO Core 6 * Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) * Show the real error message instead of "Can not remove temporary directory" when |PIOCONF| is broken (`issue #4480 `_) * Fixed an issue with an incorrect test summary when a testcase name includes a colon (`issue #4508 `_) -* Fixed an issue when `extends `__ does not override options in the right order (`issue #4462 `_) +* Fixed an issue when `extends `__ did not override options in the right order (`issue #4462 `_) +* Fixed an issue when `pio pkg list `__ and `pio pkg uninstall `__ commands fail if there are circular dependencies in the |LIBRARYJSON| manifests (`issue #4475 `_) 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ @@ -58,7 +60,7 @@ PlatformIO Core 6 * Export a ``PIO_UNIT_TESTING`` macro to the project source files and dependent libraries in the |UNITTESTING| mode * Improved detection of Windows architecture (`issue #4353 `_) * Warn about unknown `device monitor filters `__ (`issue #4362 `_) -* Fixed a regression bug when `libArchive `__ option declared in the `library.json `__ manifest was ignored (`issue #4351 `_) +* Fixed a regression bug when `libArchive `__ option declared in the |LIBRARYJSON| manifest was ignored (`issue #4351 `_) * Fixed an issue when the `pio pkg publish `__ command didn't work with Python 3.6 (`issue #4352 `_) 6.1.1 (2022-07-11) diff --git a/platformio/package/commands/list.py b/platformio/package/commands/list.py index c92cc1b4..9d538b7d 100644 --- a/platformio/package/commands/list.py +++ b/platformio/package/commands/list.py @@ -84,10 +84,16 @@ def print_dependency_tree(pm, specs=None, filter_specs=None, level=0, verbose=Fa if not candidates: return candidates = sorted(candidates.values(), key=lambda item: item[0].metadata.name) + for index, (pkg, spec) in enumerate(candidates): if filtered_pkgs and not _pkg_tree_contains(pm, pkg, filtered_pkgs): continue - dependencies = pm.get_pkg_dependencies(pkg) + printed_pkgs = pm.memcache_get("__printed_pkgs", []) + if printed_pkgs and pkg.path in printed_pkgs: + continue + printed_pkgs.append(pkg.path) + pm.memcache_set("__printed_pkgs", printed_pkgs) + click.echo( "%s%s %s" % ( @@ -100,6 +106,8 @@ def print_dependency_tree(pm, specs=None, filter_specs=None, level=0, verbose=Fa ), ) ) + + dependencies = pm.get_pkg_dependencies(pkg) if dependencies: print_dependency_tree( pm, diff --git a/platformio/package/manager/_uninstall.py b/platformio/package/manager/_uninstall.py index c845145a..b374fd01 100644 --- a/platformio/package/manager/_uninstall.py +++ b/platformio/package/manager/_uninstall.py @@ -35,6 +35,12 @@ class PackageManagerUninstallMixin: if not pkg or not pkg.metadata: raise UnknownPackageError(spec) + uninstalled_pkgs = self.memcache_get("__uninstalled_pkgs", []) + if uninstalled_pkgs and pkg.path in uninstalled_pkgs: + return pkg + uninstalled_pkgs.append(pkg.path) + self.memcache_set("__uninstalled_pkgs", uninstalled_pkgs) + self.log.info( "Removing %s @ %s" % (click.style(pkg.metadata.name, fg="cyan"), pkg.metadata.version) From 6db3eb8e336b7530eff0886dec861f6015aced8f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 14 Jan 2023 22:17:33 +0200 Subject: [PATCH 46/49] Bump version to 6.1.6rc1 --- MANIFEST.in | 1 - platformio/__init__.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1aba38f6..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE diff --git a/platformio/__init__.py b/platformio/__init__.py index eb542a8d..bf026151 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (6, 1, "6a4") +VERSION = (6, 1, "6rc1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 1503eb5d413ecaee5421323ba68abc2cc94904c7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 21 Jan 2023 17:19:45 +0200 Subject: [PATCH 47/49] Minor refactoring --- platformio/home/helpers.py | 16 ---------------- platformio/home/rpc/handlers/os.py | 22 +++++++++++++++------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/platformio/home/helpers.py b/platformio/home/helpers.py index a777101b..0e88bde2 100644 --- a/platformio/home/helpers.py +++ b/platformio/home/helpers.py @@ -14,27 +14,11 @@ import socket -from starlette.concurrency import run_in_threadpool - from platformio import util from platformio.compat import IS_WINDOWS -from platformio.http import HTTPSession from platformio.proc import where_is_program -class AsyncSession(HTTPSession): - async def request( # pylint: disable=signature-differs,invalid-overridden-method - self, *args, **kwargs - ): - func = super().request - return await run_in_threadpool(func, *args, **kwargs) - - -@util.memoized(expire="60s") -def requests_session(): - return AsyncSession() - - @util.memoized(expire="60s") def get_core_fullpath(): return where_is_program("platformio" + (".exe" if IS_WINDOWS else "")) diff --git a/platformio/home/rpc/handlers/os.py b/platformio/home/rpc/handlers/os.py index aed62991..333618b5 100644 --- a/platformio/home/rpc/handlers/os.py +++ b/platformio/home/rpc/handlers/os.py @@ -19,17 +19,25 @@ import shutil from functools import cmp_to_key import click +from starlette.concurrency import run_in_threadpool from platformio import fs from platformio.cache import ContentCache from platformio.device.list.util import list_logical_devices -from platformio.home import helpers -from platformio.http import ensure_internet_on +from platformio.http import HTTPSession, ensure_internet_on + + +class HTTPAsyncSession(HTTPSession): + async def request( # pylint: disable=signature-differs,invalid-overridden-method + self, *args, **kwargs + ): + func = super().request + return await run_in_threadpool(func, *args, **kwargs) class OSRPC: @staticmethod - async def fetch_content(uri, data=None, headers=None, cache_valid=None): + async def fetch_content(url, data=None, headers=None, cache_valid=None): if not headers: headers = { "User-Agent": ( @@ -38,7 +46,7 @@ class OSRPC: "Safari/603.3.8" ) } - cache_key = ContentCache.key_from_args(uri, data) if cache_valid else None + cache_key = ContentCache.key_from_args(url, data) if cache_valid else None with ContentCache() as cc: if cache_key: result = cc.get(cache_key) @@ -48,11 +56,11 @@ class OSRPC: # check internet before and resolve issue with 60 seconds timeout ensure_internet_on(raise_exception=True) - session = helpers.requests_session() + session = HTTPAsyncSession() if data: - r = await session.post(uri, data=data, headers=headers) + r = await session.post(url, data=data, headers=headers) else: - r = await session.get(uri, headers=headers) + r = await session.get(url, headers=headers) r.raise_for_status() result = r.text From 83d21737483d28d111b10d7e8ad50b9cd614c2f1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 23 Jan 2023 12:49:06 +0200 Subject: [PATCH 48/49] Add Registry RPC --- platformio/home/rpc/handlers/registry.py | 29 ++++++++++++++++++++++++ platformio/home/run.py | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 platformio/home/rpc/handlers/registry.py diff --git a/platformio/home/rpc/handlers/registry.py b/platformio/home/rpc/handlers/registry.py new file mode 100644 index 00000000..a6d5b8bf --- /dev/null +++ b/platformio/home/rpc/handlers/registry.py @@ -0,0 +1,29 @@ +# Copyright (c) 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ajsonrpc.core import JSONRPC20DispatchException + +from platformio.registry.client import RegistryClient + + +class RegistryRPC: + @staticmethod + def call_client(method, *args, **kwargs): + try: + client = RegistryClient() + return getattr(client, method)(*args, **kwargs) + except Exception as exc: # pylint: disable=bare-except + raise JSONRPC20DispatchException( + code=4003, message="Registry Call Error", data=str(exc) + ) from exc diff --git a/platformio/home/run.py b/platformio/home/run.py index a5306ad0..25f1081e 100644 --- a/platformio/home/run.py +++ b/platformio/home/run.py @@ -33,6 +33,7 @@ from platformio.home.rpc.handlers.misc import MiscRPC from platformio.home.rpc.handlers.os import OSRPC from platformio.home.rpc.handlers.piocore import PIOCoreRPC from platformio.home.rpc.handlers.project import ProjectRPC +from platformio.home.rpc.handlers.registry import RegistryRPC from platformio.home.rpc.server import WebSocketJSONRPCServerFactory from platformio.package.manager.core import get_core_package_dir from platformio.proc import force_exit @@ -72,6 +73,7 @@ def run_server(host, port, no_open, shutdown_timeout, home_url): ws_rpc_factory.add_object_handler(OSRPC(), namespace="os") ws_rpc_factory.add_object_handler(PIOCoreRPC(), namespace="core") ws_rpc_factory.add_object_handler(ProjectRPC(), namespace="project") + ws_rpc_factory.add_object_handler(RegistryRPC(), namespace="registry") path = urlparse(home_url).path routes = [ From 2e64056787bd21221274e2ff28f35e207a93b75b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 23 Jan 2023 13:01:47 +0200 Subject: [PATCH 49/49] Bump version to 6.1.6 --- HISTORY.rst | 2 +- docs | 2 +- platformio/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 5c84e5fa..b963df38 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,7 +14,7 @@ PlatformIO Core 6 **A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.** -6.1.6 (2022-??-??) +6.1.6 (2023-01-23) ~~~~~~~~~~~~~~~~~~ * Added support for Python 3.11 diff --git a/docs b/docs index 5b7d5d49..95c339a7 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5b7d5d49985a4458394b2ffd91aba5780cc21fe8 +Subproject commit 95c339a71162dc5bd28090f263e641a563229888 diff --git a/platformio/__init__.py b/platformio/__init__.py index bf026151..08d95a79 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (6, 1, "6rc1") +VERSION = (6, 1, 6) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"