|
8 | 8 | import yaml |
9 | 9 | from fosslight_util.constant import LOGGER_NAME |
10 | 10 | from fosslight_util.parsing_yaml import find_all_oss_pkg_files, parsing_yml |
11 | | -from fosslight_util.write_excel import write_result_to_excel |
| 11 | +from fosslight_util.output_format import write_output_file |
12 | 12 | from fosslight_util.write_yaml import create_yaml_with_ossitem |
13 | 13 | from fosslight_util.read_excel import read_oss_report |
14 | 14 |
|
@@ -36,19 +36,19 @@ def convert_yml_to_excel(oss_pkg_files, output_file, file_option_on, base_path, |
36 | 36 | except Exception as ex: |
37 | 37 | logger.error(f"Read yaml file: {ex}") |
38 | 38 |
|
39 | | - if items_to_print and len(items_to_print) > 0: |
40 | | - try: |
41 | | - sheet_list["SRC_FL_Reuse"] = items_to_print |
42 | | - success = write_result_to_excel(f"{output_file}.xlsx", sheet_list) |
43 | | - if success: |
44 | | - logger.warning(f"Output: {output_file}.xlsx") |
| 39 | + try: |
| 40 | + sheet_list["SRC_FL_Reuse"] = items_to_print |
| 41 | + success, msg, result_file = write_output_file(output_file, '.xlsx', |
| 42 | + sheet_list) |
| 43 | + if success: |
| 44 | + if result_file: |
| 45 | + logger.info(f"Output: {result_file}") |
45 | 46 | else: |
46 | | - logger.error(f"Can't write excel file : {output_file}") |
47 | | - sys.exit(1) |
48 | | - except Exception as ex: |
49 | | - logger.error(f"Error to write excel file : {ex}") |
50 | | - else: |
51 | | - logger.warning("There is no item to convert to Excel") |
| 47 | + logger.warning("Nothing is detected to convert so output file is not generated.") |
| 48 | + else: |
| 49 | + logger.error(f"Error to write excel file : {msg}") |
| 50 | + except Exception as ex: |
| 51 | + logger.error(f"Error to write excel file : {ex}") |
52 | 52 |
|
53 | 53 |
|
54 | 54 | def convert_excel_to_yaml(oss_report_to_read, output_file, sheet_names=""): |
|
0 commit comments