fosslight-util 2.1.18__py3-none-any.whl → 2.1.19__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.
@@ -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
@@ -66,10 +65,11 @@ def get_latest_package_version(link, pkg_type, oss_name):
66
65
 
67
66
  try:
68
67
  if pkg_type in ['npm', 'npm2']:
69
- stderr, stdout = npm_run('view', oss_name, 'version')
70
- if stdout:
71
- find_version = stdout.strip()
72
- link_with_version = f'https://www.npmjs.com/package/{oss_name}/v/{find_version}'
68
+ npm_response = requests.get(f"https://registry.npmjs.org/{oss_name}")
69
+ if npm_response.status_code == 200:
70
+ find_version = npm_response.json().get("dist-tags", {}).get("latest")
71
+ if find_version:
72
+ link_with_version = f'https://www.npmjs.com/package/{oss_name}/v/{find_version}'
73
73
  elif pkg_type == 'pypi':
74
74
  find_version = str(latest(oss_name, at='pip', output_format='version', pre_ok=True))
75
75
  link_with_version = f'https://pypi.org/project/{oss_name}/{find_version}'
@@ -78,17 +78,20 @@ def get_latest_package_version(link, pkg_type, oss_name):
78
78
  if maven_response.status_code == 200:
79
79
  find_version = maven_response.json().get('versions')[-1].get('versionKey').get('version')
80
80
  oss_name = oss_name.replace(':', '/')
81
- link_with_version = f'https://mvnrepository.com/artifact/{oss_name}/{find_version}'
81
+ if find_version:
82
+ link_with_version = f'https://mvnrepository.com/artifact/{oss_name}/{find_version}'
82
83
  elif pkg_type == 'pub':
83
84
  pub_response = requests.get(f'https://pub.dev/api/packages/{oss_name}')
84
85
  if pub_response.status_code == 200:
85
86
  find_version = pub_response.json().get('latest').get('version')
86
- link_with_version = f'https://pub.dev/packages/{oss_name}/versions/{find_version}'
87
+ if find_version:
88
+ link_with_version = f'https://pub.dev/packages/{oss_name}/versions/{find_version}'
87
89
  elif pkg_type == 'go':
88
90
  go_response = requests.get(f'https://proxy.golang.org/{oss_name}/@latest')
89
91
  if go_response.status_code == 200:
90
92
  find_version = go_response.json().get('Version')
91
- link_with_version = f'https://pkg.go.dev/{oss_name}@{find_version}'
93
+ if find_version:
94
+ link_with_version = f'https://pkg.go.dev/{oss_name}@{find_version}'
92
95
  except Exception as e:
93
96
  logger.info(f'Fail to get latest package version({link}:{e})')
94
97
  return find_version, link_with_version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight-util
3
- Version: 2.1.18
3
+ Version: 2.1.19
4
4
  Summary: FOSSLight Util
5
5
  Home-page: https://github.com/fosslight/fosslight_util
6
6
  Author: LG Electronics
@@ -27,7 +27,6 @@ Requires-Dist: python3-wget
27
27
  Requires-Dist: beautifulsoup4
28
28
  Requires-Dist: jsonmerge
29
29
  Requires-Dist: setuptools>=65.5.1
30
- Requires-Dist: npm
31
30
  Requires-Dist: requests
32
31
  Requires-Dist: GitPython
33
32
  Requires-Dist: numpy; python_version < "3.8"
@@ -1,5 +1,5 @@
1
1
  fosslight_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- fosslight_util/_get_downloadable_url.py,sha256=SqXCESg1GVXhCpObZoceXdFJVecDrDp-7qW88w0QsCY,12091
2
+ fosslight_util/_get_downloadable_url.py,sha256=TbzzW-MJky-A610mgw5bpf6xmELyQAwXo9jfubi05d8,12271
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.18.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
28
- fosslight_util-2.1.18.dist-info/METADATA,sha256=eiYd-q6MOwvzp-SPII-NU2MPNQs6rdm9PgPZEWdweFY,6500
29
- fosslight_util-2.1.18.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
30
- fosslight_util-2.1.18.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
31
- fosslight_util-2.1.18.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
32
- fosslight_util-2.1.18.dist-info/RECORD,,
27
+ fosslight_util-2.1.19.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
28
+ fosslight_util-2.1.19.dist-info/METADATA,sha256=rqYqFM4FZEKmhmATRltYAJreokGayqWFTX2tENCgje4,6481
29
+ fosslight_util-2.1.19.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
30
+ fosslight_util-2.1.19.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
31
+ fosslight_util-2.1.19.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
32
+ fosslight_util-2.1.19.dist-info/RECORD,,