InfiniTime.git

commit f057894d2670712c316f69bd9aa3a66275a8b3e5

Author: Reinhold Gschweicher <pyro4hell@gmail.com>

Allow mcuboot tool to use cbor2 additional to cbor

The mcuboot imgtool uses the python module `cbor`.

An equivalent and updated package `cbor2` requires Python 3.7 or newer.

The arch packages provide a package `python-cbor2`, but no package for
`cbor`.

This patch makes it possible to use the system package by adding
support for the `cbor2` package additionally to the `cbor` package.

 tools/mcuboot/imgtool/boot_record.py | 5 ++++-


diff --git a/tools/mcuboot/imgtool/boot_record.py b/tools/mcuboot/imgtool/boot_record.py
index 4112b225a5b47f5e76777e29d144948ebdcb1360..28797c3c140bd0028a1bdf1b077d2d6f3e4a8166 100644
--- a/tools/mcuboot/imgtool/boot_record.py
+++ b/tools/mcuboot/imgtool/boot_record.py
@@ -14,7 +14,10 @@ # See the License for the specific language governing permissions and
 # limitations under the License.
 
 from enum import Enum
-import cbor
+try:
+    import cbor2 as cbor
+except:
+    import cbor
 
 
 class SwComponent(int, Enum):