[Buildroot] [git commit] utils/genrandconfig: filter empty lines and comments in CSV file

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon Nov 27 22:20:04 UTC 2017


commit: https://git.buildroot.net/buildroot/commit/?id=c7abd1ddfbdbd7b4e4e426dce7c9d1c82fde1582
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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 at free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 utils/genrandconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils/genrandconfig b/utils/genrandconfig
index a67d46f..8833225 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -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()


More information about the buildroot mailing list