Skip to content

Commit c4d4197

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

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
@@ -250,17 +250,22 @@ def install_pkg(env_root, bsp_root, pkg):
250250
get_ver_sha = None
251251
upstream_change_flag = False
252252

253-
if os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE'):
254-
get_package_url, get_ver_sha = get_url_from_mirror_server(pkgs_name_in_json, pkg['ver'])
253+
try:
254+
if os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE'):
255+
get_package_url, get_ver_sha = get_url_from_mirror_server(pkgs_name_in_json, pkg['ver'])
255256

256-
# determine whether the package package url is valid
257-
if get_package_url != None and determine_url_valid(get_package_url):
258-
package_url = get_package_url
257+
# determine whether the package package url is valid
258+
if get_package_url != None and determine_url_valid(get_package_url):
259+
package_url = get_package_url
259260

260-
if get_ver_sha != None:
261-
ver_sha = get_ver_sha
261+
if get_ver_sha != None:
262+
ver_sha = get_ver_sha
262263

263-
upstream_change_flag = True
264+
upstream_change_flag = True
265+
266+
except Exception, e:
267+
# print('e.message:%s\t' % e.message)
268+
print("Failed to obtain mirror url, package will be downloaded from non-mirror server.")
264269

265270
if package_url[-4:] == '.git':
266271

0 commit comments

Comments
 (0)