Skip to content

Commit 2a69d54

Browse files
committed
Fix a bug related to run report
1 parent da0de67 commit 2a69d54

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/fosslight_oss_pkg/_parsing_excel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ def convert_excel_to_yaml(oss_report_to_read, output_file):
2323

2424
if os.path.isfile(oss_report_to_read):
2525
try:
26+
_logger.warning("Read data from :" + oss_report_to_read)
2627
items = read_oss_report(oss_report_to_read)
2728
for item in items:
2829
_row_to_print.append(item.get_print_json())
2930
if len(_row_to_print) > 0:
3031
output_file = output_file if output_file.endswith(_file_extension) else output_file + _file_extension
3132
_output_json[_json_root_key] = _row_to_print
3233
write_yaml_file(output_file, _output_json)
33-
_logger.warn("Output: "+output_file)
34+
_logger.warning("Output: " + output_file)
3435
except Exception as error:
3536
_logger.error("Convert yaml:"+str(error))
3637
else:

src/fosslight_oss_pkg/fosslight_oss_pkg.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@ def find_report_file(path_to_find):
2626
file_with_path = os.path.join(path_to_find, file)
2727
if os.path.isfile(file_with_path):
2828
return file
29-
for p, d, f in os.walk(path_to_find):
30-
for file in f:
29+
for root, dirs, files in os.walk(path_to_find):
30+
for file in files:
3131
file_name = file.lower()
3232
if (file_name.startswith("oss-report") or file_name.startswith("fosslight-report")) \
3333
and file_name.endswith(".xlsx"):
34-
return os.path.join(d, file)
35-
except Exception:
36-
pass
34+
return os.path.join(root, file)
35+
except Exception as error:
36+
logger.debug("Find report:"+str(error))
3737
return ""
3838

3939

4040
def convert_report(base_path, files, output_name):
4141
oss_pkg_files = ["oss-pkg-info.yml", "oss-pkg-info.yaml"]
42-
base_path = ""
4342
file_option_on = False
4443
convert_yml_mode = False
4544
convert_excel_mode = False
@@ -79,9 +78,9 @@ def convert_report(base_path, files, output_name):
7978
if is_window:
8079
convert_yml_mode = True
8180
base_path = os.getcwd()
82-
convert_excel_mode = True
83-
if report_to_read == "":
84-
report_to_read = find_report_file(base_path)
81+
report_to_read = find_report_file(base_path)
82+
if report_to_read != "":
83+
convert_excel_mode = True
8584
else:
8685
print_help_msg()
8786

0 commit comments

Comments
 (0)