fosslight-dependency 3.15.5__py3-none-any.whl → 3.15.6__py3-none-any.whl
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/_graph_convertor.py +68 -0
- fosslight_dependency/_help.py +4 -0
- fosslight_dependency/package_manager/Cocoapods.py +1 -1
- fosslight_dependency/run_dependency_scanner.py +22 -2
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/METADATA +4 -2
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/RECORD +13 -12
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/WHEEL +1 -1
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/Apache-2.0.txt +0 -0
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/LICENSE +0 -0
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/LicenseRef-3rd_party_licenses.txt +0 -0
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/MIT.txt +0 -0
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/entry_points.txt +0 -0
- {fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# Copyright (c) 2021 LG Electronics Inc.
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
5
|
+
from typing import Optional, Tuple
|
6
|
+
import igraph as ig
|
7
|
+
import matplotlib.pyplot as plt
|
8
|
+
|
9
|
+
|
10
|
+
class GraphConvertor:
|
11
|
+
def __init__(self, package_list: Optional[list] = None):
|
12
|
+
self._verticies = {}
|
13
|
+
self._edges = []
|
14
|
+
if package_list:
|
15
|
+
self.init_list(package_list)
|
16
|
+
|
17
|
+
def init_list(self, package_list: list):
|
18
|
+
"""
|
19
|
+
Initialize package_list to self._verticies and self._edges
|
20
|
+
|
21
|
+
Args:
|
22
|
+
package_list (list): List containing package information
|
23
|
+
"""
|
24
|
+
depend_on_package_dict = {}
|
25
|
+
for idx, package_info in enumerate(package_list):
|
26
|
+
package_name = package_info[0]
|
27
|
+
depend_on_packages_str = package_info[-1]
|
28
|
+
depend_on_packages = list(map((lambda x: x.strip()), depend_on_packages_str.split(",")))
|
29
|
+
self._verticies[package_name] = idx
|
30
|
+
depend_on_package_dict[package_name] = depend_on_packages
|
31
|
+
else:
|
32
|
+
for package_name, depend_on_packages in depend_on_package_dict.items():
|
33
|
+
if not package_name:
|
34
|
+
pass
|
35
|
+
else:
|
36
|
+
package_idx = self._verticies[package_name]
|
37
|
+
for depend_on_package in depend_on_packages:
|
38
|
+
if not depend_on_package:
|
39
|
+
pass
|
40
|
+
else:
|
41
|
+
depend_on_package_idx = self._verticies[depend_on_package]
|
42
|
+
self._edges.append((package_idx, depend_on_package_idx))
|
43
|
+
|
44
|
+
def save(self, path: str, size: Tuple[(int, int)]):
|
45
|
+
g = ig.Graph((len(self._verticies)), (self._edges), directed=True)
|
46
|
+
|
47
|
+
g["title"] = "Dependency Graph"
|
48
|
+
g.vs["name"] = list(self._verticies.keys())
|
49
|
+
|
50
|
+
fig, ax = plt.subplots(figsize=(tuple(map((lambda x: x / 100), size))))
|
51
|
+
fig.tight_layout()
|
52
|
+
|
53
|
+
ig.plot(
|
54
|
+
g,
|
55
|
+
target=ax,
|
56
|
+
layout="kk",
|
57
|
+
vertex_size=15,
|
58
|
+
vertex_color=["#FFD2D2"],
|
59
|
+
vertex_label=(g.vs["name"]),
|
60
|
+
vertex_label_dist=1.5,
|
61
|
+
vertex_label_size=7.0,
|
62
|
+
edge_width=0.5,
|
63
|
+
edge_color=["#FFD2D2"],
|
64
|
+
edge_arrow_size=5,
|
65
|
+
edge_arrow_width=5,
|
66
|
+
)
|
67
|
+
|
68
|
+
fig.savefig(path)
|
fosslight_dependency/_help.py
CHANGED
@@ -37,6 +37,10 @@ _HELP_MESSAGE_DEPENDENCY = """
|
|
37
37
|
\t\t\t\t\t(If you want to generate the specific file name, add the output path with file name.)
|
38
38
|
-f <format> [<format> ...]\t Output formats (excel, csv, opossum, yaml, spdx-tag, spdx-yaml, spdx-json, spdx-xml)
|
39
39
|
\t\t\t\t Multiple formats can be specified separated by space.
|
40
|
+
--graph-path <save_path> \t Enter the path where the graph image will be saved
|
41
|
+
\t\t\t\t\t(ex. /your/directory/path/filename.{pdf, jpg, png}) (recommend pdf extension)
|
42
|
+
--graph-size <width> <height> Enter the size of the graph image (The size unit is pixels)
|
43
|
+
\t\t\t\t\t--graph-path option is required
|
40
44
|
--direct\t\t\t Print the direct/transitive dependency type in comment.
|
41
45
|
\t\tChoice 'True' or 'False'. (default:True)
|
42
46
|
--notice\t\t\t Print the open source license notice text.
|
@@ -128,7 +128,7 @@ class Cocoapods(PackageManager):
|
|
128
128
|
purl = get_url_to_purl(homepage, self.package_manager_name, pod_oss_name_origin, oss_version)
|
129
129
|
self.purl_dict[f'{pod_oss_name_origin}({oss_version})'] = purl
|
130
130
|
if pod_oss_name in external_source_list:
|
131
|
-
homepage =
|
131
|
+
homepage = ''
|
132
132
|
if oss_name == '':
|
133
133
|
continue
|
134
134
|
if pod_oss_version != oss_version:
|
@@ -21,6 +21,7 @@ from fosslight_util.output_format import check_output_formats, write_output_file
|
|
21
21
|
if platform.system() != 'Windows':
|
22
22
|
from fosslight_util.write_spdx import write_spdx
|
23
23
|
from fosslight_util.cover import CoverItem
|
24
|
+
from fosslight_dependency._graph_convertor import GraphConvertor
|
24
25
|
|
25
26
|
# Package Name
|
26
27
|
_PKG_NAME = "fosslight_dependency"
|
@@ -92,7 +93,8 @@ def find_package_manager(input_dir, abs_path_to_exclude=[]):
|
|
92
93
|
|
93
94
|
def run_dependency_scanner(package_manager='', input_dir='', output_dir_file='', pip_activate_cmd='',
|
94
95
|
pip_deactivate_cmd='', output_custom_dir='', app_name=const.default_app_name,
|
95
|
-
github_token='', formats=[], direct=True, path_to_exclude=[]
|
96
|
+
github_token='', formats=[], direct=True, path_to_exclude=[], graph_path='',
|
97
|
+
graph_size=(600, 600)):
|
96
98
|
global logger
|
97
99
|
|
98
100
|
ret = True
|
@@ -233,6 +235,15 @@ def run_dependency_scanner(package_manager='', input_dir='', output_dir_file='',
|
|
233
235
|
if cover_comment:
|
234
236
|
cover.comment += f', {cover_comment}'
|
235
237
|
|
238
|
+
if ret and graph_path:
|
239
|
+
graph_path = os.path.abspath(graph_path)
|
240
|
+
try:
|
241
|
+
converter = GraphConvertor(sheet_list[_sheet_name])
|
242
|
+
converter.save(graph_path, graph_size)
|
243
|
+
logger.info(f"Output graph image file: {graph_path}")
|
244
|
+
except Exception as e:
|
245
|
+
logger.error(f'Fail to make graph image: {e}')
|
246
|
+
|
236
247
|
combined_paths_and_files = [os.path.join(output_path, file) for file in output_files]
|
237
248
|
results = []
|
238
249
|
for i, output_extension in enumerate(output_extensions):
|
@@ -276,6 +287,8 @@ def main():
|
|
276
287
|
app_name = const.default_app_name
|
277
288
|
github_token = ''
|
278
289
|
format = ''
|
290
|
+
graph_path = ''
|
291
|
+
graph_size = (600, 600)
|
279
292
|
direct = True
|
280
293
|
|
281
294
|
parser = argparse.ArgumentParser(add_help=False)
|
@@ -291,6 +304,8 @@ def main():
|
|
291
304
|
parser.add_argument('-n', '--appname', nargs=1, type=str, required=False)
|
292
305
|
parser.add_argument('-t', '--token', nargs=1, type=str, required=False)
|
293
306
|
parser.add_argument('-f', '--format', nargs="*", type=str, required=False)
|
307
|
+
parser.add_argument('--graph-path', nargs=1, type=str, required=False)
|
308
|
+
parser.add_argument('--graph-size', nargs=2, type=int, metavar=("WIDTH", "HEIGHT"), required=False)
|
294
309
|
parser.add_argument('--direct', choices=('true', 'false'), default='True', required=False)
|
295
310
|
parser.add_argument('--notice', action='store_true', required=False)
|
296
311
|
|
@@ -324,6 +339,10 @@ def main():
|
|
324
339
|
github_token = ''.join(args.token)
|
325
340
|
if args.format: # -f option
|
326
341
|
format = list(args.format)
|
342
|
+
if args.graph_path:
|
343
|
+
graph_path = ''.join(args.graph_path)
|
344
|
+
if args.graph_size:
|
345
|
+
graph_size = args.graph_size
|
327
346
|
if args.direct: # --direct option
|
328
347
|
if args.direct == 'true':
|
329
348
|
direct = True
|
@@ -343,7 +362,8 @@ def main():
|
|
343
362
|
sys.exit(0)
|
344
363
|
|
345
364
|
run_dependency_scanner(package_manager, input_dir, output_dir, pip_activate_cmd, pip_deactivate_cmd,
|
346
|
-
output_custom_dir, app_name, github_token, format, direct, path_to_exclude
|
365
|
+
output_custom_dir, app_name, github_token, format, direct, path_to_exclude,
|
366
|
+
graph_path, graph_size)
|
347
367
|
|
348
368
|
|
349
369
|
if __name__ == '__main__':
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fosslight-dependency
|
3
|
-
Version: 3.15.
|
3
|
+
Version: 3.15.6
|
4
4
|
Summary: FOSSLight Dependency Scanner
|
5
5
|
Home-page: https://github.com/fosslight/fosslight_dependency_scanner
|
6
6
|
Author: LG Electronics
|
@@ -20,11 +20,13 @@ Requires-Dist: lxml
|
|
20
20
|
Requires-Dist: virtualenv
|
21
21
|
Requires-Dist: pyyaml
|
22
22
|
Requires-Dist: lastversion
|
23
|
-
Requires-Dist: fosslight-util
|
23
|
+
Requires-Dist: fosslight-util~=1.4.47
|
24
24
|
Requires-Dist: PyGithub
|
25
25
|
Requires-Dist: requirements-parser
|
26
26
|
Requires-Dist: defusedxml
|
27
27
|
Requires-Dist: packageurl-python
|
28
|
+
Requires-Dist: igraph
|
29
|
+
Requires-Dist: matplotlib
|
28
30
|
|
29
31
|
<!--
|
30
32
|
Copyright (c) 2021 LG Electronics
|
@@ -1,14 +1,15 @@
|
|
1
1
|
fosslight_dependency/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
fosslight_dependency/_analyze_dependency.py,sha256=5xR9EQxeI1u57Gp8Tw0YEhCc6T7kckTJ60h40mLGsEU,4010
|
3
|
-
fosslight_dependency/
|
3
|
+
fosslight_dependency/_graph_convertor.py,sha256=jbbPOuINAkv6Gwr2BQU3gDAK8UBCB_R_0H5n7WjOjKo,2399
|
4
|
+
fosslight_dependency/_help.py,sha256=EG-ojJ3Fyn3iYrd_4mGtyMLMefOqf7_AF21q3-jf2Y8,3258
|
4
5
|
fosslight_dependency/_package_manager.py,sha256=YM-jFwRpHxjUScbefBQYn16DVPLNzGi8h3HL3oT56cM,17614
|
5
6
|
fosslight_dependency/constant.py,sha256=1mJGu1SYyxVKo0W_pCIt-ANp52E_I5ovXFvpl2OMmjU,1039
|
6
|
-
fosslight_dependency/run_dependency_scanner.py,sha256=
|
7
|
+
fosslight_dependency/run_dependency_scanner.py,sha256=fAaGV8e62nQmdkbDras27TQ6goq0rx0bAozmPqxaC5I,16140
|
7
8
|
fosslight_dependency/LICENSES/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
8
9
|
fosslight_dependency/LICENSES/LicenseRef-3rd_party_licenses.txt,sha256=EcsFt7aE1rp3OXAdJgmXayfOZdpRdBMcmRnyoqWMCsw,95687
|
9
10
|
fosslight_dependency/package_manager/Android.py,sha256=9vO3JDRAV2-ZGfjk4sGSqY05nszulwGwehvf7saNIMY,3178
|
10
11
|
fosslight_dependency/package_manager/Carthage.py,sha256=OZL0ssKvN6pze0VohZ-kMeM-g-V7f5VqumpEh3o3t-U,6106
|
11
|
-
fosslight_dependency/package_manager/Cocoapods.py,sha256=
|
12
|
+
fosslight_dependency/package_manager/Cocoapods.py,sha256=dfXwillepl5LSST2P8q_IgorKW8weza1EKZWbe3tbUE,8333
|
12
13
|
fosslight_dependency/package_manager/Go.py,sha256=pbhYWs6ZsU77m0LIobx0pGXbF9c19fADyTG8ZoDJkWI,6272
|
13
14
|
fosslight_dependency/package_manager/Gradle.py,sha256=EQAGF_ohu2uB1uqk3itdO9vGhS5nKyPlomlbwbcVvYE,4203
|
14
15
|
fosslight_dependency/package_manager/Helm.py,sha256=FjzQilY3GJyX8thwMGY_Rr12kw-dbehxVk6jIJNb2-M,4024
|
@@ -23,12 +24,12 @@ fosslight_dependency/package_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
23
24
|
fosslight_dependency/third_party/askalono/askalono.exe,sha256=NyngElHbrg3zLFRVwn6fPDZE_EDAEb1N8tiwWoCm4pQ,4743680
|
24
25
|
fosslight_dependency/third_party/askalono/askalono_macos,sha256=cYSNXhAQpkdd8lkgnY5skNeDmU_8DIuP84eFi0OXKkE,5589868
|
25
26
|
fosslight_dependency/third_party/nomos/nomossa,sha256=oFF9I-fhug6AVNyFnWeVXwDRin6NWSvk1g7mHBotB3Q,866408
|
26
|
-
fosslight_dependency-3.15.
|
27
|
-
fosslight_dependency-3.15.
|
28
|
-
fosslight_dependency-3.15.
|
29
|
-
fosslight_dependency-3.15.
|
30
|
-
fosslight_dependency-3.15.
|
31
|
-
fosslight_dependency-3.15.
|
32
|
-
fosslight_dependency-3.15.
|
33
|
-
fosslight_dependency-3.15.
|
34
|
-
fosslight_dependency-3.15.
|
27
|
+
fosslight_dependency-3.15.6.dist-info/Apache-2.0.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
28
|
+
fosslight_dependency-3.15.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
29
|
+
fosslight_dependency-3.15.6.dist-info/LicenseRef-3rd_party_licenses.txt,sha256=EcsFt7aE1rp3OXAdJgmXayfOZdpRdBMcmRnyoqWMCsw,95687
|
30
|
+
fosslight_dependency-3.15.6.dist-info/METADATA,sha256=UMEQtl1y8gxN5HWTF3g4RJYaEk7hTjrwU9n6UX-l5ko,4846
|
31
|
+
fosslight_dependency-3.15.6.dist-info/MIT.txt,sha256=9cx4CbArgByWvkoEZNqpzbpJgA9TUe2D62rMocQpgfs,1082
|
32
|
+
fosslight_dependency-3.15.6.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
33
|
+
fosslight_dependency-3.15.6.dist-info/entry_points.txt,sha256=e1QZbnCrQvfbwe9L6PxXnkRZMhl-PSo0QyUes0dGjU8,91
|
34
|
+
fosslight_dependency-3.15.6.dist-info/top_level.txt,sha256=Jc0V7VcVCH0TEM8ksb8dwroTYz4AmRaQnlr3FB71Hcs,21
|
35
|
+
fosslight_dependency-3.15.6.dist-info/RECORD,,
|
{fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/Apache-2.0.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/entry_points.txt
RENAMED
File without changes
|
{fosslight_dependency-3.15.5.dist-info → fosslight_dependency-3.15.6.dist-info}/top_level.txt
RENAMED
File without changes
|