fosslight-util 2.1.18__py3-none-any.whl → 2.1.20__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 +15 -8
- {fosslight_util-2.1.18.dist-info → fosslight_util-2.1.20.dist-info}/METADATA +9 -18
- {fosslight_util-2.1.18.dist-info → fosslight_util-2.1.20.dist-info}/RECORD +7 -7
- {fosslight_util-2.1.18.dist-info → fosslight_util-2.1.20.dist-info}/entry_points.txt +0 -1
- {fosslight_util-2.1.18.dist-info → fosslight_util-2.1.20.dist-info}/LICENSE +0 -0
- {fosslight_util-2.1.18.dist-info → fosslight_util-2.1.20.dist-info}/WHEEL +0 -0
- {fosslight_util-2.1.18.dist-info → fosslight_util-2.1.20.dist-info}/top_level.txt +0 -0
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import logging
|
|
6
6
|
import re
|
|
7
7
|
import requests
|
|
8
|
-
from npm.bindings import npm_run
|
|
9
8
|
from lastversion import latest
|
|
10
9
|
from bs4 import BeautifulSoup
|
|
11
10
|
from urllib.request import urlopen
|
|
@@ -17,6 +16,7 @@ logger = logging.getLogger(constant.LOGGER_NAME)
|
|
|
17
16
|
def extract_name_version_from_link(link):
|
|
18
17
|
oss_name = ""
|
|
19
18
|
oss_version = ""
|
|
19
|
+
matched = False
|
|
20
20
|
if link.startswith("www."):
|
|
21
21
|
link = link.replace("www.", "https://www.", 1)
|
|
22
22
|
for key, value in constant.PKG_PATTERN.items():
|
|
@@ -56,7 +56,10 @@ def extract_name_version_from_link(link):
|
|
|
56
56
|
if key in ["pypi", "maven", "npm", "npm2", "pub", "go"]:
|
|
57
57
|
oss_version, link = get_latest_package_version(link, key, origin_name)
|
|
58
58
|
logger.info(f'Try to download with the latest version:{link}')
|
|
59
|
+
matched = True
|
|
59
60
|
break
|
|
61
|
+
if not matched:
|
|
62
|
+
key = ""
|
|
60
63
|
return oss_name, oss_version, link, key
|
|
61
64
|
|
|
62
65
|
|
|
@@ -66,10 +69,11 @@ def get_latest_package_version(link, pkg_type, oss_name):
|
|
|
66
69
|
|
|
67
70
|
try:
|
|
68
71
|
if pkg_type in ['npm', 'npm2']:
|
|
69
|
-
|
|
70
|
-
if
|
|
71
|
-
find_version =
|
|
72
|
-
|
|
72
|
+
npm_response = requests.get(f"https://registry.npmjs.org/{oss_name}")
|
|
73
|
+
if npm_response.status_code == 200:
|
|
74
|
+
find_version = npm_response.json().get("dist-tags", {}).get("latest")
|
|
75
|
+
if find_version:
|
|
76
|
+
link_with_version = f'https://www.npmjs.com/package/{oss_name}/v/{find_version}'
|
|
73
77
|
elif pkg_type == 'pypi':
|
|
74
78
|
find_version = str(latest(oss_name, at='pip', output_format='version', pre_ok=True))
|
|
75
79
|
link_with_version = f'https://pypi.org/project/{oss_name}/{find_version}'
|
|
@@ -78,17 +82,20 @@ def get_latest_package_version(link, pkg_type, oss_name):
|
|
|
78
82
|
if maven_response.status_code == 200:
|
|
79
83
|
find_version = maven_response.json().get('versions')[-1].get('versionKey').get('version')
|
|
80
84
|
oss_name = oss_name.replace(':', '/')
|
|
81
|
-
|
|
85
|
+
if find_version:
|
|
86
|
+
link_with_version = f'https://mvnrepository.com/artifact/{oss_name}/{find_version}'
|
|
82
87
|
elif pkg_type == 'pub':
|
|
83
88
|
pub_response = requests.get(f'https://pub.dev/api/packages/{oss_name}')
|
|
84
89
|
if pub_response.status_code == 200:
|
|
85
90
|
find_version = pub_response.json().get('latest').get('version')
|
|
86
|
-
|
|
91
|
+
if find_version:
|
|
92
|
+
link_with_version = f'https://pub.dev/packages/{oss_name}/versions/{find_version}'
|
|
87
93
|
elif pkg_type == 'go':
|
|
88
94
|
go_response = requests.get(f'https://proxy.golang.org/{oss_name}/@latest')
|
|
89
95
|
if go_response.status_code == 200:
|
|
90
96
|
find_version = go_response.json().get('Version')
|
|
91
|
-
|
|
97
|
+
if find_version:
|
|
98
|
+
link_with_version = f'https://pkg.go.dev/{oss_name}@{find_version}'
|
|
92
99
|
except Exception as e:
|
|
93
100
|
logger.info(f'Fail to get latest package version({link}:{e})')
|
|
94
101
|
return find_version, link_with_version
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fosslight-util
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.20
|
|
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,13 +24,9 @@ Requires-Dist: python3-wget
|
|
|
27
24
|
Requires-Dist: beautifulsoup4
|
|
28
25
|
Requires-Dist: jsonmerge
|
|
29
26
|
Requires-Dist: setuptools>=65.5.1
|
|
30
|
-
Requires-Dist:
|
|
27
|
+
Requires-Dist: numpy
|
|
31
28
|
Requires-Dist: requests
|
|
32
29
|
Requires-Dist: GitPython
|
|
33
|
-
Requires-Dist: numpy; python_version < "3.8"
|
|
34
|
-
Requires-Dist: numpy>=1.22.2; python_version >= "3.8"
|
|
35
|
-
Requires-Dist: pygit2==1.6.1; python_version < "3.7"
|
|
36
|
-
Requires-Dist: pygit2>=1.10.1; python_version >= "3.7"
|
|
37
30
|
Requires-Dist: spdx-tools==0.8.*; sys_platform == "linux"
|
|
38
31
|
Requires-Dist: cyclonedx-python-lib==8.5.*; sys_platform == "linux"
|
|
39
32
|
|
|
@@ -68,7 +61,7 @@ It is a package that supports common utils used by FOSSLight Scanner.
|
|
|
68
61
|
|
|
69
62
|
## 📋 Prerequisite
|
|
70
63
|
|
|
71
|
-
FOSSLight Util needs a Python 3.
|
|
64
|
+
FOSSLight Util needs a Python 3.10+.
|
|
72
65
|
|
|
73
66
|
## 🎉 How to install
|
|
74
67
|
|
|
@@ -82,7 +75,7 @@ $ pip3 install fosslight_util
|
|
|
82
75
|
|
|
83
76
|
Three modules can be called. Please refer to each file for detailed calling method.
|
|
84
77
|
|
|
85
|
-
|
|
78
|
+
|
|
86
79
|
### 1. Setup logger (tests/test_log.py)
|
|
87
80
|
```
|
|
88
81
|
from fosslight_util.set_log import init_log
|
|
@@ -103,7 +96,7 @@ def test():
|
|
|
103
96
|
logger.warning("TESTING - Print log")
|
|
104
97
|
```
|
|
105
98
|
|
|
106
|
-
|
|
99
|
+
|
|
107
100
|
### 2. Write result files (tests/test_output_format.py)
|
|
108
101
|
```
|
|
109
102
|
from fosslight_util.output_format import write_output_file
|
|
@@ -119,7 +112,7 @@ def test():
|
|
|
119
112
|
'0.4.3', 'Apache-2.0', 'https://github.com/jpeddicord/askalono', '', 'Copyright (c) 2018 Amazon.com, Inc. or its affiliates.', '', '']]}
|
|
120
113
|
success, msg = write_output_file('test_result/excel/FOSSLight-Report', '.xlsx', sheet_contents)
|
|
121
114
|
```
|
|
122
|
-
|
|
115
|
+
|
|
123
116
|
### 3. Get spdx licenses (tests/test_spdx_licenses.py)
|
|
124
117
|
```
|
|
125
118
|
from fosslight_util.spdx_licenses import get_spdx_licenses_json
|
|
@@ -185,5 +178,3 @@ Please report any ideas or bugs to improve by creating an issue in [fosslight_ut
|
|
|
185
178
|
FOSSLight Util is released under [Apache-2.0][l].
|
|
186
179
|
|
|
187
180
|
[l]: https://github.com/fosslight/fosslight_util/blob/main/LICENSE
|
|
188
|
-
|
|
189
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
@@ -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.20.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
28
|
+
fosslight_util-2.1.20.dist-info/METADATA,sha256=Xu9Tf7A99Bco8gbf9rdM-y2m9-F--XxOXLTDUJtEQqY,6156
|
|
29
|
+
fosslight_util-2.1.20.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
30
|
+
fosslight_util-2.1.20.dist-info/entry_points.txt,sha256=0yZggRWNwDaClDG8UmUA10UFG8cVX3Jiy5gG9nW7hJs,68
|
|
31
|
+
fosslight_util-2.1.20.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
|
|
32
|
+
fosslight_util-2.1.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|