From 49f03ec331697d525fdc2ee10647418bf088a376 Mon Sep 17 00:00:00 2001 From: Eva Schiffer <evas@ssec.wisc.edu> Date: Thu, 7 Oct 2021 10:24:45 -0500 Subject: [PATCH] zero pad report dir names when making many reports so they sort correctly --- pyglance/glance/compare.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyglance/glance/compare.py b/pyglance/glance/compare.py index 01669a6..db4400a 100644 --- a/pyglance/glance/compare.py +++ b/pyglance/glance/compare.py @@ -1810,6 +1810,7 @@ def main(): "Please check that the files are named the same in both directories.") return 1 temp_offset = 0 + pad_to_digits = len(str(len(file_pairs))) # how many potential reports are we making? zero pad names to the same width to_return = 0 summary_report_info = { } # run each of the reports, putting them in inner temp dirs @@ -1818,7 +1819,7 @@ def main(): LOG.info("Generating comparison report for files: " + single_a_file + " " + single_b_file) if len(file_pairs) > 1 : file_name_temp = os.path.splitext(os.path.basename(single_a_file))[0] - out_dir_name = "report-" + str(temp_offset) + "-" + file_name_temp + out_dir_name = "report-" + str(temp_offset).zfill(pad_to_digits) + "-" + file_name_temp ops_copy[OPTIONS_OUTPUT_PATH_KEY] = os.path.join(ops_copy[OPTIONS_OUTPUT_PATH_KEY], out_dir_name) temp_offset += 1 -- GitLab