@@ -321,8 +321,14 @@ def download_bazel_into_directory(version, is_commit, directory):
321321 fallback_url = "https://releases.bazel.build/{}/{}/{}" .format (
322322 version , rc if rc else "release" , bazel_filename
323323 )
324- download (fallback_url , destination_path )
325- return destination_path
324+ download (fallback_url + ".sha256" , sha256_path )
325+ os .remove (destination_path )
326+ download (fallback_url ,destination_path )
327+ os .chmod (destination_path , 0o755 )
328+ else :
329+ return destination_path
330+ else :
331+ return destination_path
326332 raise e
327333 with open (sha256_path , "r" ) as sha_file :
328334 expected_hash = sha_file .read ().split ()[0 ]
@@ -338,11 +344,16 @@ def download_bazel_into_directory(version, is_commit, directory):
338344 expected_hash , actual_hash
339345 )
340346 )
341- (version , rc ) = re .match (r"(\d*\.\d*(?:\.\d*)?)(rc\d+)?" , version ).groups ()
342- fallback_url = "https://releases.bazel.build/{}/{}/{}" .format (
343- version , rc if rc else "release" , bazel_filename
344- )
345- download (fallback_url , destination_path )
347+ matched = re .match (r"(\d*\.\d*(?:\.\d*)?)(rc\d+)?" , version )
348+ if matched :
349+ (version , rc ) = matched .groups ()
350+ fallback_url = "https://releases.bazel.build/{}/{}/{}" .format (
351+ version , rc if rc else "release" , bazel_filename
352+ )
353+ download (fallback_url + ".sha256" , sha256_path )
354+ os .remove (destination_path )
355+ download (fallback_url ,destination_path )
356+ os .chmod (destination_path , 0o755 )
346357 return destination_path
347358
348359
0 commit comments