Skip to content

Commit 05a8977

Browse files
committed
【完善】:当镜像服务器连接错误使,默认使用非镜像地址下载
1 parent 30604a1 commit 05a8977

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

cmds/cmd_package.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,22 @@ def install_pkg(env_root, bsp_root, pkg):
281281
get_ver_sha = None
282282
upstream_change_flag = False
283283

284-
if os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE'):
285-
get_package_url, get_ver_sha = get_url_from_mirror_server(pkgs_name_in_json, pkg['ver'])
284+
try:
285+
if os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE'):
286+
get_package_url, get_ver_sha = get_url_from_mirror_server(pkgs_name_in_json, pkg['ver'])
286287

287-
# determine whether the package package url is valid
288-
if get_package_url != None and determine_url_valid(get_package_url):
289-
package_url = get_package_url
288+
# determine whether the package package url is valid
289+
if get_package_url != None and determine_url_valid(get_package_url):
290+
package_url = get_package_url
290291

291-
if get_ver_sha != None:
292-
ver_sha = get_ver_sha
292+
if get_ver_sha != None:
293+
ver_sha = get_ver_sha
293294

294-
upstream_change_flag = True
295+
upstream_change_flag = True
296+
297+
except Exception, e:
298+
# print('e.message:%s\t' % e.message)
299+
print("Failed to obtain mirror url, package will be downloaded from non-mirror server.")
295300

296301
if package_url[-4:] == '.git':
297302

0 commit comments

Comments
 (0)