Skip to content

Commit 0ee74ee

Browse files
committed
Update get.py to support Apple ARM64
1 parent 18c0a6c commit 0ee74ee

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
@@ -177,20 +177,34 @@ def load_tools_list(filename, platform):
177177
for t in tools_info:
178178
tool_platform = [p for p in t['systems'] if p['host'] == platform]
179179
if len(tool_platform) == 0:
180-
continue
180+
# Fallback to x86 on Apple ARM
181+
if platform == 'arm64-apple-darwin':
182+
tool_platform = [p for p in t['systems'] if p['host'] == 'x86_64-apple-darwin']
183+
if len(tool_platform) == 0:
184+
continue
185+
# Fallback to 32bit on 64bit x86 Windows
186+
elif platform == 'x86_64-mingw32':
187+
tool_platform = [p for p in t['systems'] if p['host'] == 'i686-mingw32']
188+
if len(tool_platform) == 0:
189+
continue
190+
else:
191+
continue
181192
tools_to_download.append(tool_platform[0])
182193
return tools_to_download
183194

184195
def identify_platform():
185-
arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'},
186-
'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'},
187-
'LinuxARM': {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'},
188-
'Windows' : {32 : 'i686-mingw32', 64 : 'i686-mingw32'}}
196+
arduino_platform_names = {'Darwin' : {32 : 'i386-apple-darwin', 64 : 'x86_64-apple-darwin'},
197+
'DarwinARM': {32 : 'arm64-apple-darwin', 64 : 'arm64-apple-darwin'},
198+
'Linux' : {32 : 'i686-pc-linux-gnu', 64 : 'x86_64-pc-linux-gnu'},
199+
'LinuxARM' : {32 : 'arm-linux-gnueabihf', 64 : 'aarch64-linux-gnu'},
200+
'Windows' : {32 : 'i686-mingw32', 64 : 'x86_64-mingw32'}}
189201
bits = 32
190202
if sys.maxsize > 2**32:
191203
bits = 64
192204
sys_name = platform.system()
193205
sys_platform = platform.platform()
206+
if 'Darwin' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('arm64') > 0):
207+
sys_name = 'DarwinARM'
194208
if 'Linux' in sys_name and (sys_platform.find('arm') > 0 or sys_platform.find('aarch64') > 0):
195209
sys_name = 'LinuxARM'
196210
if 'CYGWIN_NT' in sys_name:

0 commit comments

Comments
 (0)