Skip to content

Commit 4a82650

Browse files
committed
Add n-able-nrfutil to replace the deprecated nrfutil.
1 parent fd9d12f commit 4a82650

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

builder/main.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,6 @@ def AfterUpload(target, source, env): # pylint: disable=W0613,W0621
248248
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]
249249

250250
elif upload_protocol == "nrfutil":
251-
try:
252-
import nordicsemi
253-
except ImportError:
254-
env.Execute('$PYTHONEXE -m pip install -U --force-reinstall nrfutil==6.1.4')
255-
256251
env.Replace(
257252
UPLOADER="nrfutil",
258253
UPLOADERFLAGS=[

platform.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
#import copy
15+
import os
1616
import sys
17+
import subprocess
1718

1819
from platformio.public import PlatformBase
1920

@@ -41,6 +42,17 @@ def configure_default_packages(self, variables, targets):
4142
if upload_protocol == "adafruit-nrfutil":
4243
self.packages["tool-adafruit-nrfutil"]["optional"] = False
4344

45+
if upload_protocol == "nrfutil":
46+
try:
47+
import nordicsemi
48+
except ImportError:
49+
nrfutil_whl = os.path.join(self.get_dir(), "tools",
50+
"n_able_nrfutil-1.0.0-py3-none-any.whl")
51+
try:
52+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-U", nrfutil_whl])
53+
except subprocess.CalledProcessError as e:
54+
sys.stderr.write("Error: Could not install nrfutil : %s" % e)
55+
4456
# configure J-LINK tool
4557
jlink_conds = [
4658
"jlink" in variables.get(option, "")
861 KB
Binary file not shown.

0 commit comments

Comments
 (0)