From c97b377c3e942673e936cb023ac82ab357e9d1db Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 28 May 2022 15:55:17 +0300 Subject: [PATCH] Add compatibility with PIO Core 6.0 --- .github/workflows/examples.yml | 12 +++++------- README.md | 2 +- builder/main.py | 4 ++-- platform.json | 2 +- platform.py | 9 ++++----- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index ccda6ef..b24ad69 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -8,24 +8,22 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: [3.7] example: - "examples/arduino-blink" - "examples/arduino-external-libs" runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: "recursive" - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + - name: Set up Python + uses: actions/setup-python@v3 with: - python-version: ${{ matrix.python-version }} + python-version: "3.9" - name: Install dependencies run: | - python -m pip install --upgrade pip pip install -U https://github.com/platformio/platformio/archive/develop.zip pio pkg install --global --platform symlink://. - name: Build examples run: | - platformio run -d ${{ matrix.example }} + pio run -d ${{ matrix.example }} diff --git a/README.md b/README.md index 47b4217..2f2ee78 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ RP2040 is a low-cost, high-performance microcontroller device with a large on-ch # Usage -1. [Install PlatformIO](http://platformio.org) +1. [Install PlatformIO](https://platformio.org) 2. Create PlatformIO project and configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file: ## Stable version diff --git a/builder/main.py b/builder/main.py index 0854f09..e59f3f5 100644 --- a/builder/main.py +++ b/builder/main.py @@ -17,7 +17,7 @@ from platform import system from os import makedirs from os.path import isdir, join -from platformio.util import get_serial_ports +from platformio.public import list_serial_ports from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment) @@ -29,7 +29,7 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 upload_options = env.BoardConfig().get("upload", {}) env.AutodetectUploadPort() - before_ports = get_serial_ports() + before_ports = list_serial_ports() if upload_options.get("use_1200bps_touch", False): env.TouchSerialPort("$UPLOAD_PORT", 1200) diff --git a/platform.json b/platform.json index ecde199..6693990 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "RP2040" ], "engines": { - "platformio": "^5" + "platformio": "^6" }, "repository": { "type": "git", diff --git a/platform.py b/platform.py index 35b16fa..26b2ffe 100644 --- a/platform.py +++ b/platform.py @@ -14,7 +14,7 @@ import platform -from platformio.managers.platform import PlatformBase +from platformio.public import PlatformBase class RaspberrypiPlatform(PlatformBase): @@ -38,16 +38,16 @@ class RaspberrypiPlatform(PlatformBase): if not any(jlink_conds) and jlink_pkgname in self.packages: del self.packages[jlink_pkgname] - return PlatformBase.configure_default_packages(self, variables, targets) + return super().configure_default_packages(variables, targets) def get_boards(self, id_=None): - result = PlatformBase.get_boards(self, id_) + result = super().get_boards(id_) if not result: return result if id_: return self._add_default_debug_tools(result) else: - for key, value in result.items(): + for key in result: result[key] = self._add_default_debug_tools(result[key]) return result @@ -101,7 +101,6 @@ class RaspberrypiPlatform(PlatformBase): def configure_debug_session(self, debug_config): adapter_speed = debug_config.speed or "5000" - server_options = debug_config.server or {} server_arguments = server_options.get("arguments", []) if "interface/cmsis-dap.cfg" in server_arguments: