From 5e2d14ef7b14a9cc77a78f5ae8acbda9875629fb Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 4 Oct 2018 08:43:58 +0200 Subject: [PATCH 1/3] dsdl_compiler: add missing shebang --- libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index 04c2f3bf9..5bb4e55c7 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # # UAVCAN DSDL compiler for libuavcan # From 65d1f61d9b1589f43edc2412e43b75425c9dbba3 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 4 Oct 2018 08:44:27 +0200 Subject: [PATCH 2/3] dsdl_compiler: remove trailing whitespace --- libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index 5bb4e55c7..913f88c0e 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -40,11 +40,11 @@ def run(source_dirs, include_dirs, output_dir): possibly empty list of search directories (containing DSDL definition files that can be referenced from the types that are going to be parsed), and the output directory path (possibly nonexistent) where the generated C++ header files will be stored. - + Note that this module features lazy write, i.e. if an output file does already exist and its content is not going to change, it will not be overwritten. This feature allows to avoid unnecessary recompilation of dependent object files. - + Args: source_dirs List of root namespace directories to parse. include_dirs List of root namespace directories with referenced types (possibly empty). This list is From 90ae14efcdde02de9bfe3f70fabdabc535674ae1 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 4 Oct 2018 08:44:48 +0200 Subject: [PATCH 3/3] dsdl_compiler: check for StopIteration exception This fixes the exception happening with Python 3.7. I'm assuming this has to do with: https://www.python.org/dev/peps/pep-0479/ --- libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index 913f88c0e..eaddd0a9b 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -298,7 +298,10 @@ def expand(**args): def enum_last_value(iterable, start=0): it = iter(iterable) count = start - last = next(it) + try: + last = next(it) + except StopIteration: + return for val in it: yield count, False, last last = val