fosslight-util 2.1.19__py3-none-any.whl → 2.1.21__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_util/_get_downloadable_url.py +4 -0
- fosslight_util/download.py +30 -2
- {fosslight_util-2.1.19.dist-info → fosslight_util-2.1.21.dist-info}/METADATA +9 -17
- {fosslight_util-2.1.19.dist-info → fosslight_util-2.1.21.dist-info}/RECORD +8 -8
- {fosslight_util-2.1.19.dist-info → fosslight_util-2.1.21.dist-info}/entry_points.txt +0 -1
- {fosslight_util-2.1.19.dist-info → fosslight_util-2.1.21.dist-info}/LICENSE +0 -0
- {fosslight_util-2.1.19.dist-info → fosslight_util-2.1.21.dist-info}/WHEEL +0 -0
- {fosslight_util-2.1.19.dist-info → fosslight_util-2.1.21.dist-info}/top_level.txt +0 -0
|
@@ -16,6 +16,7 @@ logger = logging.getLogger(constant.LOGGER_NAME)
|
|
|
16
16
|
def extract_name_version_from_link(link):
|
|
17
17
|
oss_name = ""
|
|
18
18
|
oss_version = ""
|
|
19
|
+
matched = False
|
|
19
20
|
if link.startswith("www."):
|
|
20
21
|
link = link.replace("www.", "https://www.", 1)
|
|
21
22
|
for key, value in constant.PKG_PATTERN.items():
|
|
@@ -55,7 +56,10 @@ def extract_name_version_from_link(link):
|
|
|
55
56
|
if key in ["pypi", "maven", "npm", "npm2", "pub", "go"]:
|
|
56
57
|
oss_version, link = get_latest_package_version(link, key, origin_name)
|
|
57
58
|
logger.info(f'Try to download with the latest version:{link}')
|
|
59
|
+
matched = True
|
|
58
60
|
break
|
|
61
|
+
if not matched:
|
|
62
|
+
key = ""
|
|
59
63
|
return oss_name, oss_version, link, key
|
|
60
64
|
|
|
61
65
|
|
fosslight_util/download.py
CHANGED
|
@@ -27,6 +27,7 @@ import subprocess
|
|
|
27
27
|
import re
|
|
28
28
|
from typing import Tuple
|
|
29
29
|
import urllib.parse
|
|
30
|
+
import json
|
|
30
31
|
|
|
31
32
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
32
33
|
compression_extension = {".tar.bz2", ".tar.gz", ".tar.xz", ".tgz", ".tar", ".zip", ".jar", ".bz2"}
|
|
@@ -96,7 +97,8 @@ def parse_src_link(src_link):
|
|
|
96
97
|
def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_to: str = "",
|
|
97
98
|
compressed_only: bool = False, ssh_key: str = "",
|
|
98
99
|
id: str = "", git_token: str = "",
|
|
99
|
-
called_cli: bool = True
|
|
100
|
+
called_cli: bool = True,
|
|
101
|
+
output: bool = False) -> Tuple[bool, str, str, str]:
|
|
100
102
|
global logger
|
|
101
103
|
|
|
102
104
|
success = True
|
|
@@ -155,6 +157,17 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
155
157
|
success = False
|
|
156
158
|
msg = str(error)
|
|
157
159
|
|
|
160
|
+
if output:
|
|
161
|
+
output_result = {
|
|
162
|
+
"success": success,
|
|
163
|
+
"message": msg,
|
|
164
|
+
"oss_name": oss_name,
|
|
165
|
+
"oss_version": oss_version
|
|
166
|
+
}
|
|
167
|
+
output_json = os.path.join(log_dir, "fosslight_download_output.json")
|
|
168
|
+
with open(output_json, 'w') as f:
|
|
169
|
+
json.dump(output_result, f, indent=4)
|
|
170
|
+
|
|
158
171
|
logger.info(f"\n* FOSSLight Downloader - Result: {success} ({msg})")
|
|
159
172
|
return success, msg, oss_name, oss_version
|
|
160
173
|
|
|
@@ -478,10 +491,17 @@ def main():
|
|
|
478
491
|
parser.add_argument('-s', '--source', help='Source link to download', type=str, dest='source')
|
|
479
492
|
parser.add_argument('-t', '--target_dir', help='Target directory', type=str, dest='target_dir', default="")
|
|
480
493
|
parser.add_argument('-d', '--log_dir', help='Directory to save log file', type=str, dest='log_dir', default="")
|
|
494
|
+
parser.add_argument('-c', '--checkout_to', help='Checkout to branch or tag', type=str, dest='checkout_to', default="")
|
|
495
|
+
parser.add_argument('-z', '--compressed_only', help='Unzip only compressed file',
|
|
496
|
+
action='store_true', dest='compressed_only', default=False)
|
|
497
|
+
parser.add_argument('-o', '--output', help='Generate output file', action='store_true', dest='output', default=False)
|
|
481
498
|
|
|
482
499
|
src_link = ""
|
|
483
500
|
target_dir = os.getcwd()
|
|
484
501
|
log_dir = os.getcwd()
|
|
502
|
+
checkout_to = ""
|
|
503
|
+
compressed_only = False
|
|
504
|
+
output = False
|
|
485
505
|
|
|
486
506
|
try:
|
|
487
507
|
args = parser.parse_args()
|
|
@@ -496,11 +516,19 @@ def main():
|
|
|
496
516
|
target_dir = args.target_dir
|
|
497
517
|
if args.log_dir:
|
|
498
518
|
log_dir = args.log_dir
|
|
519
|
+
if args.checkout_to:
|
|
520
|
+
checkout_to = args.checkout_to
|
|
521
|
+
if args.compressed_only:
|
|
522
|
+
compressed_only = args.compressed_only
|
|
523
|
+
if args.output:
|
|
524
|
+
output = args.output
|
|
499
525
|
|
|
500
526
|
if not src_link:
|
|
501
527
|
print_help_msg_download()
|
|
502
528
|
else:
|
|
503
|
-
cli_download_and_extract(src_link, target_dir, log_dir
|
|
529
|
+
cli_download_and_extract(src_link, target_dir, log_dir, checkout_to,
|
|
530
|
+
compressed_only, "", "", "", False,
|
|
531
|
+
output)
|
|
504
532
|
|
|
505
533
|
|
|
506
534
|
if __name__ == '__main__':
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fosslight-util
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.21
|
|
4
4
|
Summary: FOSSLight Util
|
|
5
5
|
Home-page: https://github.com/fosslight/fosslight_util
|
|
6
|
+
Download-URL: https://github.com/fosslight/fosslight_util
|
|
6
7
|
Author: LG Electronics
|
|
7
8
|
License: Apache-2.0
|
|
8
|
-
Download-URL: https://github.com/fosslight/fosslight_util
|
|
9
|
-
Platform: UNKNOWN
|
|
10
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
14
|
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
19
16
|
Requires-Dist: XlsxWriter
|
|
20
17
|
Requires-Dist: pandas
|
|
21
18
|
Requires-Dist: openpyxl
|
|
@@ -27,12 +24,9 @@ Requires-Dist: python3-wget
|
|
|
27
24
|
Requires-Dist: beautifulsoup4
|
|
28
25
|
Requires-Dist: jsonmerge
|
|
29
26
|
Requires-Dist: setuptools>=65.5.1
|
|
27
|
+
Requires-Dist: numpy
|
|
30
28
|
Requires-Dist: requests
|
|
31
29
|
Requires-Dist: GitPython
|
|
32
|
-
Requires-Dist: numpy; python_version < "3.8"
|
|
33
|
-
Requires-Dist: numpy>=1.22.2; python_version >= "3.8"
|
|
34
|
-
Requires-Dist: pygit2==1.6.1; python_version < "3.7"
|
|
35
|
-
Requires-Dist: pygit2>=1.10.1; python_version >= "3.7"
|
|
36
30
|
Requires-Dist: spdx-tools==0.8.*; sys_platform == "linux"
|
|
37
31
|
Requires-Dist: cyclonedx-python-lib==8.5.*; sys_platform == "linux"
|
|
38
32
|
|
|
@@ -67,7 +61,7 @@ It is a package that supports common utils used by FOSSLight Scanner.
|
|
|
67
61
|
|
|
68
62
|
## 📋 Prerequisite
|
|
69
63
|
|
|
70
|
-
FOSSLight Util needs a Python 3.
|
|
64
|
+
FOSSLight Util needs a Python 3.10+.
|
|
71
65
|
|
|
72
66
|
## 🎉 How to install
|
|
73
67
|
|
|
@@ -81,7 +75,7 @@ $ pip3 install fosslight_util
|
|
|
81
75
|
|
|
82
76
|
Three modules can be called. Please refer to each file for detailed calling method.
|
|
83
77
|
|
|
84
|
-
|
|
78
|
+
|
|
85
79
|
### 1. Setup logger (tests/test_log.py)
|
|
86
80
|
```
|
|
87
81
|
from fosslight_util.set_log import init_log
|
|
@@ -102,7 +96,7 @@ def test():
|
|
|
102
96
|
logger.warning("TESTING - Print log")
|
|
103
97
|
```
|
|
104
98
|
|
|
105
|
-
|
|
99
|
+
|
|
106
100
|
### 2. Write result files (tests/test_output_format.py)
|
|
107
101
|
```
|
|
108
102
|
from fosslight_util.output_format import write_output_file
|
|
@@ -118,7 +112,7 @@ def test():
|
|
|
118
112
|
'0.4.3', 'Apache-2.0', 'https://github.com/jpeddicord/askalono', '', 'Copyright (c) 2018 Amazon.com, Inc. or its affiliates.', '', '']]}
|
|
119
113
|
success, msg = write_output_file('test_result/excel/FOSSLight-Report', '.xlsx', sheet_contents)
|
|
120
114
|
```
|
|
121
|
-
|
|
115
|
+
|
|
122
116
|
### 3. Get spdx licenses (tests/test_spdx_licenses.py)
|
|
123
117
|
```
|
|
124
118
|
from fosslight_util.spdx_licenses import get_spdx_licenses_json
|
|
@@ -184,5 +178,3 @@ Please report any ideas or bugs to improve by creating an issue in [fosslight_ut
|
|
|
184
178
|
FOSSLight Util is released under [Apache-2.0][l].
|
|
185
179
|
|
|
186
180
|
[l]: https://github.com/fosslight/fosslight_util/blob/main/LICENSE
|
|
187
|
-
|
|
188
|
-
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
fosslight_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
fosslight_util/_get_downloadable_url.py,sha256=
|
|
2
|
+
fosslight_util/_get_downloadable_url.py,sha256=p6vSYr6BdSwqafqMX3Cl5M45MSE9N02w512Mh5C2Hyo,12355
|
|
3
3
|
fosslight_util/compare_yaml.py,sha256=eLqqCLgERxRHN5vsnpQVMXIEU862Lx66mD_y4uMgQE4,2916
|
|
4
4
|
fosslight_util/constant.py,sha256=zElnWOzXt020sYiFTiRQn8ZjZyZpL3aPmfAqfQLcxJk,2278
|
|
5
5
|
fosslight_util/correct.py,sha256=1WEAL-9_KhjFPLucPhv0PNN3K7avm0z8mU6sTuSyeHM,3864
|
|
6
6
|
fosslight_util/cover.py,sha256=qqqKzxqFwKimal764FaugRUBcHWdeKt8af6xeK0mH8E,2040
|
|
7
|
-
fosslight_util/download.py,sha256=
|
|
7
|
+
fosslight_util/download.py,sha256=A-L9zBVUDoP6LQrAaVv3IzpEldOSxE3lBMqNOYTaYVU,18856
|
|
8
8
|
fosslight_util/exclude.py,sha256=fDmBsZJ_F7O9Oh2T-07R03XNbElo1tFaf_z01KfSAqU,2399
|
|
9
9
|
fosslight_util/help.py,sha256=Bmyz-eFP0X0qUfgFPrWiuyUPE0TLQfWjgfHTzJBIInc,2377
|
|
10
10
|
fosslight_util/oss_item.py,sha256=8W2HlwqGH3l1iPPdvycrRYKsBSBpqAkqYyYtBVPgMtY,6868
|
|
@@ -24,9 +24,9 @@ fosslight_util/write_yaml.py,sha256=QlEKoIPQsEaYERfbP53TeKgnllYzhLQWm5wYjnWtVjE,
|
|
|
24
24
|
fosslight_util/resources/frequentLicenselist.json,sha256=GUhzK6tu7ok10fekOnmVmUgIGRC-acGABZKTNKfDyYA,4776157
|
|
25
25
|
fosslight_util/resources/frequent_license_nick_list.json,sha256=ryU2C_6ZxHbz90_sUN9OvI9GXkCMLu7oGcmd9W79YYo,5005
|
|
26
26
|
fosslight_util/resources/licenses.json,sha256=mK55z-bhY7Mjpj2KsO1crKGGL-X3F6MBFQJ0zLlx010,240843
|
|
27
|
-
fosslight_util-2.1.
|
|
28
|
-
fosslight_util-2.1.
|
|
29
|
-
fosslight_util-2.1.
|
|
30
|
-
fosslight_util-2.1.
|
|
31
|
-
fosslight_util-2.1.
|
|
32
|
-
fosslight_util-2.1.
|
|
27
|
+
fosslight_util-2.1.21.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
28
|
+
fosslight_util-2.1.21.dist-info/METADATA,sha256=BaqzJe4829VFc5HECJui2DBzr8_IhlVEPWNPnUimJa0,6156
|
|
29
|
+
fosslight_util-2.1.21.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
30
|
+
fosslight_util-2.1.21.dist-info/entry_points.txt,sha256=0yZggRWNwDaClDG8UmUA10UFG8cVX3Jiy5gG9nW7hJs,68
|
|
31
|
+
fosslight_util-2.1.21.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
|
|
32
|
+
fosslight_util-2.1.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|