fosslight-util 2.1.20__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/download.py +30 -2
- {fosslight_util-2.1.20.dist-info → fosslight_util-2.1.21.dist-info}/METADATA +1 -1
- {fosslight_util-2.1.20.dist-info → fosslight_util-2.1.21.dist-info}/RECORD +7 -7
- {fosslight_util-2.1.20.dist-info → fosslight_util-2.1.21.dist-info}/LICENSE +0 -0
- {fosslight_util-2.1.20.dist-info → fosslight_util-2.1.21.dist-info}/WHEEL +0 -0
- {fosslight_util-2.1.20.dist-info → fosslight_util-2.1.21.dist-info}/entry_points.txt +0 -0
- {fosslight_util-2.1.20.dist-info → fosslight_util-2.1.21.dist-info}/top_level.txt +0 -0
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__':
|
|
@@ -4,7 +4,7 @@ fosslight_util/compare_yaml.py,sha256=eLqqCLgERxRHN5vsnpQVMXIEU862Lx66mD_y4uMgQE
|
|
|
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
|
|
File without changes
|