@@ -60,7 +60,7 @@ def report_progress(count, blockSize, totalSize):
60
60
61
61
def unpack (filename , destination ):
62
62
dirname = ''
63
- print ('Extracting {0}' .format (os .path .basename (filename )))
63
+ print ('Extracting {0} ... ' .format (os .path .basename (filename )))
64
64
sys .stdout .flush ()
65
65
if filename .endswith ('tar.gz' ):
66
66
tfile = tarfile .open (filename , 'r:gz' )
@@ -76,7 +76,7 @@ def unpack(filename, destination):
76
76
# a little trick to rename tool directories so they don't contain version number
77
77
rename_to = re .match (r'^([a-z][^\-]*\-*)+' , dirname ).group (0 ).strip ('-' )
78
78
if rename_to != dirname :
79
- print ('Renaming {0} to {1}' .format (dirname , rename_to ))
79
+ print ('Renaming {0} to {1} ... ' .format (dirname , rename_to ))
80
80
if os .path .isdir (rename_to ):
81
81
shutil .rmtree (rename_to )
82
82
shutil .move (dirname , rename_to )
@@ -106,9 +106,8 @@ def get_tool(tool):
106
106
archive_name = tool ['archiveFileName' ]
107
107
local_path = dist_dir + archive_name
108
108
url = tool ['url' ]
109
- #real_hash = tool['checksum'].split(':')[1]
110
109
if not os .path .isfile (local_path ):
111
- print ('Downloading ' + archive_name )
110
+ print ('Downloading ' + archive_name + ' ...' )
112
111
sys .stdout .flush ()
113
112
if 'CYGWIN_NT' in sys_name :
114
113
import ssl
@@ -127,15 +126,11 @@ def get_tool(tool):
127
126
download_file (url , local_path )
128
127
else :
129
128
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 ()
132
131
else :
133
132
print ('Tool {0} already downloaded' .format (archive_name ))
134
133
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()
139
134
unpack (local_path , '.' )
140
135
141
136
def load_tools_list (filename , platform ):
@@ -158,11 +153,11 @@ def identify_platform():
158
153
bits = 64
159
154
sys_name = platform .system ()
160
155
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 ):
163
157
sys_name = 'LinuxARM'
164
158
if 'CYGWIN_NT' in sys_name :
165
159
sys_name = 'Windows'
160
+ print ('System: %s, Bits: %d, Info: %s' % (sys_name , bits , sys_platform ))
166
161
return arduino_platform_names [sys_name ][bits ]
167
162
168
163
if __name__ == '__main__' :
@@ -172,4 +167,4 @@ def identify_platform():
172
167
mkdir_p (dist_dir )
173
168
for tool in tools_to_download :
174
169
get_tool (tool )
175
- print ('Done ' )
170
+ print ('Platform Tools Installed ' )
0 commit comments