scripts: standardize print usage with parentheses
PATCH 1/3 scripts: standardize print usage with parentheses
Signed-off-by Lucas Dutra Nunes <[email protected]>
--- scripts/bitbake-metadata2doc.py | 2 +- scripts/format_machine_list.py | 2 +- scripts/generate-bugs-table.py | 14 +++++++------- scripts/test-sheet-parser.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-)
scripts/bitbake-metadata2doc.py +1 -1
@@ -478,7 +478,7 @@ def write_acknowledgements(out_dir, bsp_dir, gitdm_dir, start_commit, end_commit def usage(exit_code=None): - print 'Usage: %s <data file> <output dir> <bsp dir> <gitdb dir> <start commit> <end commit>' % (os.path.basename(sys.argv[0]),) + print('Usage: %s <data file> <output dir> <bsp dir> <gitdb dir> <start commit> <end commit>' % (os.path.basename(sys.argv[0]),)) if exit_code: sys.exit(exit_code)
scripts/format_machine_list.py +1 -1
@@ -38,7 +38,7 @@ def main(): csv_file = sys.argv[1] table = process_machines_table(read_csv_file(csv_file)) - print table.strip() + print(table.strip()) if __name__ == '__main__':
scripts/generate-bugs-table.py +7 -7
@@ -44,20 +44,20 @@ def parse_data(csv_bug_list, columns_to_keep): def write_to_file(file_path, data): if(file_path == "-"): - print "\n" + data + print("\n" + data) else: - print 'Writing to file "' + file_path + '"...' + print('Writing to file "' + file_path + '"...') f = open(file_path, 'w') f.write(data) f.close() - print "Done!" + print("Done!") def generate_bugs_file(url, output_file_path, columns_to_keep): - print "Requesting bugs list in CSV format from https://bugzilla.yoctoproject.org/..." + print("Requesting bugs list in CSV format from https://bugzilla.yoctoproject.org/...") csv_bug_list = request_bug_list(url) - print "Parsing data..." + print("Parsing data...") data = parse_data(csv_bug_list, columns_to_keep) - print "Building table..." + print("Building table...") table = tabularize(data) write_to_file(output_file_path, table)
@@ -120,7 +120,7 @@ def process_arguments(): "YYYY-MM-DD") exit(1) - print start_processing_message + print(start_processing_message) url = re.sub('<<START_DATE>>', start_date, url) return [url, output, columns_to_keep]
scripts/test-sheet-parser.py +1 -1
@@ -168,7 +168,7 @@ def process_test_sheet(test_sheet, repos_dir): print('This board was tested by %d %s.\n' % (len(testers), tester_str)) print('%d %s %s used:\n' % (len(images), image_str, was)) for image in images: - print ' * ' + image + print(' * ' + image) # Omit the first 4 questions (personal + board) and empty questions # for qno, question in enumerate(header):
Signature · 1 line
2.1.4
PATCH 2/3 scripts: remove commented code
Signed-off-by Lucas Dutra Nunes <[email protected]>
--- scripts/test-sheet-parser.py | 16 ---------------- 1 file changed, 16 deletions(-)
scripts/test-sheet-parser.py +0 -16
@@ -131,10 +131,6 @@ def process_test_sheet(test_sheet, repos_dir): board_index = fields.index('board') supported_boards = get_supported_boards(repos_dir) - - # for row in test_sheet: - # print row - for response in responses: board = response[board_index] if board not in responses_by_board.keys():
@@ -163,23 +159,11 @@ def process_test_sheet(test_sheet, repos_dir): image_str = 'image' was = 'was' - - print('This board was tested by %d %s.\n' % (len(testers), tester_str)) print('%d %s %s used:\n' % (len(images), image_str, was)) for image in images: print(' * ' + image) - # Omit the first 4 questions (personal + board) and empty questions - # for qno, question in enumerate(header): - # if qno > 3 and question != '': - # print(rst_item(question)) - # for responses in responses_by_board[board]: - # resp = responses[qno] - # if resp: - # print(rst_item(resp, level=1)) - # print('') - print('\n') not_tested = set(supported_boards.keys()) - set(responses_by_board.keys())
Signature · 1 line
2.1.4
PATCH 3/3 scripts: output error messages to stderr
In reply to Lucas Dutra NunesSigned-off-by Lucas Dutra Nunes <[email protected]>
--- scripts/format_machine_list.py | 2 +- scripts/generate-bugs-table.py | 7 ++++--- scripts/test-sheet-parser.py | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-)
scripts/format_machine_list.py +1 -1
@@ -14,7 +14,7 @@ def read_csv_file(csv_file): reader = csv.reader(csv_fd, delimiter=',') return list(reader) except IOError: - print('Could not read %s. Aborting.') % csv_file + sys.stderr.write('Could not read %s. Aborting.\n') % csv_file sys.exit(1)
scripts/generate-bugs-table.py +4 -3
@@ -115,9 +115,10 @@ def process_arguments(): try: time.strptime(start_date, "%Y-%m-%d") except ValueError: - print(os.path.basename(sys.argv[0]) + - ": error: start_date must be in the following format: " + - "YYYY-MM-DD") + msg = (os.path.basename(sys.argv[0]) + + ": error: start_date must be in the following format: " + + "YYYY-MM-DD") + sys.stderr.write(msg) exit(1) print(start_processing_message)
scripts/test-sheet-parser.py +2 -2
@@ -49,7 +49,7 @@ def read_test_sheet(csv_file): reader = csv.reader(csv_fd, delimiter=',') return list(reader) except IOError: - print('Could not read %s. Aborting.') % csv_file + sys.stderr.write('Could not read %s. Aborting.\n') % csv_file sys.exit(1) def parse_board_file(board_file):
@@ -65,7 +65,7 @@ def parse_board_file(board_file): board_spec['soc'] = get_descr(line) return board_spec except IOError: - print('Could not read %s.') % board_file + sys.stderr.write('Could not read %s.\n') % board_file def get_supported_boards(repos_dir):
Signature · 1 line
2.1.4
Quoted 1 line · Lucas Dutra Nunes
Signed-off-by Lucas Dutra Nunes <[email protected]>
Acked-by Otavio Salvador <[email protected]>
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [Documentation][PATCH 3/3] scripts: output error messages to stderr
In reply to Lucas Dutra NunesQuoted 1 line · Lucas Dutra Nunes
Signed-off-by Lucas Dutra Nunes <[email protected]>
Acked-by Otavio Salvador <[email protected]>
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [Documentation][PATCH 2/3] scripts: remove commented code
In reply to Lucas Dutra NunesQuoted 1 line · Lucas Dutra Nunes
Signed-off-by Lucas Dutra Nunes <[email protected]>
Acked-by Otavio Salvador <[email protected]>
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750