Skip to content

Commit 029e3e6

Browse files
authored
Merge pull request #92 from fosslight/temp
Change the message if there is nothing to convert
2 parents 4614b38 + 151e4a7 commit 029e3e6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/fosslight_oss_pkg/_parsing_excel.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import yaml
99
from fosslight_util.constant import LOGGER_NAME
1010
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
1212
from fosslight_util.write_yaml import create_yaml_with_ossitem
1313
from fosslight_util.read_excel import read_oss_report
1414

@@ -36,19 +36,19 @@ def convert_yml_to_excel(oss_pkg_files, output_file, file_option_on, base_path,
3636
except Exception as ex:
3737
logger.error(f"Read yaml file: {ex}")
3838

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}")
4546
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}")
5252

5353

5454
def convert_excel_to_yaml(oss_report_to_read, output_file, sheet_names=""):

0 commit comments

Comments
 (0)