diff mbox

[pinmux,scripts,3/5] csv-to-board: handle missing package columns

Message ID 1427306777-17669-3-git-send-email-swarren@wwwdotorg.org
State Deferred
Headers show

Commit Message

Stephen Warren March 25, 2015, 6:06 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Some board spreadsheets may have irrelevant package columns removed,
leaving only the package column that the specific board uses. Update
csv-to-board to handle missing package columns.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 csv-to-board.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/csv-to-board.py b/csv-to-board.py
index 2860c029b9f3..b2d1c46ec302 100755
--- a/csv-to-board.py
+++ b/csv-to-board.py
@@ -190,18 +190,27 @@  with open(board_conf['filename'], newline='') as fh:
                 try:
                     cols[colid] = row.index(coltext)
                 except:
-                    if board_conf['soc'] != 'tegra124':
-                        raise
-                    if colid != COL_RCV_SEL:
-                        print('ERROR: Header column "%s" not found' % coltext, file=sys.stderr)
-                        sys.exit(1)
+                    if colid in (COL_BALL_MID, COL_BALL_DSC):
+                        pass
+                    else:
+                        if board_conf['soc'] != 'tegra124':
+                            raise
+                        if colid != COL_RCV_SEL:
+                            print('ERROR: Header column "%s" not found' % coltext, file=sys.stderr)
+                            sys.exit(1)
                     cols[colid] = None
             found_header = True
             continue
 
         ball_name = row[cols[COL_BALL_NAME]].lower()
-        ball_mid = row[cols[COL_BALL_MID]]
-        ball_dsc = row[cols[COL_BALL_DSC]]
+        if cols[COL_BALL_MID]:
+            ball_mid = row[cols[COL_BALL_MID]]
+        else:
+            ball_mid = None
+        if cols[COL_BALL_DSC]:
+            ball_dsc = row[cols[COL_BALL_DSC]]
+        else:
+            ball_dsc = None
 
         # Section title row
         if not ball_mid and not ball_dsc: