File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 77# LICENSE file in the root directory of this source tree.
88
99import argparse
10+ import certifi
1011import os
1112import platform
13+ import ssl
1214import stat
1315import sys
1416import urllib .request
@@ -205,15 +207,15 @@ def resolve_buck2(args: argparse.Namespace) -> Union[str, int]:
205207
206208 try :
207209 print (f"Downloading buck2 from { buck2_archive_url } ..." , file = sys .stderr )
208- archive_file , _ = urllib . request . urlretrieve ( buck2_archive_url )
210+ ssl_context = ssl . create_default_context ( cafile = certifi . where () )
209211
210- # Extract and chmod.
211- with open ( archive_file , "rb" ) as f :
212- data = f .read ()
212+ with urllib . request . urlopen ( buck2_archive_url ) as request :
213+ # Extract and chmod.
214+ data = request .read ()
213215 decompressed_bytes = zstd .decompress (data )
214216
215- with open (buck2_local_path , "wb" ) as f :
216- f .write (decompressed_bytes )
217+ with open (buck2_local_path , "wb" ) as f :
218+ f .write (decompressed_bytes )
217219
218220 file_stat = os .stat (buck2_local_path )
219221 os .chmod (buck2_local_path , file_stat .st_mode | stat .S_IEXEC )
You can’t perform that action at this time.
0 commit comments