fosslight-util 2.1.19__tar.gz → 2.1.20__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_util-2.1.20/PKG-INFO +164 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/README.md +1 -1
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/requirements.txt +1 -2
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/setup.py +3 -8
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/_get_downloadable_url.py +4 -0
- fosslight_util-2.1.20/src/fosslight_util.egg-info/PKG-INFO +164 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util.egg-info/entry_points.txt +0 -1
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util.egg-info/requires.txt +1 -12
- fosslight_util-2.1.19/PKG-INFO +0 -167
- fosslight_util-2.1.19/src/fosslight_util.egg-info/PKG-INFO +0 -167
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/LICENSE +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/MANIFEST.in +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/setup.cfg +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/correct.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/download.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/exclude.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/help.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/oss_item.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/parsing_yaml.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/read_excel.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/set_log.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/spdx_licenses.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/write_cyclonedx.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/write_excel.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util/write_yaml.py +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: fosslight_util
|
|
3
|
+
Version: 2.1.20
|
|
4
|
+
Summary: FOSSLight Util
|
|
5
|
+
Home-page: https://github.com/fosslight/fosslight_util
|
|
6
|
+
Download-URL: https://github.com/fosslight/fosslight_util
|
|
7
|
+
Author: LG Electronics
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
|
|
17
|
+
<!--
|
|
18
|
+
Copyright (c) 2021 LG Electronics
|
|
19
|
+
SPDX-License-Identifier: Apache-2.0
|
|
20
|
+
-->
|
|
21
|
+
# FOSSLight Util
|
|
22
|
+
|
|
23
|
+
<img src="https://img.shields.io/pypi/l/fosslight_util" alt="FOSSLight Util is released under the Apache-2.0." /> <img src="https://img.shields.io/pypi/v/fosslight_util" alt="Current python package version." /> <img src="https://img.shields.io/pypi/pyversions/fosslight_util" /> [](https://api.reuse.software/info/github.com/fosslight/fosslight_util)
|
|
24
|
+
|
|
25
|
+
It is a package that supports common utils used by FOSSLight Scanner.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
1. It simplifies the logger setup.
|
|
29
|
+
2. It provides a simple function to create a output file.
|
|
30
|
+
3. It provides a spdx license list with json format.
|
|
31
|
+
4. It defines common constant variables.
|
|
32
|
+
5. It provides a thread that prints the spinner.
|
|
33
|
+
6. Download source code.
|
|
34
|
+
|
|
35
|
+
[or]: http://collab.lge.com/main/x/xDHlFg
|
|
36
|
+
|
|
37
|
+
## Contents
|
|
38
|
+
|
|
39
|
+
- [Prerequisite](#-prerequisite)
|
|
40
|
+
- [How to install](#-how-to-install)
|
|
41
|
+
- [How to run](#-how-to-run)
|
|
42
|
+
- [How to report issue](#-how-to-report-issue)
|
|
43
|
+
- [License](#-license)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 📋 Prerequisite
|
|
47
|
+
|
|
48
|
+
FOSSLight Util needs a Python 3.10+.
|
|
49
|
+
|
|
50
|
+
## 🎉 How to install
|
|
51
|
+
|
|
52
|
+
It can be installed using pip3.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
$ pip3 install fosslight_util
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 🚀 How to use
|
|
59
|
+
|
|
60
|
+
Three modules can be called. Please refer to each file for detailed calling method.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### 1. Setup logger (tests/test_log.py)
|
|
64
|
+
```
|
|
65
|
+
from fosslight_util.set_log import init_log
|
|
66
|
+
|
|
67
|
+
# 1st param : log file path
|
|
68
|
+
# 2nd param : create file (True/False)
|
|
69
|
+
# 3rd param : stream log level
|
|
70
|
+
# 4th param : file log level
|
|
71
|
+
# =>log level(CRITICAL:50, ERROR:40, WARNING:30, INFO:20, DEBUG:10, NOTSET:0)
|
|
72
|
+
# 5th param : package name of fosslight scanners (fosslight_source / fosslight_dependency / fosslight_reuse)
|
|
73
|
+
# 6th param : path to analyze
|
|
74
|
+
#
|
|
75
|
+
# 1st return value : a logger
|
|
76
|
+
# 2nd return value : log items to print
|
|
77
|
+
|
|
78
|
+
def test():
|
|
79
|
+
logger, log_item = init_log("test_result/log_file1.txt", True, 30, 20)
|
|
80
|
+
logger.warning("TESTING - Print log")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### 2. Write result files (tests/test_output_format.py)
|
|
85
|
+
```
|
|
86
|
+
from fosslight_util.output_format import write_output_file
|
|
87
|
+
|
|
88
|
+
# 2nd param : output file format
|
|
89
|
+
# => file format(excel: .xlsx, csv: .csv, opossum: .json)
|
|
90
|
+
def test():
|
|
91
|
+
sheet_contents = {'SRC':[['run_scancode.py', 'fosslight_source',
|
|
92
|
+
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_source', 'https://github.com/LGE-OSS/fosslight_source', 'Copyright (c) 2021 LG Electronics, Inc.', 'Exclude', 'Comment message'],
|
|
93
|
+
['dependency_unified.py', 'fosslight_dependency',
|
|
94
|
+
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_dependency', 'https://github.com/LGE-OSS/fosslight_dependency', 'Copyright (c) 2020 LG Electronics, Inc.', '', '']],
|
|
95
|
+
'BIN':[['askalono.exe', 'askalono',
|
|
96
|
+
'0.4.3', 'Apache-2.0', 'https://github.com/jpeddicord/askalono', '', 'Copyright (c) 2018 Amazon.com, Inc. or its affiliates.', '', '']]}
|
|
97
|
+
success, msg = write_output_file('test_result/excel/FOSSLight-Report', '.xlsx', sheet_contents)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3. Get spdx licenses (tests/test_spdx_licenses.py)
|
|
101
|
+
```
|
|
102
|
+
from fosslight_util.spdx_licenses import get_spdx_licenses_json
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def test():
|
|
106
|
+
success, error_msg, licenses = get_spdx_licenses_json()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 4. Load common constant (tests/_print_log_with_another_logger.py)
|
|
110
|
+
```
|
|
111
|
+
import fosslight_util.constant as constant
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
115
|
+
logger.warning("Get a logger after init_log is called once.")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 5. Call a spinner (tests/test_timer.py)
|
|
119
|
+
```
|
|
120
|
+
from fosslight_util.timer_thread import TimerThread
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
timer = TimerThread()
|
|
124
|
+
timer.setDaemon(True)
|
|
125
|
+
timer.start()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 6. Download the source code (tests/test_download.py)
|
|
129
|
+
If you give a link, the source is downloaded to the target directory through git clone or wget.
|
|
130
|
+
|
|
131
|
+
#### How it works
|
|
132
|
+
1. Try git clone.
|
|
133
|
+
1-1. If the link is ssh-url, convert to https-url.
|
|
134
|
+
2. If git clone fails, download it with wget and extract the compressed file.
|
|
135
|
+
3. After extracting the compressed file, delete the compressed file.
|
|
136
|
+
|
|
137
|
+
#### Parameters
|
|
138
|
+
| Parameter | Argument | Description |
|
|
139
|
+
| ------------- | ------------- | ------------- |
|
|
140
|
+
| h | None | Print help message. |
|
|
141
|
+
| s | String | Link to download. |
|
|
142
|
+
| t | String | Path to download and extract. |
|
|
143
|
+
| d | String | Path to save a log file. |
|
|
144
|
+
|
|
145
|
+
#### How to run
|
|
146
|
+
```
|
|
147
|
+
$ fosslight_download -s "https://github.com/LGE-OSS/example" -t target_dir/
|
|
148
|
+
```
|
|
149
|
+
If you want to try with private repository, set your github token like below.
|
|
150
|
+
```
|
|
151
|
+
$ fosslight_download -s "https://my_github_token@github.com/Foo/private_repo -t target_dir/"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 👏 How to report issue
|
|
155
|
+
|
|
156
|
+
Please report any ideas or bugs to improve by creating an issue in [fosslight_util repository][cl]. Then there will be quick bug fixes and upgrades. Ideas to improve are always welcome.
|
|
157
|
+
|
|
158
|
+
[cl]: https://github.com/fosslight/fosslight_util/issues
|
|
159
|
+
|
|
160
|
+
## 📄 License
|
|
161
|
+
|
|
162
|
+
FOSSLight Util is released under [Apache-2.0][l].
|
|
163
|
+
|
|
164
|
+
[l]: https://github.com/fosslight/fosslight_util/blob/main/LICENSE
|
|
@@ -10,8 +10,7 @@ beautifulsoup4
|
|
|
10
10
|
jsonmerge
|
|
11
11
|
spdx-tools==0.8.*;sys_platform=="linux"
|
|
12
12
|
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
|
|
13
|
-
numpy
|
|
14
|
-
numpy>=1.22.2; python_version >= '3.8'
|
|
13
|
+
numpy
|
|
15
14
|
requests
|
|
16
15
|
GitPython
|
|
17
16
|
cyclonedx-python-lib==8.5.*;sys_platform=="linux"
|
|
@@ -14,7 +14,7 @@ with open('requirements.txt', 'r', 'utf-8') as f:
|
|
|
14
14
|
if __name__ == "__main__":
|
|
15
15
|
setup(
|
|
16
16
|
name='fosslight_util',
|
|
17
|
-
version='2.1.
|
|
17
|
+
version='2.1.20',
|
|
18
18
|
package_dir={"": "src"},
|
|
19
19
|
packages=find_packages(where='src'),
|
|
20
20
|
description='FOSSLight Util',
|
|
@@ -26,17 +26,12 @@ if __name__ == "__main__":
|
|
|
26
26
|
download_url='https://github.com/fosslight/fosslight_util',
|
|
27
27
|
classifiers=['License :: OSI Approved :: Apache Software License',
|
|
28
28
|
"Programming Language :: Python :: 3",
|
|
29
|
-
"Programming Language :: Python :: 3.6",
|
|
30
|
-
"Programming Language :: Python :: 3.7",
|
|
31
|
-
"Programming Language :: Python :: 3.8",
|
|
32
|
-
"Programming Language :: Python :: 3.9",
|
|
33
29
|
"Programming Language :: Python :: 3.10",
|
|
34
|
-
"Programming Language :: Python :: 3.11",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12", ],
|
|
35
32
|
install_requires=required,
|
|
36
33
|
package_data={'fosslight_util': ['resources/frequentLicenselist.json', 'resources/licenses.json']},
|
|
37
34
|
include_package_data=True,
|
|
38
|
-
extras_require={":python_version<'3.7'": ["pygit2==1.6.1"],
|
|
39
|
-
":python_version>='3.7'": ["pygit2>=1.10.1"]},
|
|
40
35
|
entry_points={
|
|
41
36
|
"console_scripts": [
|
|
42
37
|
"fosslight_download = fosslight_util.download:main",
|
|
@@ -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
|
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: fosslight-util
|
|
3
|
+
Version: 2.1.20
|
|
4
|
+
Summary: FOSSLight Util
|
|
5
|
+
Home-page: https://github.com/fosslight/fosslight_util
|
|
6
|
+
Download-URL: https://github.com/fosslight/fosslight_util
|
|
7
|
+
Author: LG Electronics
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
|
|
17
|
+
<!--
|
|
18
|
+
Copyright (c) 2021 LG Electronics
|
|
19
|
+
SPDX-License-Identifier: Apache-2.0
|
|
20
|
+
-->
|
|
21
|
+
# FOSSLight Util
|
|
22
|
+
|
|
23
|
+
<img src="https://img.shields.io/pypi/l/fosslight_util" alt="FOSSLight Util is released under the Apache-2.0." /> <img src="https://img.shields.io/pypi/v/fosslight_util" alt="Current python package version." /> <img src="https://img.shields.io/pypi/pyversions/fosslight_util" /> [](https://api.reuse.software/info/github.com/fosslight/fosslight_util)
|
|
24
|
+
|
|
25
|
+
It is a package that supports common utils used by FOSSLight Scanner.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
1. It simplifies the logger setup.
|
|
29
|
+
2. It provides a simple function to create a output file.
|
|
30
|
+
3. It provides a spdx license list with json format.
|
|
31
|
+
4. It defines common constant variables.
|
|
32
|
+
5. It provides a thread that prints the spinner.
|
|
33
|
+
6. Download source code.
|
|
34
|
+
|
|
35
|
+
[or]: http://collab.lge.com/main/x/xDHlFg
|
|
36
|
+
|
|
37
|
+
## Contents
|
|
38
|
+
|
|
39
|
+
- [Prerequisite](#-prerequisite)
|
|
40
|
+
- [How to install](#-how-to-install)
|
|
41
|
+
- [How to run](#-how-to-run)
|
|
42
|
+
- [How to report issue](#-how-to-report-issue)
|
|
43
|
+
- [License](#-license)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 📋 Prerequisite
|
|
47
|
+
|
|
48
|
+
FOSSLight Util needs a Python 3.10+.
|
|
49
|
+
|
|
50
|
+
## 🎉 How to install
|
|
51
|
+
|
|
52
|
+
It can be installed using pip3.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
$ pip3 install fosslight_util
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 🚀 How to use
|
|
59
|
+
|
|
60
|
+
Three modules can be called. Please refer to each file for detailed calling method.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### 1. Setup logger (tests/test_log.py)
|
|
64
|
+
```
|
|
65
|
+
from fosslight_util.set_log import init_log
|
|
66
|
+
|
|
67
|
+
# 1st param : log file path
|
|
68
|
+
# 2nd param : create file (True/False)
|
|
69
|
+
# 3rd param : stream log level
|
|
70
|
+
# 4th param : file log level
|
|
71
|
+
# =>log level(CRITICAL:50, ERROR:40, WARNING:30, INFO:20, DEBUG:10, NOTSET:0)
|
|
72
|
+
# 5th param : package name of fosslight scanners (fosslight_source / fosslight_dependency / fosslight_reuse)
|
|
73
|
+
# 6th param : path to analyze
|
|
74
|
+
#
|
|
75
|
+
# 1st return value : a logger
|
|
76
|
+
# 2nd return value : log items to print
|
|
77
|
+
|
|
78
|
+
def test():
|
|
79
|
+
logger, log_item = init_log("test_result/log_file1.txt", True, 30, 20)
|
|
80
|
+
logger.warning("TESTING - Print log")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### 2. Write result files (tests/test_output_format.py)
|
|
85
|
+
```
|
|
86
|
+
from fosslight_util.output_format import write_output_file
|
|
87
|
+
|
|
88
|
+
# 2nd param : output file format
|
|
89
|
+
# => file format(excel: .xlsx, csv: .csv, opossum: .json)
|
|
90
|
+
def test():
|
|
91
|
+
sheet_contents = {'SRC':[['run_scancode.py', 'fosslight_source',
|
|
92
|
+
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_source', 'https://github.com/LGE-OSS/fosslight_source', 'Copyright (c) 2021 LG Electronics, Inc.', 'Exclude', 'Comment message'],
|
|
93
|
+
['dependency_unified.py', 'fosslight_dependency',
|
|
94
|
+
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_dependency', 'https://github.com/LGE-OSS/fosslight_dependency', 'Copyright (c) 2020 LG Electronics, Inc.', '', '']],
|
|
95
|
+
'BIN':[['askalono.exe', 'askalono',
|
|
96
|
+
'0.4.3', 'Apache-2.0', 'https://github.com/jpeddicord/askalono', '', 'Copyright (c) 2018 Amazon.com, Inc. or its affiliates.', '', '']]}
|
|
97
|
+
success, msg = write_output_file('test_result/excel/FOSSLight-Report', '.xlsx', sheet_contents)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3. Get spdx licenses (tests/test_spdx_licenses.py)
|
|
101
|
+
```
|
|
102
|
+
from fosslight_util.spdx_licenses import get_spdx_licenses_json
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def test():
|
|
106
|
+
success, error_msg, licenses = get_spdx_licenses_json()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 4. Load common constant (tests/_print_log_with_another_logger.py)
|
|
110
|
+
```
|
|
111
|
+
import fosslight_util.constant as constant
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
115
|
+
logger.warning("Get a logger after init_log is called once.")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 5. Call a spinner (tests/test_timer.py)
|
|
119
|
+
```
|
|
120
|
+
from fosslight_util.timer_thread import TimerThread
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
timer = TimerThread()
|
|
124
|
+
timer.setDaemon(True)
|
|
125
|
+
timer.start()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 6. Download the source code (tests/test_download.py)
|
|
129
|
+
If you give a link, the source is downloaded to the target directory through git clone or wget.
|
|
130
|
+
|
|
131
|
+
#### How it works
|
|
132
|
+
1. Try git clone.
|
|
133
|
+
1-1. If the link is ssh-url, convert to https-url.
|
|
134
|
+
2. If git clone fails, download it with wget and extract the compressed file.
|
|
135
|
+
3. After extracting the compressed file, delete the compressed file.
|
|
136
|
+
|
|
137
|
+
#### Parameters
|
|
138
|
+
| Parameter | Argument | Description |
|
|
139
|
+
| ------------- | ------------- | ------------- |
|
|
140
|
+
| h | None | Print help message. |
|
|
141
|
+
| s | String | Link to download. |
|
|
142
|
+
| t | String | Path to download and extract. |
|
|
143
|
+
| d | String | Path to save a log file. |
|
|
144
|
+
|
|
145
|
+
#### How to run
|
|
146
|
+
```
|
|
147
|
+
$ fosslight_download -s "https://github.com/LGE-OSS/example" -t target_dir/
|
|
148
|
+
```
|
|
149
|
+
If you want to try with private repository, set your github token like below.
|
|
150
|
+
```
|
|
151
|
+
$ fosslight_download -s "https://my_github_token@github.com/Foo/private_repo -t target_dir/"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 👏 How to report issue
|
|
155
|
+
|
|
156
|
+
Please report any ideas or bugs to improve by creating an issue in [fosslight_util repository][cl]. Then there will be quick bug fixes and upgrades. Ideas to improve are always welcome.
|
|
157
|
+
|
|
158
|
+
[cl]: https://github.com/fosslight/fosslight_util/issues
|
|
159
|
+
|
|
160
|
+
## 📄 License
|
|
161
|
+
|
|
162
|
+
FOSSLight Util is released under [Apache-2.0][l].
|
|
163
|
+
|
|
164
|
+
[l]: https://github.com/fosslight/fosslight_util/blob/main/LICENSE
|
|
@@ -9,21 +9,10 @@ python3-wget
|
|
|
9
9
|
beautifulsoup4
|
|
10
10
|
jsonmerge
|
|
11
11
|
setuptools>=65.5.1
|
|
12
|
+
numpy
|
|
12
13
|
requests
|
|
13
14
|
GitPython
|
|
14
15
|
|
|
15
|
-
[:python_version < "3.8"]
|
|
16
|
-
numpy
|
|
17
|
-
|
|
18
|
-
[:python_version >= "3.8"]
|
|
19
|
-
numpy>=1.22.2
|
|
20
|
-
|
|
21
|
-
[:python_version<'3.7']
|
|
22
|
-
pygit2==1.6.1
|
|
23
|
-
|
|
24
|
-
[:python_version>='3.7']
|
|
25
|
-
pygit2>=1.10.1
|
|
26
|
-
|
|
27
16
|
[:sys_platform == "linux"]
|
|
28
17
|
spdx-tools==0.8.*
|
|
29
18
|
cyclonedx-python-lib==8.5.*
|
fosslight_util-2.1.19/PKG-INFO
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: fosslight_util
|
|
3
|
-
Version: 2.1.19
|
|
4
|
-
Summary: FOSSLight Util
|
|
5
|
-
Home-page: https://github.com/fosslight/fosslight_util
|
|
6
|
-
Author: LG Electronics
|
|
7
|
-
License: Apache-2.0
|
|
8
|
-
Download-URL: https://github.com/fosslight/fosslight_util
|
|
9
|
-
Description: <!--
|
|
10
|
-
Copyright (c) 2021 LG Electronics
|
|
11
|
-
SPDX-License-Identifier: Apache-2.0
|
|
12
|
-
-->
|
|
13
|
-
# FOSSLight Util
|
|
14
|
-
|
|
15
|
-
<img src="https://img.shields.io/pypi/l/fosslight_util" alt="FOSSLight Util is released under the Apache-2.0." /> <img src="https://img.shields.io/pypi/v/fosslight_util" alt="Current python package version." /> <img src="https://img.shields.io/pypi/pyversions/fosslight_util" /> [](https://api.reuse.software/info/github.com/fosslight/fosslight_util)
|
|
16
|
-
|
|
17
|
-
It is a package that supports common utils used by FOSSLight Scanner.
|
|
18
|
-
|
|
19
|
-
## Features
|
|
20
|
-
1. It simplifies the logger setup.
|
|
21
|
-
2. It provides a simple function to create a output file.
|
|
22
|
-
3. It provides a spdx license list with json format.
|
|
23
|
-
4. It defines common constant variables.
|
|
24
|
-
5. It provides a thread that prints the spinner.
|
|
25
|
-
6. Download source code.
|
|
26
|
-
|
|
27
|
-
[or]: http://collab.lge.com/main/x/xDHlFg
|
|
28
|
-
|
|
29
|
-
## Contents
|
|
30
|
-
|
|
31
|
-
- [Prerequisite](#-prerequisite)
|
|
32
|
-
- [How to install](#-how-to-install)
|
|
33
|
-
- [How to run](#-how-to-run)
|
|
34
|
-
- [How to report issue](#-how-to-report-issue)
|
|
35
|
-
- [License](#-license)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## 📋 Prerequisite
|
|
39
|
-
|
|
40
|
-
FOSSLight Util needs a Python 3.6+.
|
|
41
|
-
|
|
42
|
-
## 🎉 How to install
|
|
43
|
-
|
|
44
|
-
It can be installed using pip3.
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
$ pip3 install fosslight_util
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## 🚀 How to use
|
|
51
|
-
|
|
52
|
-
Three modules can be called. Please refer to each file for detailed calling method.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### 1. Setup logger (tests/test_log.py)
|
|
56
|
-
```
|
|
57
|
-
from fosslight_util.set_log import init_log
|
|
58
|
-
|
|
59
|
-
# 1st param : log file path
|
|
60
|
-
# 2nd param : create file (True/False)
|
|
61
|
-
# 3rd param : stream log level
|
|
62
|
-
# 4th param : file log level
|
|
63
|
-
# =>log level(CRITICAL:50, ERROR:40, WARNING:30, INFO:20, DEBUG:10, NOTSET:0)
|
|
64
|
-
# 5th param : package name of fosslight scanners (fosslight_source / fosslight_dependency / fosslight_reuse)
|
|
65
|
-
# 6th param : path to analyze
|
|
66
|
-
#
|
|
67
|
-
# 1st return value : a logger
|
|
68
|
-
# 2nd return value : log items to print
|
|
69
|
-
|
|
70
|
-
def test():
|
|
71
|
-
logger, log_item = init_log("test_result/log_file1.txt", True, 30, 20)
|
|
72
|
-
logger.warning("TESTING - Print log")
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### 2. Write result files (tests/test_output_format.py)
|
|
77
|
-
```
|
|
78
|
-
from fosslight_util.output_format import write_output_file
|
|
79
|
-
|
|
80
|
-
# 2nd param : output file format
|
|
81
|
-
# => file format(excel: .xlsx, csv: .csv, opossum: .json)
|
|
82
|
-
def test():
|
|
83
|
-
sheet_contents = {'SRC':[['run_scancode.py', 'fosslight_source',
|
|
84
|
-
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_source', 'https://github.com/LGE-OSS/fosslight_source', 'Copyright (c) 2021 LG Electronics, Inc.', 'Exclude', 'Comment message'],
|
|
85
|
-
['dependency_unified.py', 'fosslight_dependency',
|
|
86
|
-
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_dependency', 'https://github.com/LGE-OSS/fosslight_dependency', 'Copyright (c) 2020 LG Electronics, Inc.', '', '']],
|
|
87
|
-
'BIN':[['askalono.exe', 'askalono',
|
|
88
|
-
'0.4.3', 'Apache-2.0', 'https://github.com/jpeddicord/askalono', '', 'Copyright (c) 2018 Amazon.com, Inc. or its affiliates.', '', '']]}
|
|
89
|
-
success, msg = write_output_file('test_result/excel/FOSSLight-Report', '.xlsx', sheet_contents)
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 3. Get spdx licenses (tests/test_spdx_licenses.py)
|
|
93
|
-
```
|
|
94
|
-
from fosslight_util.spdx_licenses import get_spdx_licenses_json
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def test():
|
|
98
|
-
success, error_msg, licenses = get_spdx_licenses_json()
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 4. Load common constant (tests/_print_log_with_another_logger.py)
|
|
102
|
-
```
|
|
103
|
-
import fosslight_util.constant as constant
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
107
|
-
logger.warning("Get a logger after init_log is called once.")
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### 5. Call a spinner (tests/test_timer.py)
|
|
111
|
-
```
|
|
112
|
-
from fosslight_util.timer_thread import TimerThread
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
timer = TimerThread()
|
|
116
|
-
timer.setDaemon(True)
|
|
117
|
-
timer.start()
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### 6. Download the source code (tests/test_download.py)
|
|
121
|
-
If you give a link, the source is downloaded to the target directory through git clone or wget.
|
|
122
|
-
|
|
123
|
-
#### How it works
|
|
124
|
-
1. Try git clone.
|
|
125
|
-
1-1. If the link is ssh-url, convert to https-url.
|
|
126
|
-
2. If git clone fails, download it with wget and extract the compressed file.
|
|
127
|
-
3. After extracting the compressed file, delete the compressed file.
|
|
128
|
-
|
|
129
|
-
#### Parameters
|
|
130
|
-
| Parameter | Argument | Description |
|
|
131
|
-
| ------------- | ------------- | ------------- |
|
|
132
|
-
| h | None | Print help message. |
|
|
133
|
-
| s | String | Link to download. |
|
|
134
|
-
| t | String | Path to download and extract. |
|
|
135
|
-
| d | String | Path to save a log file. |
|
|
136
|
-
|
|
137
|
-
#### How to run
|
|
138
|
-
```
|
|
139
|
-
$ fosslight_download -s "https://github.com/LGE-OSS/example" -t target_dir/
|
|
140
|
-
```
|
|
141
|
-
If you want to try with private repository, set your github token like below.
|
|
142
|
-
```
|
|
143
|
-
$ fosslight_download -s "https://my_github_token@github.com/Foo/private_repo -t target_dir/"
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## 👏 How to report issue
|
|
147
|
-
|
|
148
|
-
Please report any ideas or bugs to improve by creating an issue in [fosslight_util repository][cl]. Then there will be quick bug fixes and upgrades. Ideas to improve are always welcome.
|
|
149
|
-
|
|
150
|
-
[cl]: https://github.com/fosslight/fosslight_util/issues
|
|
151
|
-
|
|
152
|
-
## 📄 License
|
|
153
|
-
|
|
154
|
-
FOSSLight Util is released under [Apache-2.0][l].
|
|
155
|
-
|
|
156
|
-
[l]: https://github.com/fosslight/fosslight_util/blob/main/LICENSE
|
|
157
|
-
|
|
158
|
-
Platform: UNKNOWN
|
|
159
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
160
|
-
Classifier: Programming Language :: Python :: 3
|
|
161
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
162
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
163
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
164
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
165
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
166
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
167
|
-
Description-Content-Type: text/markdown
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: fosslight-util
|
|
3
|
-
Version: 2.1.19
|
|
4
|
-
Summary: FOSSLight Util
|
|
5
|
-
Home-page: https://github.com/fosslight/fosslight_util
|
|
6
|
-
Author: LG Electronics
|
|
7
|
-
License: Apache-2.0
|
|
8
|
-
Download-URL: https://github.com/fosslight/fosslight_util
|
|
9
|
-
Description: <!--
|
|
10
|
-
Copyright (c) 2021 LG Electronics
|
|
11
|
-
SPDX-License-Identifier: Apache-2.0
|
|
12
|
-
-->
|
|
13
|
-
# FOSSLight Util
|
|
14
|
-
|
|
15
|
-
<img src="https://img.shields.io/pypi/l/fosslight_util" alt="FOSSLight Util is released under the Apache-2.0." /> <img src="https://img.shields.io/pypi/v/fosslight_util" alt="Current python package version." /> <img src="https://img.shields.io/pypi/pyversions/fosslight_util" /> [](https://api.reuse.software/info/github.com/fosslight/fosslight_util)
|
|
16
|
-
|
|
17
|
-
It is a package that supports common utils used by FOSSLight Scanner.
|
|
18
|
-
|
|
19
|
-
## Features
|
|
20
|
-
1. It simplifies the logger setup.
|
|
21
|
-
2. It provides a simple function to create a output file.
|
|
22
|
-
3. It provides a spdx license list with json format.
|
|
23
|
-
4. It defines common constant variables.
|
|
24
|
-
5. It provides a thread that prints the spinner.
|
|
25
|
-
6. Download source code.
|
|
26
|
-
|
|
27
|
-
[or]: http://collab.lge.com/main/x/xDHlFg
|
|
28
|
-
|
|
29
|
-
## Contents
|
|
30
|
-
|
|
31
|
-
- [Prerequisite](#-prerequisite)
|
|
32
|
-
- [How to install](#-how-to-install)
|
|
33
|
-
- [How to run](#-how-to-run)
|
|
34
|
-
- [How to report issue](#-how-to-report-issue)
|
|
35
|
-
- [License](#-license)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## 📋 Prerequisite
|
|
39
|
-
|
|
40
|
-
FOSSLight Util needs a Python 3.6+.
|
|
41
|
-
|
|
42
|
-
## 🎉 How to install
|
|
43
|
-
|
|
44
|
-
It can be installed using pip3.
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
$ pip3 install fosslight_util
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## 🚀 How to use
|
|
51
|
-
|
|
52
|
-
Three modules can be called. Please refer to each file for detailed calling method.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### 1. Setup logger (tests/test_log.py)
|
|
56
|
-
```
|
|
57
|
-
from fosslight_util.set_log import init_log
|
|
58
|
-
|
|
59
|
-
# 1st param : log file path
|
|
60
|
-
# 2nd param : create file (True/False)
|
|
61
|
-
# 3rd param : stream log level
|
|
62
|
-
# 4th param : file log level
|
|
63
|
-
# =>log level(CRITICAL:50, ERROR:40, WARNING:30, INFO:20, DEBUG:10, NOTSET:0)
|
|
64
|
-
# 5th param : package name of fosslight scanners (fosslight_source / fosslight_dependency / fosslight_reuse)
|
|
65
|
-
# 6th param : path to analyze
|
|
66
|
-
#
|
|
67
|
-
# 1st return value : a logger
|
|
68
|
-
# 2nd return value : log items to print
|
|
69
|
-
|
|
70
|
-
def test():
|
|
71
|
-
logger, log_item = init_log("test_result/log_file1.txt", True, 30, 20)
|
|
72
|
-
logger.warning("TESTING - Print log")
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### 2. Write result files (tests/test_output_format.py)
|
|
77
|
-
```
|
|
78
|
-
from fosslight_util.output_format import write_output_file
|
|
79
|
-
|
|
80
|
-
# 2nd param : output file format
|
|
81
|
-
# => file format(excel: .xlsx, csv: .csv, opossum: .json)
|
|
82
|
-
def test():
|
|
83
|
-
sheet_contents = {'SRC':[['run_scancode.py', 'fosslight_source',
|
|
84
|
-
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_source', 'https://github.com/LGE-OSS/fosslight_source', 'Copyright (c) 2021 LG Electronics, Inc.', 'Exclude', 'Comment message'],
|
|
85
|
-
['dependency_unified.py', 'fosslight_dependency',
|
|
86
|
-
'3.0.6', 'Apache-2.0', 'https://github.com/LGE-OSS/fosslight_dependency', 'https://github.com/LGE-OSS/fosslight_dependency', 'Copyright (c) 2020 LG Electronics, Inc.', '', '']],
|
|
87
|
-
'BIN':[['askalono.exe', 'askalono',
|
|
88
|
-
'0.4.3', 'Apache-2.0', 'https://github.com/jpeddicord/askalono', '', 'Copyright (c) 2018 Amazon.com, Inc. or its affiliates.', '', '']]}
|
|
89
|
-
success, msg = write_output_file('test_result/excel/FOSSLight-Report', '.xlsx', sheet_contents)
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 3. Get spdx licenses (tests/test_spdx_licenses.py)
|
|
93
|
-
```
|
|
94
|
-
from fosslight_util.spdx_licenses import get_spdx_licenses_json
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def test():
|
|
98
|
-
success, error_msg, licenses = get_spdx_licenses_json()
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 4. Load common constant (tests/_print_log_with_another_logger.py)
|
|
102
|
-
```
|
|
103
|
-
import fosslight_util.constant as constant
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
107
|
-
logger.warning("Get a logger after init_log is called once.")
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### 5. Call a spinner (tests/test_timer.py)
|
|
111
|
-
```
|
|
112
|
-
from fosslight_util.timer_thread import TimerThread
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
timer = TimerThread()
|
|
116
|
-
timer.setDaemon(True)
|
|
117
|
-
timer.start()
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### 6. Download the source code (tests/test_download.py)
|
|
121
|
-
If you give a link, the source is downloaded to the target directory through git clone or wget.
|
|
122
|
-
|
|
123
|
-
#### How it works
|
|
124
|
-
1. Try git clone.
|
|
125
|
-
1-1. If the link is ssh-url, convert to https-url.
|
|
126
|
-
2. If git clone fails, download it with wget and extract the compressed file.
|
|
127
|
-
3. After extracting the compressed file, delete the compressed file.
|
|
128
|
-
|
|
129
|
-
#### Parameters
|
|
130
|
-
| Parameter | Argument | Description |
|
|
131
|
-
| ------------- | ------------- | ------------- |
|
|
132
|
-
| h | None | Print help message. |
|
|
133
|
-
| s | String | Link to download. |
|
|
134
|
-
| t | String | Path to download and extract. |
|
|
135
|
-
| d | String | Path to save a log file. |
|
|
136
|
-
|
|
137
|
-
#### How to run
|
|
138
|
-
```
|
|
139
|
-
$ fosslight_download -s "https://github.com/LGE-OSS/example" -t target_dir/
|
|
140
|
-
```
|
|
141
|
-
If you want to try with private repository, set your github token like below.
|
|
142
|
-
```
|
|
143
|
-
$ fosslight_download -s "https://my_github_token@github.com/Foo/private_repo -t target_dir/"
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## 👏 How to report issue
|
|
147
|
-
|
|
148
|
-
Please report any ideas or bugs to improve by creating an issue in [fosslight_util repository][cl]. Then there will be quick bug fixes and upgrades. Ideas to improve are always welcome.
|
|
149
|
-
|
|
150
|
-
[cl]: https://github.com/fosslight/fosslight_util/issues
|
|
151
|
-
|
|
152
|
-
## 📄 License
|
|
153
|
-
|
|
154
|
-
FOSSLight Util is released under [Apache-2.0][l].
|
|
155
|
-
|
|
156
|
-
[l]: https://github.com/fosslight/fosslight_util/blob/main/LICENSE
|
|
157
|
-
|
|
158
|
-
Platform: UNKNOWN
|
|
159
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
160
|
-
Classifier: Programming Language :: Python :: 3
|
|
161
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
162
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
163
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
164
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
165
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
166
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
167
|
-
Description-Content-Type: text/markdown
|
|
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
|
|
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
|
{fosslight_util-2.1.19 → fosslight_util-2.1.20}/src/fosslight_util.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|