@@ -60,7 +60,7 @@ def report_progress(count, blockSize, totalSize):
6060
6161def unpack (filename , destination ):
6262 dirname = ''
63- print ('Extracting {0}' .format (os .path .basename (filename )))
63+ print ('Extracting {0} ... ' .format (os .path .basename (filename )))
6464 sys .stdout .flush ()
6565 if filename .endswith ('tar.gz' ):
6666 tfile = tarfile .open (filename , 'r:gz' )
@@ -76,7 +76,7 @@ def unpack(filename, destination):
7676 # a little trick to rename tool directories so they don't contain version number
7777 rename_to = re .match (r'^([a-z][^\-]*\-*)+' , dirname ).group (0 ).strip ('-' )
7878 if rename_to != dirname :
79- print ('Renaming {0} to {1}' .format (dirname , rename_to ))
79+ print ('Renaming {0} to {1} ... ' .format (dirname , rename_to ))
8080 if os .path .isdir (rename_to ):
8181 shutil .rmtree (rename_to )
8282 shutil .move (dirname , rename_to )
@@ -106,9 +106,8 @@ def get_tool(tool):
106106 archive_name = tool ['archiveFileName' ]
107107 local_path = dist_dir + archive_name
108108 url = tool ['url' ]
109- #real_hash = tool['checksum'].split(':')[1]
110109 if not os .path .isfile (local_path ):
111- print ('Downloading ' + archive_name )
110+ print ('Downloading ' + archive_name + ' ...' )
112111 sys .stdout .flush ()
113112 if 'CYGWIN_NT' in sys_name :
114113 import ssl
@@ -127,15 +126,11 @@ def get_tool(tool):
127126 download_file (url , local_path )
128127 else :
129128 urlretrieve (url , local_path , report_progress )
130- sys .stdout .write ("\r Done\n " )
131- sys .stdout .flush ()
129+ sys .stdout .write ("\r Done\n " )
130+ sys .stdout .flush ()
132131 else :
133132 print ('Tool {0} already downloaded' .format (archive_name ))
134133 sys .stdout .flush ()
135- #local_hash = sha256sum(local_path)
136- #if local_hash != real_hash:
137- # print('Hash mismatch for {0}, delete the file and try again'.format(local_path))
138- # raise RuntimeError()
139134 unpack (local_path , '.' )
140135
141136def load_tools_list (filename , platform ):
@@ -158,11 +153,11 @@ def identify_platform():
158153 bits = 64
159154 sys_name = platform .system ()
160155 sys_platform = platform .platform ()
161- print ('System: %s, Info: %s' % (sys_name , sys_platform ))
162- if 'Linux' in sys_name and (sys_platform .find ('arm' ) > 0 or sys_platform .find ('aarch64' )):
156+ if 'Linux' in sys_name and (sys_platform .find ('arm' ) > 0 or sys_platform .find ('aarch64' ) > 0 ):
163157 sys_name = 'LinuxARM'
164158 if 'CYGWIN_NT' in sys_name :
165159 sys_name = 'Windows'
160+ print ('System: %s, Bits: %d, Info: %s' % (sys_name , bits , sys_platform ))
166161 return arduino_platform_names [sys_name ][bits ]
167162
168163if __name__ == '__main__' :
@@ -172,4 +167,4 @@ def identify_platform():
172167 mkdir_p (dist_dir )
173168 for tool in tools_to_download :
174169 get_tool (tool )
175- print ('Done ' )
170+ print ('Platform Tools Installed ' )
0 commit comments