-
Notifications
You must be signed in to change notification settings - Fork 7
/
default_platform.py
28 lines (26 loc) · 1.06 KB
/
default_platform.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import platform
def default_platform():
if platform.system() == 'Windows': # Note ALL windows environment treated as 32-bit
return 'Windows-x86'
if platform.system() == 'Linux':
if platform.architecture()[0] == '32bit':
if platform.machine()[0:3] == 'ppc':
return 'Linux-ppc32'
elif platform.machine() == 'armv7l':
if os.path.exists('/sys/firmware/devicetree/base/model'):
with open('/sys/firmware/devicetree/base/model', 'r') as f:
info = f.read()
if 'Raspberry Pi' in info:
return 'Linux-rpi'
return 'Linux-armhf'
else:
return 'Linux-x86'
if platform.system() == 'Linux' and platform.architecture()[0] == '64bit':
return 'Linux-x64'
if platform.system() == 'Darwin':
if platform.architecture()[0] == '32bit':
return 'Mac-x86'
if platform.architecture()[0] == '64bit':
return 'Mac-x64'
return None