From 0ba9a18e12a8d87df84da30577aa52ebf2a59826 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 28 May 2022 14:42:59 +0300 Subject: [PATCH] Add compatibility with PIO Core 6.0 --- .github/workflows/examples.yml | 7 +++---- README.md | 4 ++-- builder/main.py | 4 ++-- platform.json | 2 +- platform.py | 16 ++++++++-------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index d677265..5631d92 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -26,19 +26,18 @@ jobs: - "examples/zephyr-subsys-nvs" runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: "recursive" - name: Set up Python 3 - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: "3.7" - name: Install dependencies run: | - python -m pip install --upgrade pip pip install -U https://github.com/platformio/platformio/archive/develop.zip pip3 install adafruit-nrfutil 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 003f309..068924a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Nordic nRF52: development platform for [PlatformIO](http://platformio.org) +# Nordic nRF52: development platform for [PlatformIO](https://platformio.org) [![Build Status](https://github.com/platformio/platform-nordicnrf52/workflows/Examples/badge.svg)](https://github.com/platformio/platform-nordicnrf52/actions) @@ -9,7 +9,7 @@ The nRF52 Series are built for speed to carry out increasingly complex tasks in # 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 ba1f4ce..e72ff35 100644 --- a/builder/main.py +++ b/builder/main.py @@ -20,7 +20,7 @@ from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment) -from platformio.util import get_serial_ports +from platformio.public import list_serial_ports def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 @@ -33,7 +33,7 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 if not bool(upload_options.get("disable_flushing", False)): env.FlushSerialBuffer("$UPLOAD_PORT") - before_ports = get_serial_ports() + before_ports = list_serial_ports() if bool(upload_options.get("use_1200bps_touch", False)): env.TouchSerialPort("$UPLOAD_PORT", 1200) diff --git a/platform.json b/platform.json index 2da0776..1a0f789 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "nRF52" ], "engines": { - "platformio": "^5" + "platformio": "^6" }, "repository": { "type": "git", diff --git a/platform.py b/platform.py index bd58439..138ae8c 100644 --- a/platform.py +++ b/platform.py @@ -15,12 +15,13 @@ import copy import json import os -import platform +import sys -from platformio.managers.platform import PlatformBase -from platformio.util import get_systype +from platformio.public import PlatformBase +IS_WINDOWS = sys.platform.startswith("win") + class Nordicnrf52Platform(PlatformBase): def is_embedded(self): @@ -56,7 +57,7 @@ def configure_default_packages(self, variables, targets): if p in ("tool-cmake", "tool-dtc", "tool-ninja"): self.packages[p]["optional"] = False self.packages["toolchain-gccarmnoneeabi"]["version"] = "~1.80201.0" - if "windows" not in get_systype(): + if not IS_WINDOWS: self.packages["tool-gperf"]["optional"] = False if board in ("nano33ble", "nicla_sense_me"): @@ -87,11 +88,10 @@ def configure_default_packages(self, variables, targets): 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_: @@ -133,7 +133,7 @@ def _add_default_debug_tools(self, board): "-port", "2331" ], "executable": ("JLinkGDBServerCL.exe" - if platform.system() == "Windows" else + if IS_WINDOWS else "JLinkGDBServer") } }