Skip to content

Commit 94c779b

Browse files
committed
Update get.py to support Apple ARM64
1 parent 5ab7d6d commit 94c779b

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

tools/get.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -181,20 +181,34 @@ def load_tools_list(filename, platform):
181181
for t in tools_info:
182182
tool_platform = [p for p in t['systems'] if p['host'] == platform]
183183
if len(tool_platform) == 0:
184-
continue
184+
# Fallback to x86 on Apple ARM
185+
if platform == 'arm64-apple-darwin':
186+
tool_platform = [p for p in t['systems'] if p['host'] == 'x86_64-apple-darwin']
187+
if len(tool_platform) == 0:
188+
continue
189+
# Fallback to 32bit on 64bit x86 Windows
190+
elif platform == 'x86_64-mingw32':
191+
tool_platform = [p for p in t['systems'] if p['host'] == 'i686-mingw32']
192+
if len(tool_platform) == 0:
193+
continue
194+
else:
195+
continue
185196
tools_to_download.append(tool_platform[0])
186197
return tools_to_download
187198

188199
def identify_platform():
189-
arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'},
190-
'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'},
191-
'LinuxARM': {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'},
192-
'Windows' : {32 : 'i686-mingw32', 64 : 'i686-mingw32'}}
200+
arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'},
201+
'DarwinARM': {32 : 'arm64-apple-darwin', 64 : 'arm64-apple-darwin'},
202+
'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'},
203+
'LinuxARM' : {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'},
204+
'Windows' : {32 : 'i686-mingw32', 64 : 'x86_64-mingw32'}}
193205
bits = 32
194206
if sys.maxsize > 2**32:
195207
bits = 64
196208
sys_name = platform.system()
197209
sys_platform = platform.platform()
210+
if 'Darwin' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('arm64') > 0):
211+
sys_name = 'DarwinARM'
198212
if 'Linux' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('aarch64') > 0):
199213
sys_name = 'LinuxARM'
200214
if 'CYGWIN_NT' in sys_name:

0 commit comments

Comments
 (0)