@@ -184,8 +184,8 @@ def get_url_from_mirror_server(pkgs_name_in_json, pkgs_ver):
184184 return None , None
185185
186186 except Exception , e :
187- print ('e.message:%s\t ' % e .message )
188- print ("The server could not be contacted. Please check your network connection." )
187+ # print('e.message:%s\t' % e.message)
188+ print ("\n The mirror server could not be contacted. Please check your network connection." )
189189
190190
191191def determine_url_valid (url_from_srv ):
@@ -264,19 +264,22 @@ def install_pkg(env_root, bsp_root, pkg):
264264 upstream_change_flag = True
265265 except Exception , e :
266266 # print('e.message:%s\t' % e.message)
267- print ("Failed to connect to the mirror server, package will be downloaded from non-mirror server." )
267+ print ("Failed to connect to the mirror server, package will be downloaded from non-mirror server.\n " )
268268
269269 if package_url [- 4 :] == '.git' :
270+ try :
271+ repo_path = os .path .join (bsp_pkgs_path , pkgs_name_in_json )
272+ repo_path = repo_path + '-' + pkg ['ver' ]
273+ repo_path_full = '"' + repo_path + '"'
270274
271- repo_path = os .path .join (bsp_pkgs_path , pkgs_name_in_json )
272- repo_path = repo_path + '-' + pkg ['ver' ]
273- repo_path_full = '"' + repo_path + '"'
274-
275- cmd = 'git clone ' + package_url + ' ' + repo_path_full
276- execute_command (cmd , cwd = bsp_pkgs_path )
275+ cmd = 'git clone ' + package_url + ' ' + repo_path_full
276+ execute_command (cmd , cwd = bsp_pkgs_path )
277277
278- cmd = 'git checkout -q ' + ver_sha
279- execute_command (cmd , cwd = repo_path )
278+ cmd = 'git checkout -q ' + ver_sha
279+ execute_command (cmd , cwd = repo_path )
280+ except Exception , e :
281+ print ("\n Failed to download software package with git. Please check the network connection." )
282+ # sys.exit(0)
280283
281284 if upstream_change_flag :
282285 cmd = 'git remote set-url origin ' + url_from_json
@@ -422,7 +425,7 @@ def git_cmd_exec(cmd, cwd):
422425 execute_command (cmd , cwd = cwd )
423426 except Exception , e :
424427 print ('error message:%s%s. %s \n You can solve this problem by manually removing old packages and re-downloading them using env.\t ' %
425- (cwd , " path doesn't exist" , e .message ))
428+ (cwd . encode ( "utf-8" ) , " path doesn't exist" , e .message ))
426429
427430
428431def update_latest_packages (pkgs_fn , bsp_packages_path ):
@@ -961,9 +964,7 @@ def upgrade_packages_index():
961964 git_repo = 'https://gitee.com/RT-Thread-Mirror/packages.git'
962965 else :
963966 git_repo = 'https://github.com/RT-Thread/packages.git'
964-
965- # print(get_package_url,get_ver_sha)
966-
967+
967968 packages_root = os .path .join (env_root , 'packages' )
968969 pkgs_path = os .path .join (packages_root , 'packages' )
969970
@@ -1008,8 +1009,6 @@ def upgrade_env_script():
10081009 else :
10091010 env_scripts_repo = 'https://github.com/RT-Thread/env.git'
10101011
1011- # print(get_package_url,get_ver_sha)
1012-
10131012 env_scripts_root = os .path .join (env_root , 'tools' , 'scripts' )
10141013 cmd = r'git pull ' + env_scripts_repo
10151014 execute_command (cmd , cwd = env_scripts_root )
0 commit comments