fosslight-dependency 4.1.7__tar.gz → 4.1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/PKG-INFO +3 -3
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/setup.py +5 -8
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/_package_manager.py +21 -95
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Carthage.py +4 -6
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Nuget.py +6 -10
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Pub.py +2 -5
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Pypi.py +3 -8
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Swift.py +1 -1
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Unity.py +3 -6
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/run_dependency_scanner.py +51 -30
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency.egg-info/PKG-INFO +3 -3
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/LICENSE +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/LICENSES/Apache-2.0.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/LICENSES/LicenseRef-3rd_party_licenses.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/LICENSES/MIT.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/MANIFEST.in +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/README.md +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/requirements.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/setup.cfg +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/__init__.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/_analyze_dependency.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/_graph_convertor.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/_help.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/constant.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/dependency_item.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Android.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Cargo.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Cocoapods.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Go.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Gradle.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Helm.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Maven.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/Npm.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/package_manager/__init__.py +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency.egg-info/SOURCES.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency.egg-info/dependency_links.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency.egg-info/entry_points.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency.egg-info/requires.txt +0 -0
- {fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fosslight_dependency
|
3
|
-
Version: 4.1.
|
3
|
+
Version: 4.1.8
|
4
4
|
Summary: FOSSLight Dependency Scanner
|
5
5
|
Home-page: https://github.com/fosslight/fosslight_dependency_scanner
|
6
6
|
Author: LG Electronics
|
@@ -164,8 +164,8 @@ Description: <!--
|
|
164
164
|
Platform: UNKNOWN
|
165
165
|
Classifier: License :: OSI Approved :: Apache Software License
|
166
166
|
Classifier: Programming Language :: Python :: 3
|
167
|
-
Classifier: Programming Language :: Python :: 3.6
|
168
|
-
Classifier: Programming Language :: Python :: 3.7
|
169
167
|
Classifier: Programming Language :: Python :: 3.8
|
170
168
|
Classifier: Programming Language :: Python :: 3.9
|
169
|
+
Classifier: Programming Language :: Python :: 3.10
|
170
|
+
Classifier: Programming Language :: Python :: 3.11
|
171
171
|
Description-Content-Type: text/markdown
|
@@ -35,7 +35,7 @@ if __name__ == "__main__":
|
|
35
35
|
|
36
36
|
setup(
|
37
37
|
name=_PACKAEG_NAME,
|
38
|
-
version='4.1.
|
38
|
+
version='4.1.8',
|
39
39
|
package_dir={"": "src"},
|
40
40
|
packages=find_namespace_packages(where='src'),
|
41
41
|
description='FOSSLight Dependency Scanner',
|
@@ -47,15 +47,12 @@ if __name__ == "__main__":
|
|
47
47
|
download_url='https://github.com/fosslight/fosslight_dependency_scanner',
|
48
48
|
classifiers=['License :: OSI Approved :: Apache Software License',
|
49
49
|
"Programming Language :: Python :: 3",
|
50
|
-
"Programming Language :: Python :: 3.6",
|
51
|
-
"Programming Language :: Python :: 3.7",
|
52
50
|
"Programming Language :: Python :: 3.8",
|
53
|
-
"Programming Language :: Python :: 3.9",
|
51
|
+
"Programming Language :: Python :: 3.9",
|
52
|
+
"Programming Language :: Python :: 3.10",
|
53
|
+
"Programming Language :: Python :: 3.11", ],
|
54
54
|
install_requires=required,
|
55
|
-
package_data={_PACKAEG_NAME: [os.path.join(
|
56
|
-
os.path.join('third_party', 'askalono', 'askalono.exe'),
|
57
|
-
os.path.join('third_party', 'askalono', 'askalono_macos'),
|
58
|
-
os.path.join(_LICENSE_DIR, '*')]},
|
55
|
+
package_data={_PACKAEG_NAME: [os.path.join(_LICENSE_DIR, '*')]},
|
59
56
|
include_package_data=True,
|
60
57
|
entry_points={
|
61
58
|
"console_scripts": [
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
5
5
|
|
6
6
|
import os
|
7
|
-
import sys
|
8
7
|
import logging
|
9
8
|
import platform
|
10
9
|
import re
|
@@ -12,9 +11,10 @@ import base64
|
|
12
11
|
import subprocess
|
13
12
|
import shutil
|
14
13
|
import stat
|
14
|
+
from packageurl.contrib import url2purl
|
15
|
+
from askalono import identify
|
15
16
|
import fosslight_util.constant as constant
|
16
17
|
import fosslight_dependency.constant as const
|
17
|
-
from packageurl.contrib import url2purl
|
18
18
|
|
19
19
|
try:
|
20
20
|
from github import Github
|
@@ -23,13 +23,9 @@ except Exception:
|
|
23
23
|
|
24
24
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
25
25
|
|
26
|
-
# binary url to check license text
|
27
|
-
_license_scanner_linux = os.path.join('third_party', 'nomos', 'nomossa')
|
28
|
-
_license_scanner_macos = os.path.join('third_party', 'askalono', 'askalono_macos')
|
29
|
-
_license_scanner_windows = os.path.join('third_party', 'askalono', 'askalono.exe')
|
30
|
-
|
31
26
|
gradle_config = ['runtimeClasspath', 'runtime']
|
32
27
|
android_config = ['releaseRuntimeClasspath']
|
28
|
+
ASKALONO_THRESHOLD = 0.7
|
33
29
|
|
34
30
|
|
35
31
|
class PackageManager:
|
@@ -54,7 +50,6 @@ class PackageManager:
|
|
54
50
|
self.dep_items = []
|
55
51
|
|
56
52
|
self.platform = platform.system()
|
57
|
-
self.license_scanner_bin = check_license_scanner(self.platform)
|
58
53
|
|
59
54
|
def __del__(self):
|
60
55
|
self.input_package_list_file = []
|
@@ -113,7 +108,7 @@ class PackageManager:
|
|
113
108
|
cmd_gradle = "./gradlew"
|
114
109
|
else:
|
115
110
|
ret_task = False
|
116
|
-
logger.warning('No gradlew file exists
|
111
|
+
logger.warning('No gradlew file exists (Skip to find dependencies relationship.).')
|
117
112
|
if ret_plugin:
|
118
113
|
logger.warning('Also it cannot run android-dependency-scanning plugin.')
|
119
114
|
if ret_task:
|
@@ -126,11 +121,10 @@ class PackageManager:
|
|
126
121
|
self.parse_dependency_tree(ret)
|
127
122
|
else:
|
128
123
|
self.set_direct_dependencies(False)
|
129
|
-
logger.warning("
|
124
|
+
logger.warning(f"Fail to run {cmd}")
|
130
125
|
except Exception as e:
|
131
126
|
self.set_direct_dependencies(False)
|
132
|
-
logger.
|
133
|
-
logger.warning('It cannot print the direct/transitive dependencies relationship.')
|
127
|
+
logger.warning(f"Cannot print 'depends on' information. (fail {cmd}: {e})")
|
134
128
|
|
135
129
|
if ret_plugin:
|
136
130
|
cmd = f"{cmd_gradle} generateLicenseTxt"
|
@@ -157,6 +151,9 @@ class PackageManager:
|
|
157
151
|
if os.path.isfile(module_gradle_backup):
|
158
152
|
os.remove(module_build_gradle)
|
159
153
|
shutil.move(module_gradle_backup, module_build_gradle)
|
154
|
+
if os.path.isfile(self.input_file_name):
|
155
|
+
logger.info(f'Found {self.input_file_name}, skip to run plugin.')
|
156
|
+
ret_task = True
|
160
157
|
return ret_task
|
161
158
|
|
162
159
|
def add_android_plugin_in_gradle(self, module_build_gradle):
|
@@ -316,9 +313,8 @@ def connect_github(github_token):
|
|
316
313
|
return g
|
317
314
|
|
318
315
|
|
319
|
-
def get_github_license(g, github_repo
|
316
|
+
def get_github_license(g, github_repo):
|
320
317
|
license_name = ''
|
321
|
-
tmp_license_txt_file_name = 'tmp_license.txt'
|
322
318
|
|
323
319
|
try:
|
324
320
|
repository = g.get_repo(github_repo)
|
@@ -334,96 +330,26 @@ def get_github_license(g, github_repo, platform, license_scanner_bin):
|
|
334
330
|
if license_name == "" or license_name == "NOASSERTION":
|
335
331
|
try:
|
336
332
|
license_txt_data = base64.b64decode(repository.get_license().content).decode('utf-8')
|
337
|
-
|
338
|
-
tmp_license_txt.write(license_txt_data)
|
339
|
-
tmp_license_txt.close()
|
340
|
-
license_name = check_and_run_license_scanner(platform, license_scanner_bin, tmp_license_txt_file_name)
|
333
|
+
license_name = check_license_name(license_txt_data)
|
341
334
|
except Exception:
|
342
|
-
logger.info("Cannot find the license name with
|
343
|
-
|
344
|
-
if os.path.isfile(tmp_license_txt_file_name):
|
345
|
-
os.remove(tmp_license_txt_file_name)
|
335
|
+
logger.info("Cannot find the license name with askalono.")
|
346
336
|
except Exception:
|
347
337
|
logger.info("Cannot find the license name with github api.")
|
348
338
|
|
349
339
|
return license_name
|
350
340
|
|
351
341
|
|
352
|
-
def
|
353
|
-
license_scanner_bin = ''
|
354
|
-
|
355
|
-
if platform == const.LINUX:
|
356
|
-
license_scanner = _license_scanner_linux
|
357
|
-
elif platform == const.MACOS:
|
358
|
-
license_scanner = _license_scanner_macos
|
359
|
-
elif platform == const.WINDOWS:
|
360
|
-
license_scanner = _license_scanner_windows
|
361
|
-
else:
|
362
|
-
logger.debug("Not supported OS to analyze license text with binary.")
|
363
|
-
|
364
|
-
if license_scanner:
|
365
|
-
try:
|
366
|
-
base_path = sys._MEIPASS
|
367
|
-
except Exception:
|
368
|
-
base_path = os.path.dirname(__file__)
|
369
|
-
|
370
|
-
data_path = os.path.join(base_path, license_scanner)
|
371
|
-
license_scanner_bin = data_path
|
372
|
-
|
373
|
-
return license_scanner_bin
|
374
|
-
|
375
|
-
|
376
|
-
def check_and_run_license_scanner(platform, license_scanner_bin, file_dir):
|
342
|
+
def check_license_name(license_txt, is_filepath=False):
|
377
343
|
license_name = ''
|
344
|
+
if is_filepath:
|
345
|
+
with open(license_txt, 'r', encoding='utf-8') as f:
|
346
|
+
license_content = f.read()
|
347
|
+
else:
|
348
|
+
license_content = license_txt
|
378
349
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
try:
|
383
|
-
tmp_output_file_name = "tmp_license_scanner_output.txt"
|
384
|
-
|
385
|
-
if file_dir == "UNKNOWN":
|
386
|
-
license_name = ""
|
387
|
-
else:
|
388
|
-
if platform == const.LINUX:
|
389
|
-
run_license_scanner = f"{license_scanner_bin} {file_dir} > {tmp_output_file_name}"
|
390
|
-
elif platform == const.MACOS:
|
391
|
-
run_license_scanner = f"{license_scanner_bin} identify {file_dir} > {tmp_output_file_name}"
|
392
|
-
elif platform == const.WINDOWS:
|
393
|
-
run_license_scanner = f"{license_scanner_bin} identify {file_dir} > {tmp_output_file_name}"
|
394
|
-
else:
|
395
|
-
run_license_scanner = ''
|
396
|
-
|
397
|
-
if run_license_scanner is None:
|
398
|
-
license_name = ""
|
399
|
-
return license_name
|
400
|
-
else:
|
401
|
-
ret = subprocess.run(run_license_scanner, shell=True, stderr=subprocess.PIPE)
|
402
|
-
if ret.returncode != 0 or ret.stderr:
|
403
|
-
os.remove(tmp_output_file_name)
|
404
|
-
return ""
|
405
|
-
|
406
|
-
fp = open(tmp_output_file_name, "r", encoding='utf8')
|
407
|
-
license_output = fp.read()
|
408
|
-
fp.close()
|
409
|
-
|
410
|
-
if platform == const.LINUX:
|
411
|
-
license_output_re = re.findall(r'.*contains license\(s\)\s(.*)', license_output)
|
412
|
-
else:
|
413
|
-
license_output_re = re.findall(r"License:\s{1}(\S*)\s{1}", license_output)
|
414
|
-
|
415
|
-
if len(license_output_re) == 1:
|
416
|
-
license_name = license_output_re[0]
|
417
|
-
if license_name == "No_license_found":
|
418
|
-
license_name = ""
|
419
|
-
else:
|
420
|
-
license_name = ""
|
421
|
-
os.remove(tmp_output_file_name)
|
422
|
-
|
423
|
-
except Exception as ex:
|
424
|
-
logger.error(f"Failed to run license scan binary. {ex}")
|
425
|
-
license_name = ""
|
426
|
-
|
350
|
+
detect_askalono = identify(license_content)
|
351
|
+
if detect_askalono.score > ASKALONO_THRESHOLD:
|
352
|
+
license_name = detect_askalono.name
|
427
353
|
return license_name
|
428
354
|
|
429
355
|
|
@@ -9,8 +9,8 @@ import os
|
|
9
9
|
import fosslight_util.constant as constant
|
10
10
|
import fosslight_dependency.constant as const
|
11
11
|
from fosslight_dependency._package_manager import PackageManager
|
12
|
-
from fosslight_dependency._package_manager import connect_github, get_github_license
|
13
|
-
from fosslight_dependency._package_manager import get_url_to_purl
|
12
|
+
from fosslight_dependency._package_manager import connect_github, get_github_license
|
13
|
+
from fosslight_dependency._package_manager import get_url_to_purl, check_license_name
|
14
14
|
from fosslight_dependency.dependency_item import DependencyItem
|
15
15
|
from fosslight_util.oss_item import OssItem
|
16
16
|
|
@@ -79,9 +79,7 @@ class Carthage(PackageManager):
|
|
79
79
|
for license_file_reg in license_file_regs:
|
80
80
|
match_result = re.match(license_file_reg, filename_in_dir.lower())
|
81
81
|
if match_result is not None:
|
82
|
-
license_name =
|
83
|
-
self.license_scanner_bin,
|
84
|
-
filename_with_checkout_path)
|
82
|
+
license_name = check_license_name(filename_with_checkout_path, True)
|
85
83
|
find_license = True
|
86
84
|
break
|
87
85
|
if license_name == '':
|
@@ -89,7 +87,7 @@ class Carthage(PackageManager):
|
|
89
87
|
try:
|
90
88
|
if not g:
|
91
89
|
g = connect_github(self.github_token)
|
92
|
-
license_name = get_github_license(g, oss_path
|
90
|
+
license_name = get_github_license(g, oss_path)
|
93
91
|
except Exception as e:
|
94
92
|
logger.warning(f"Failed to get license with github api: {e}")
|
95
93
|
license_name == ''
|
@@ -12,7 +12,7 @@ import requests
|
|
12
12
|
import fosslight_util.constant as constant
|
13
13
|
import fosslight_dependency.constant as const
|
14
14
|
from fosslight_dependency._package_manager import PackageManager
|
15
|
-
from fosslight_dependency._package_manager import
|
15
|
+
from fosslight_dependency._package_manager import check_license_name, get_url_to_purl
|
16
16
|
from fosslight_dependency.dependency_item import DependencyItem, change_dependson_to_purl
|
17
17
|
from fosslight_util.oss_item import OssItem
|
18
18
|
|
@@ -54,7 +54,8 @@ class Nuget(PackageManager):
|
|
54
54
|
oss_item.version = oss_version
|
55
55
|
|
56
56
|
license_name = ''
|
57
|
-
response = requests.get(f'{self.nuget_api_url}{oss_origin_name
|
57
|
+
response = requests.get(f'{self.nuget_api_url.lower()}{oss_origin_name.lower()}/ \
|
58
|
+
{oss_item.version.lower()}/{oss_origin_name.lower()}.nuspec')
|
58
59
|
if response.status_code == 200:
|
59
60
|
root = fromstring(response.text)
|
60
61
|
xmlns = ''
|
@@ -73,14 +74,9 @@ class Nuget(PackageManager):
|
|
73
74
|
if license_url is not None:
|
74
75
|
url_res = requests.get(license_url.text)
|
75
76
|
if url_res.status_code == 200:
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
license_name_with_license_scanner = check_and_run_license_scanner(self.platform,
|
80
|
-
self.license_scanner_bin,
|
81
|
-
tmp_license_txt_file_name)
|
82
|
-
if license_name_with_license_scanner != "":
|
83
|
-
license_name = license_name_with_license_scanner
|
77
|
+
license_name_with_scanner = check_license_name(url_res.text)
|
78
|
+
if license_name_with_scanner != "":
|
79
|
+
license_name = license_name_with_scanner
|
84
80
|
else:
|
85
81
|
license_name = license_url.text
|
86
82
|
oss_item.license = license_name
|
@@ -10,11 +10,10 @@ import re
|
|
10
10
|
import shutil
|
11
11
|
import yaml
|
12
12
|
import subprocess
|
13
|
-
from askalono import identify
|
14
13
|
import fosslight_util.constant as constant
|
15
14
|
import fosslight_dependency.constant as const
|
16
15
|
from fosslight_dependency._package_manager import PackageManager
|
17
|
-
from fosslight_dependency._package_manager import get_url_to_purl
|
16
|
+
from fosslight_dependency._package_manager import get_url_to_purl, check_license_name
|
18
17
|
from fosslight_dependency.dependency_item import DependencyItem, change_dependson_to_purl
|
19
18
|
from fosslight_util.oss_item import OssItem
|
20
19
|
|
@@ -135,9 +134,7 @@ class Pub(PackageManager):
|
|
135
134
|
purl_dict[f'{oss_origin_name}({oss_item.version})'] = dep_item.purl
|
136
135
|
license_txt = json_data['license']
|
137
136
|
if license_txt is not None:
|
138
|
-
|
139
|
-
if detect_askalono.score > 0.7:
|
140
|
-
oss_item.license = detect_askalono.name
|
137
|
+
oss_item.license = check_license_name(license_txt)
|
141
138
|
|
142
139
|
if self.direct_dep:
|
143
140
|
if oss_origin_name not in self.total_dep_list:
|
@@ -13,7 +13,7 @@ import re
|
|
13
13
|
import fosslight_util.constant as constant
|
14
14
|
import fosslight_dependency.constant as const
|
15
15
|
from fosslight_dependency._package_manager import PackageManager
|
16
|
-
from fosslight_dependency._package_manager import
|
16
|
+
from fosslight_dependency._package_manager import check_license_name, get_url_to_purl
|
17
17
|
from fosslight_dependency.dependency_item import DependencyItem, change_dependson_to_purl
|
18
18
|
from fosslight_util.oss_item import OssItem
|
19
19
|
|
@@ -111,7 +111,7 @@ class Pypi(PackageManager):
|
|
111
111
|
install_cmd = cmd_separator.join(install_cmd_list)
|
112
112
|
else:
|
113
113
|
logger.error(const.SUPPORT_PACKAE[self.package_manager_name])
|
114
|
-
logger.error('Cannot create virtualenv
|
114
|
+
logger.error('Cannot create virtualenv because it cannot find: '
|
115
115
|
+ ', '.join(const.SUPPORT_PACKAE[self.package_manager_name]))
|
116
116
|
logger.error("Please run with '-a' and '-d' option.")
|
117
117
|
return False
|
@@ -302,12 +302,7 @@ class Pypi(PackageManager):
|
|
302
302
|
if license_name is not None:
|
303
303
|
license_name = license_name.replace(';', ',')
|
304
304
|
else:
|
305
|
-
|
306
|
-
license_name_with_lic_scanner = check_and_run_license_scanner(self.platform,
|
307
|
-
self.license_scanner_bin,
|
308
|
-
license_file_dir)
|
309
|
-
if license_name_with_lic_scanner != "":
|
310
|
-
license_name = license_name_with_lic_scanner
|
305
|
+
license_name = check_license_name(d['LicenseFile'], True)
|
311
306
|
oss_item.license = license_name
|
312
307
|
|
313
308
|
if oss_init_name == self.package_name:
|
@@ -140,7 +140,7 @@ class Swift(PackageManager):
|
|
140
140
|
github_repo = "/".join(oss_item.homepage.split('/')[-2:])
|
141
141
|
dep_item.purl = get_url_to_purl(oss_item.download_location, self.package_manager_name, github_repo, oss_item.version)
|
142
142
|
purl_dict[f'{oss_origin_name}({oss_item.version})'] = dep_item.purl
|
143
|
-
oss_item.license = get_github_license(g, github_repo
|
143
|
+
oss_item.license = get_github_license(g, github_repo)
|
144
144
|
|
145
145
|
if self.direct_dep and len(self.direct_dep_list) > 0:
|
146
146
|
if oss_origin_name in self.direct_dep_list:
|
@@ -11,13 +11,12 @@ import requests
|
|
11
11
|
import fosslight_util.constant as constant
|
12
12
|
import fosslight_dependency.constant as const
|
13
13
|
from fosslight_dependency._package_manager import PackageManager
|
14
|
-
from fosslight_dependency._package_manager import
|
14
|
+
from fosslight_dependency._package_manager import check_license_name, get_url_to_purl
|
15
15
|
from fosslight_dependency.dependency_item import DependencyItem
|
16
16
|
from fosslight_util.oss_item import OssItem
|
17
17
|
|
18
18
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
19
19
|
proprietary_license = 'Proprietary License'
|
20
|
-
unclassifed_license = 'UnclassifiedLicense'
|
21
20
|
license_md = 'LICENSE.md'
|
22
21
|
third_party_md = 'Third Party Notices.md'
|
23
22
|
|
@@ -50,10 +49,8 @@ class Unity(PackageManager):
|
|
50
49
|
oss_packagecache_dir = os.path.join(self.packageCache_dir, f'{oss_item.name}@{oss_item.version}')
|
51
50
|
license_f = os.path.join(oss_packagecache_dir, license_md)
|
52
51
|
if os.path.isfile(license_f):
|
53
|
-
license_name =
|
54
|
-
|
55
|
-
license_f)
|
56
|
-
if license_name == unclassifed_license or license_name == '':
|
52
|
+
license_name = check_license_name(license_f, True)
|
53
|
+
if license_name == '':
|
57
54
|
with open(license_f, 'r', encoding='utf-8') as f:
|
58
55
|
for line in f:
|
59
56
|
matched_l = re.search(r'Unity\s[\s\w]*\sLicense', line)
|
@@ -51,17 +51,17 @@ def paginate_file(file_path):
|
|
51
51
|
input("Press Enter to see the next page...")
|
52
52
|
|
53
53
|
|
54
|
-
def find_package_manager(input_dir, abs_path_to_exclude=[]):
|
54
|
+
def find_package_manager(input_dir, abs_path_to_exclude=[], manifest_file_name=[]):
|
55
55
|
ret = True
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
if not manifest_file_name:
|
57
|
+
for value in const.SUPPORT_PACKAE.values():
|
58
|
+
if isinstance(value, list):
|
59
|
+
manifest_file_name.extend(value)
|
60
|
+
else:
|
61
|
+
manifest_file_name.append(value)
|
62
62
|
|
63
63
|
found_manifest_file = []
|
64
|
-
for
|
64
|
+
for parent, dirs, files in os.walk(input_dir):
|
65
65
|
if len(files) < 1:
|
66
66
|
continue
|
67
67
|
if os.path.basename(parent) in _exclude_dir:
|
@@ -76,6 +76,13 @@ def find_package_manager(input_dir, abs_path_to_exclude=[]):
|
|
76
76
|
continue
|
77
77
|
if file in manifest_file_name:
|
78
78
|
found_manifest_file.append(file)
|
79
|
+
for dir in dirs:
|
80
|
+
for manifest_f in manifest_file_name:
|
81
|
+
manifest_l = manifest_f.split(os.path.sep)
|
82
|
+
if len(manifest_l) > 1:
|
83
|
+
if manifest_l[0] == dir:
|
84
|
+
if os.path.exists(os.path.join(parent, manifest_f)):
|
85
|
+
found_manifest_file.append(manifest_f)
|
79
86
|
if len(found_manifest_file) > 0:
|
80
87
|
input_dir = parent
|
81
88
|
break
|
@@ -99,7 +106,7 @@ def find_package_manager(input_dir, abs_path_to_exclude=[]):
|
|
99
106
|
logger.warning(f"### Set Package Manager = {', '.join(found_package_manager.keys())}")
|
100
107
|
else:
|
101
108
|
ret = False
|
102
|
-
logger.info("
|
109
|
+
logger.info("Cannot find the manifest file.")
|
103
110
|
|
104
111
|
return ret, found_package_manager, input_dir
|
105
112
|
|
@@ -168,17 +175,6 @@ def run_dependency_scanner(package_manager='', input_dir='', output_dir_file='',
|
|
168
175
|
logger.error(msg)
|
169
176
|
return False, scan_item
|
170
177
|
|
171
|
-
autodetect = True
|
172
|
-
if package_manager:
|
173
|
-
autodetect = False
|
174
|
-
support_packagemanager = list(const.SUPPORT_PACKAE.keys())
|
175
|
-
|
176
|
-
if package_manager not in support_packagemanager:
|
177
|
-
logger.error(f"(-m option) You entered the unsupported package manager({package_manager}).")
|
178
|
-
logger.error("Please enter the supported package manager({0}) with '-m' option."
|
179
|
-
.format(", ".join(support_packagemanager)))
|
180
|
-
return False, scan_item
|
181
|
-
|
182
178
|
if input_dir:
|
183
179
|
if os.path.isdir(input_dir):
|
184
180
|
os.chdir(input_dir)
|
@@ -192,20 +188,44 @@ def run_dependency_scanner(package_manager='', input_dir='', output_dir_file='',
|
|
192
188
|
os.chdir(input_dir)
|
193
189
|
scan_item.set_cover_pathinfo(input_dir, path_to_exclude)
|
194
190
|
|
191
|
+
autodetect = True
|
195
192
|
found_package_manager = {}
|
196
|
-
if
|
197
|
-
|
198
|
-
|
193
|
+
if package_manager:
|
194
|
+
autodetect = False
|
195
|
+
support_packagemanager = list(const.SUPPORT_PACKAE.keys())
|
196
|
+
|
197
|
+
if package_manager not in support_packagemanager:
|
198
|
+
logger.error(f"(-m option) You entered the unsupported package manager({package_manager}).")
|
199
|
+
logger.error("Please enter the supported package manager({0}) with '-m' option."
|
200
|
+
.format(", ".join(support_packagemanager)))
|
201
|
+
return False, scan_item
|
202
|
+
manifest_file_name = []
|
203
|
+
value = const.SUPPORT_PACKAE[package_manager]
|
204
|
+
if isinstance(value, list):
|
205
|
+
manifest_file_name.extend(value)
|
206
|
+
else:
|
207
|
+
manifest_file_name.append(value)
|
208
|
+
scan_item.set_cover_comment(f"Manual detect mode (-m {package_manager})")
|
209
|
+
else:
|
210
|
+
manifest_file_name = []
|
211
|
+
|
212
|
+
try:
|
213
|
+
ret, found_package_manager, input_dir = find_package_manager(input_dir, abs_path_to_exclude, manifest_file_name)
|
214
|
+
if ret:
|
199
215
|
os.chdir(input_dir)
|
200
|
-
|
216
|
+
except Exception as e:
|
217
|
+
if autodetect:
|
201
218
|
logger.error(f'Fail to find package manager: {e}')
|
202
219
|
ret = False
|
203
|
-
|
204
|
-
|
205
|
-
|
220
|
+
finally:
|
221
|
+
if not ret:
|
222
|
+
if not autodetect:
|
223
|
+
logger.info('Try to analyze dependency without manifest file. (Manual mode)')
|
224
|
+
found_package_manager[package_manager] = []
|
225
|
+
else:
|
226
|
+
logger.error("Terminated: package manager could not be found.")
|
206
227
|
ret = False
|
207
|
-
|
208
|
-
found_package_manager[package_manager] = ["manual detect ('-m option')"]
|
228
|
+
return False, scan_item
|
209
229
|
|
210
230
|
pass_key = 'PASS'
|
211
231
|
success_pm = []
|
@@ -242,7 +262,8 @@ def run_dependency_scanner(package_manager='', input_dir='', output_dir_file='',
|
|
242
262
|
'and https://fosslight.org/fosslight-guide-en/scanner/3_dependency.html#-prerequisite.'
|
243
263
|
scan_item.set_cover_comment(f"Analysis failed Package manager: {', '.join(fail_pm)} ({info_msg})")
|
244
264
|
else:
|
245
|
-
|
265
|
+
if autodetect:
|
266
|
+
scan_item.set_cover_comment("No Package manager detected.")
|
246
267
|
|
247
268
|
if ret and graph_path:
|
248
269
|
graph_path = os.path.abspath(graph_path)
|
{fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fosslight-dependency
|
3
|
-
Version: 4.1.
|
3
|
+
Version: 4.1.8
|
4
4
|
Summary: FOSSLight Dependency Scanner
|
5
5
|
Home-page: https://github.com/fosslight/fosslight_dependency_scanner
|
6
6
|
Author: LG Electronics
|
@@ -164,8 +164,8 @@ Description: <!--
|
|
164
164
|
Platform: UNKNOWN
|
165
165
|
Classifier: License :: OSI Approved :: Apache Software License
|
166
166
|
Classifier: Programming Language :: Python :: 3
|
167
|
-
Classifier: Programming Language :: Python :: 3.6
|
168
|
-
Classifier: Programming Language :: Python :: 3.7
|
169
167
|
Classifier: Programming Language :: Python :: 3.8
|
170
168
|
Classifier: Programming Language :: Python :: 3.9
|
169
|
+
Classifier: Programming Language :: Python :: 3.10
|
170
|
+
Classifier: Programming Language :: Python :: 3.11
|
171
171
|
Description-Content-Type: text/markdown
|
File without changes
|
File without changes
|
{fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/LICENSES/LicenseRef-3rd_party_licenses.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fosslight_dependency-4.1.7 → fosslight_dependency-4.1.8}/src/fosslight_dependency/constant.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|