fosslight-util 1.4.41__py3-none-any.whl → 1.4.42__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.
@@ -61,13 +61,21 @@ def change_src_link_to_https(src_link):
61
61
  return src_link
62
62
 
63
63
 
64
+ def change_ssh_link_to_https(src_link):
65
+ src_link = src_link.replace("git@github.com:", "https://github.com/")
66
+ return src_link
67
+
68
+
64
69
  def parse_src_link(src_link):
65
70
  src_info = {"url": src_link}
66
71
  src_link_changed = ""
67
- if src_link.startswith("git://") or src_link.startswith("https://") or src_link.startswith("http://"):
72
+ if src_link.startswith("git://") or src_link.startswith("git@") \
73
+ or src_link.startswith("https://") or src_link.startswith("http://"):
68
74
  src_link_split = src_link.split(';')
69
75
  if src_link.startswith("git://github.com/"):
70
76
  src_link_changed = change_src_link_to_https(src_link_split[0])
77
+ elif src_link.startswith("git@github.com:"):
78
+ src_link_changed = change_ssh_link_to_https(src_link_split[0])
71
79
  else:
72
80
  if "rubygems.org" in src_link:
73
81
  src_info["rubygems"] = True
@@ -205,11 +213,24 @@ def get_github_ossname(link):
205
213
  return oss_name
206
214
 
207
215
 
216
+ def get_github_token(git_url):
217
+ github_token = ""
218
+ pattern = r'https://(.*?)@'
219
+ search = re.search(pattern, git_url)
220
+ if search:
221
+ github_token = search.group(1)
222
+ return github_token
223
+
224
+
208
225
  def download_git_clone(git_url, target_dir, checkout_to="", tag="", branch=""):
209
226
  ref_to_checkout = decide_checkout(checkout_to, tag, branch)
210
227
  msg = ""
211
228
  oss_name = get_github_ossname(git_url)
212
229
  oss_version = ""
230
+ github_token = get_github_token(git_url)
231
+ callbacks = None
232
+ if github_token != "":
233
+ callbacks = git.RemoteCallbacks(credentials=git.UserPass("foo", github_token)) # username is not used, so set to dummy
213
234
 
214
235
  if platform.system() != "Windows":
215
236
  signal.signal(signal.SIGALRM, alarm_handler)
@@ -221,7 +242,7 @@ def download_git_clone(git_url, target_dir, checkout_to="", tag="", branch=""):
221
242
  Path(target_dir).mkdir(parents=True, exist_ok=True)
222
243
  repo = git.clone_repository(git_url, target_dir,
223
244
  bare=False, repository=None,
224
- remote=None, callbacks=None)
245
+ remote=None, callbacks=callbacks)
225
246
  if platform.system() != "Windows":
226
247
  signal.alarm(0)
227
248
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight-util
3
- Version: 1.4.41
3
+ Version: 1.4.42
4
4
  Summary: FOSSLight Util
5
5
  Home-page: https://github.com/fosslight/fosslight_util
6
6
  Author: LG Electronics
@@ -152,6 +152,7 @@ If you give a link, the source is downloaded to the target directory through git
152
152
 
153
153
  #### How it works
154
154
  1. Try git clone.
155
+ 1-1. If the link is ssh-url, convert to https-url.
155
156
  2. If git clone fails, download it with wget and extract the compressed file.
156
157
  3. After extracting the compressed file, delete the compressed file.
157
158
 
@@ -165,7 +166,11 @@ If you give a link, the source is downloaded to the target directory through git
165
166
 
166
167
  #### How to run
167
168
  ```
168
- $ fosslight_download -s "https://github.com/LGE-OSS/example" -t target_dir/
169
+ $ fosslight_download -s "https://github.com/LGE-OSS/example" -t target_dir/
170
+ ```
171
+ If you want to try with private repository, set your github token like below.
172
+ ```
173
+ $ fosslight_download -s "https://my_github_token@github.com/Foo/private_repo -t target_dir/"
169
174
  ```
170
175
 
171
176
  ## 👏 How to report issue
@@ -5,7 +5,7 @@ fosslight_util/constant.py,sha256=j9uhncoC2Fn4j4ATNsjUoS91nVXhyGzU6xLyWFj941A,18
5
5
  fosslight_util/convert_excel_to_yaml.py,sha256=7ZsAMMQJIEXrmcl_28nSHvFpGMi1ZiRZYpEfI5O8vP8,2298
6
6
  fosslight_util/correct.py,sha256=v4OL8XssYuatcP9G0YhnLChWUiJP8rwoyWDeMmQGT0E,5334
7
7
  fosslight_util/cover.py,sha256=21l-BS3ZJ8nDxMLHKGT9igB3XbCme55A0eQf01jbISM,1436
8
- fosslight_util/download.py,sha256=6dxT-vW3GORPIJ0J5ZW48NyEgq28YezREoJ_9vMuKvE,13743
8
+ fosslight_util/download.py,sha256=4_s1zPEpxPQ7FNkDo0f6MdrQLMOVdjifDO7Y5psqAq8,14484
9
9
  fosslight_util/help.py,sha256=xhAf43fuRLOU3TE7jqaxVTizVn4aANDvHaHYQAdaqYc,2154
10
10
  fosslight_util/oss_item.py,sha256=JxGokv79z_6Ca4-Aquc_zZEvRqu-xmBunP8Lvy6AIjY,7268
11
11
  fosslight_util/output_format.py,sha256=kJpuTuS3XTrsdUd2gsl5GWto5KtJfSej-qkD9azZFdQ,2982
@@ -23,9 +23,9 @@ fosslight_util/write_yaml.py,sha256=iJcG3ItggoBp8p3m8PAZwULehKo3BlH1qW2rZzlDv8g,
23
23
  fosslight_util/resources/frequentLicenselist.json,sha256=GUhzK6tu7ok10fekOnmVmUgIGRC-acGABZKTNKfDyYA,4776157
24
24
  fosslight_util/resources/frequent_license_nick_list.json,sha256=ryU2C_6ZxHbz90_sUN9OvI9GXkCMLu7oGcmd9W79YYo,5005
25
25
  fosslight_util/resources/licenses.json,sha256=mK55z-bhY7Mjpj2KsO1crKGGL-X3F6MBFQJ0zLlx010,240843
26
- fosslight_util-1.4.41.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
- fosslight_util-1.4.41.dist-info/METADATA,sha256=iTakcrZfZZ2Iz321MpLdiK8_yGcG2_i8xLQnjlLTE0A,6189
28
- fosslight_util-1.4.41.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
29
- fosslight_util-1.4.41.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
30
- fosslight_util-1.4.41.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
31
- fosslight_util-1.4.41.dist-info/RECORD,,
26
+ fosslight_util-1.4.42.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
+ fosslight_util-1.4.42.dist-info/METADATA,sha256=Gwh1UV3hbzKi2Urxb-w9bJzw9uA1YzrTySAD-7C4ohU,6418
28
+ fosslight_util-1.4.42.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
29
+ fosslight_util-1.4.42.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
30
+ fosslight_util-1.4.42.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
31
+ fosslight_util-1.4.42.dist-info/RECORD,,