fosslight-util 2.1.19__tar.gz → 2.1.21__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.
Files changed (41) hide show
  1. fosslight_util-2.1.21/PKG-INFO +164 -0
  2. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/README.md +1 -1
  3. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/requirements.txt +1 -2
  4. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/setup.py +3 -8
  5. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/_get_downloadable_url.py +4 -0
  6. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/download.py +30 -2
  7. fosslight_util-2.1.21/src/fosslight_util.egg-info/PKG-INFO +164 -0
  8. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util.egg-info/entry_points.txt +0 -1
  9. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util.egg-info/requires.txt +1 -12
  10. fosslight_util-2.1.19/PKG-INFO +0 -167
  11. fosslight_util-2.1.19/src/fosslight_util.egg-info/PKG-INFO +0 -167
  12. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/LICENSE +0 -0
  13. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/MANIFEST.in +0 -0
  14. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/setup.cfg +0 -0
  15. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/__init__.py +0 -0
  16. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/compare_yaml.py +0 -0
  17. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/constant.py +0 -0
  18. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/correct.py +0 -0
  19. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/cover.py +0 -0
  20. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/exclude.py +0 -0
  21. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/help.py +0 -0
  22. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/oss_item.py +0 -0
  23. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/output_format.py +0 -0
  24. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/parsing_yaml.py +0 -0
  25. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/read_excel.py +0 -0
  26. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
  27. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
  28. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/resources/licenses.json +0 -0
  29. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/set_log.py +0 -0
  30. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/spdx_licenses.py +0 -0
  31. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/timer_thread.py +0 -0
  32. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/write_cyclonedx.py +0 -0
  33. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/write_excel.py +0 -0
  34. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/write_opossum.py +0 -0
  35. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/write_scancodejson.py +0 -0
  36. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/write_spdx.py +0 -0
  37. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/write_txt.py +0 -0
  38. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util/write_yaml.py +0 -0
  39. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
  40. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
  41. {fosslight_util-2.1.19 → fosslight_util-2.1.21}/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.21
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" /> [![REUSE status](https://api.reuse.software/badge/github.com/fosslight/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
@@ -29,7 +29,7 @@ It is a package that supports common utils used by FOSSLight Scanner.
29
29
 
30
30
  ## 📋 Prerequisite
31
31
 
32
- FOSSLight Util needs a Python 3.6+.
32
+ FOSSLight Util needs a Python 3.10+.
33
33
 
34
34
  ## 🎉 How to install
35
35
 
@@ -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; python_version < '3.8'
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.19',
17
+ version='2.1.21',
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
 
@@ -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) -> Tuple[bool, str, str, str]:
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__':
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.1
2
+ Name: fosslight-util
3
+ Version: 2.1.21
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" /> [![REUSE status](https://api.reuse.software/badge/github.com/fosslight/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
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  fosslight_download = fosslight_util.download:main
3
-
@@ -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.*
@@ -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" /> [![REUSE status](https://api.reuse.software/badge/github.com/fosslight/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" /> [![REUSE status](https://api.reuse.software/badge/github.com/fosslight/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