From 2abe4d7a8f9c292fe8c35580da451b49d33b4553 Mon Sep 17 00:00:00 2001 From: Jaekwon Bang Date: Tue, 4 Jun 2024 16:49:08 +0900 Subject: [PATCH 1/2] Modify column name --- setup.py | 2 +- src/fosslight_util/oss_item.py | 2 +- src/fosslight_util/parsing_yaml.py | 3 ++- src/fosslight_util/read_excel.py | 2 ++ src/fosslight_util/write_excel.py | 6 +++--- src/fosslight_util/write_yaml.py | 2 +- tests/test_excel_and_csv.py | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 2d28a0d..684811b 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ if __name__ == "__main__": setup( name='fosslight_util', - version='1.4.43', + version='1.4.44', package_dir={"": "src"}, packages=find_packages(where='src'), description='FOSSLight Util', diff --git a/src/fosslight_util/oss_item.py b/src/fosslight_util/oss_item.py index d0f688d..dc996e8 100644 --- a/src/fosslight_util/oss_item.py +++ b/src/fosslight_util/oss_item.py @@ -201,7 +201,7 @@ def get_print_json(self): json_item["version"] = self.version if len(self.source_name_or_path) > 0: - json_item["source name or path"] = self.source_name_or_path + json_item["source path"] = self.source_name_or_path if len(self.license) > 0: json_item["license"] = self.license if self.download_location != "": diff --git a/src/fosslight_util/parsing_yaml.py b/src/fosslight_util/parsing_yaml.py index 5d8f815..c8fde32 100644 --- a/src/fosslight_util/parsing_yaml.py +++ b/src/fosslight_util/parsing_yaml.py @@ -101,7 +101,8 @@ def set_value_switch(oss, key, value, yaml_file=""): oss.download_location = value elif key in ['license', 'license text']: oss.license = value - elif key in ['file name or path', 'source name or path', 'file', 'binary name']: + elif key in ['file name or path', 'source name or path', 'source path', + 'file', 'binary name', 'binary path']: oss.source_name_or_path = value elif key in ['copyright text', 'copyright']: oss.copyright = value diff --git a/src/fosslight_util/read_excel.py b/src/fosslight_util/read_excel.py index 78939cd..b726bbb 100644 --- a/src/fosslight_util/read_excel.py +++ b/src/fosslight_util/read_excel.py @@ -66,7 +66,9 @@ def read_oss_report(excel_file: str, sheet_names: str = "") -> List[OssItem]: _item_idx = { "ID": IDX_CANNOT_FOUND, "Source Name or Path": IDX_CANNOT_FOUND, + "Source Path": IDX_CANNOT_FOUND, "Binary Name": IDX_CANNOT_FOUND, + "Binary Path": IDX_CANNOT_FOUND, "OSS Name": IDX_CANNOT_FOUND, "OSS Version": IDX_CANNOT_FOUND, "License": IDX_CANNOT_FOUND, diff --git a/src/fosslight_util/write_excel.py b/src/fosslight_util/write_excel.py index 6fa5d19..fd32666 100755 --- a/src/fosslight_util/write_excel.py +++ b/src/fosslight_util/write_excel.py @@ -15,15 +15,15 @@ from jsonmerge import merge from fosslight_util.cover import CoverItem -_HEADER = {'BIN (': ['ID', 'Binary Name', 'Source Code Path', +_HEADER = {'BIN (': ['ID', 'Binary Path', 'Source Code Path', 'NOTICE.html', 'OSS Name', 'OSS Version', 'License', 'Download Location', 'Homepage', 'Copyright Text', 'Exclude', 'Comment'], - 'SRC': ['ID', 'Source Name or Path', 'OSS Name', + 'SRC': ['ID', 'Source Path', 'OSS Name', 'OSS Version', 'License', 'Download Location', 'Homepage', 'Copyright Text', 'Exclude', 'Comment'], - 'BIN': ['ID', 'Binary Name', 'OSS Name', 'OSS Version', + 'BIN': ['ID', 'Binary Path', 'OSS Name', 'OSS Version', 'License', 'Download Location', 'Homepage', 'Copyright Text', 'Exclude', 'Comment']} _OUTPUT_FILE_PREFIX = "FOSSLight-Report_" diff --git a/src/fosslight_util/write_yaml.py b/src/fosslight_util/write_yaml.py index 25a799f..b2c2e66 100644 --- a/src/fosslight_util/write_yaml.py +++ b/src/fosslight_util/write_yaml.py @@ -93,7 +93,7 @@ def create_yaml_with_ossitem(item, yaml_dict): oss_info.get('homepage', '') == item.homepage and \ oss_info.get('download location', '') == item.download_location and \ oss_info.get('exclude', False) == item.exclude: - oss_info.get('source name or path', []).extend(item.source_name_or_path) + oss_info.get('source path', []).extend(item.source_name_or_path) oss_info.pop('comment', None) merged = True break diff --git a/tests/test_excel_and_csv.py b/tests/test_excel_and_csv.py index 1af6924..f6f1295 100755 --- a/tests/test_excel_and_csv.py +++ b/tests/test_excel_and_csv.py @@ -35,7 +35,7 @@ def main(): '0.4.3', 'Apache-2.0', 'https://github.com/jpeddicord/askalono', '', 'Copyright (c) 2018 Amazon.com, Inc. or its affiliates.', '', '']] - sheet_items = [['ID', 'Binary Name', 'OSS Name', 'OSS Version', + sheet_items = [['ID', 'Binary Path', 'OSS Name', 'OSS Version', 'License', 'Download Location', 'Homepage', 'Copyright Text', 'Exclude', 'Comment'], ['dependency_unified.py', 'fosslight_dependency', From fb86fb5f1583c7e86e15884b4e58e98edc1fb540 Mon Sep 17 00:00:00 2001 From: Jaekwon Bang Date: Wed, 5 Jun 2024 17:19:03 +0900 Subject: [PATCH 2/2] Change column name --- src/fosslight_util/oss_item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fosslight_util/oss_item.py b/src/fosslight_util/oss_item.py index dc996e8..53e8a65 100644 --- a/src/fosslight_util/oss_item.py +++ b/src/fosslight_util/oss_item.py @@ -217,7 +217,7 @@ def get_print_json(self): if len(self.depends_on) > 0: json_item["depends on"] = self.depends_on if self.purl != "": - json_item["purl"] = self.purl + json_item["package url"] = self.purl return json_item