diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index a0ea7c59a8e..5e90b7c84c6 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -13,6 +13,7 @@ import yaml import scl import logging from pathlib import Path +from natsort import natsorted from twisterlib.environment import ZEPHYR_BASE @@ -321,7 +322,7 @@ class HardwareMap: def save(self, hwm_file): # use existing map - self.detected.sort(key=lambda x: x.serial or '') + self.detected = natsorted(self.detected, key=lambda x: x.serial or '') if os.path.exists(hwm_file): with open(hwm_file, 'r') as yaml_file: hwm = yaml.load(yaml_file, Loader=SafeLoader) diff --git a/scripts/requirements-run-test.txt b/scripts/requirements-run-test.txt index 3bb0b21c44e..83692128110 100644 --- a/scripts/requirements-run-test.txt +++ b/scripts/requirements-run-test.txt @@ -7,6 +7,7 @@ pyocd>=0.35.0 # used by twister for board/hardware map tabulate +natsort # used by mcuboot cbor>=1.0.0