utils/genrandconfig: filter empty lines and comments in CSV file
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 29 Oct 2017 17:14:36 +0000 (18:14 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 27 Nov 2017 22:20:04 +0000 (23:20 +0100)
In preparation for the addition of comments in the CSV file listing
toolchain configurations, we filter out such lines when reading the
CSV file in utils/genrandconfig.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
utils/genrandconfig

index a67d46fad94ded4a4a08db4c78e7ec75ea1e678e..883322552c1c25e043d4b6ca4749353680a89b6d 100755 (executable)
@@ -126,7 +126,9 @@ def get_toolchain_configs(toolchains_csv, buildrootdir):
     """
 
     with open(toolchains_csv) as r:
-        toolchains = decode_byte_list(r.readlines())
+        # filter empty lines and comments
+        lines = [ t for t in r.readlines() if len(t.strip()) > 0 and t[0] != '#' ]
+        toolchains = decode_byte_list(lines)
     configs = []
 
     (_, _, _, _, hostarch) = os.uname()