Skip to content

Commit a2c7741

Browse files
authored
Merge pull request #126 from fosslight/develop
Remove frequent license nick list file
2 parents 3329d5c + 8c0f43e commit a2c7741

File tree

2 files changed

+2
-63
lines changed

2 files changed

+2
-63
lines changed

src/fosslight_prechecker/_add.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
import re
77
import logging
88
import shutil
9-
import json
109
import sys
1110
import fosslight_util.constant as constant
1211
import urllib.request
1312
from yaml import safe_dump
1413
from fosslight_util.set_log import init_log
15-
from fosslight_util.spdx_licenses import get_spdx_licenses_json
14+
from fosslight_util.spdx_licenses import get_spdx_licenses_json, get_license_from_nick
1615
from fosslight_util.parsing_yaml import find_sbom_yaml_files, parsing_yml
1716
from fosslight_util.output_format import check_output_format
1817
from datetime import datetime
@@ -30,34 +29,13 @@
3029
LICENSE_INCLUDE_FILES = ["license", "license.md", "license.txt", "notice"]
3130
EXCLUDE_DIR = ["test", "tests", "doc", "docs"]
3231
EXCLUDE_PREFIX = ("test", ".", "doc", "__")
33-
RESOURCES_DIR = 'resources'
34-
LICENSES_JSON_FILE = 'convert_license.json'
3532
OPENSOURCE_LGE_COM_URL_PREFIX = "https://opensource.lge.com/license/"
3633
_result_log = {}
3734
spdx_licenses = []
3835

3936
logger = logging.getLogger(constant.LOGGER_NAME)
4037

4138

42-
def get_licenses_from_json():
43-
licenses = {}
44-
licenses_file = os.path.join(RESOURCES_DIR, LICENSES_JSON_FILE)
45-
46-
try:
47-
base_dir = sys._MEIPASS
48-
except Exception:
49-
base_dir = os.path.dirname(__file__)
50-
51-
file_withpath = os.path.join(base_dir, licenses_file)
52-
try:
53-
with open(file_withpath, 'r') as f:
54-
licenses = json.load(f)
55-
except Exception as ex:
56-
dump_error_msg(f"Error to get license from json file : {ex}")
57-
58-
return licenses
59-
60-
6139
def check_file_extension(file_list):
6240
if file_list != "":
6341
for file in file_list:
@@ -99,7 +77,7 @@ def check_input_license_format(input_license):
9977
if input_license.startswith('LicenseRef-'):
10078
return input_license
10179

102-
licensesfromJson = get_licenses_from_json()
80+
licensesfromJson = get_license_from_nick()
10381
if licensesfromJson == "":
10482
dump_error_msg(" Error - Return Value to get license from Json is none")
10583

src/fosslight_prechecker/resources/convert_license.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)