Flutter Engine
The Flutter Engine
Functions
detect_host_arch Namespace Reference

Functions

def HostArch ()
 
def DoMain (_)
 

Function Documentation

◆ DoMain()

def detect_host_arch.DoMain (   _)
Hook to be called from gyp without starting a separate python
interpreter.

Definition at line 44 of file detect_host_arch.py.

44def DoMain(_):
45 """Hook to be called from gyp without starting a separate python
46 interpreter."""
47 return HostArch()
48
49

◆ HostArch()

def detect_host_arch.HostArch ( )
Returns the host architecture with a predictable string.

Definition at line 12 of file detect_host_arch.py.

12def HostArch():
13 """Returns the host architecture with a predictable string."""
14 host_arch = platform.machine()
15
16 # Convert machine type to format recognized by gyp.
17 if re.match(r'i.86', host_arch) or host_arch == 'i86pc':
18 host_arch = 'ia32'
19 elif host_arch in ['x86_64', 'amd64']:
20 host_arch = 'x64'
21 elif host_arch.startswith('arm'):
22 host_arch = 'arm'
23 elif host_arch.startswith('aarch64'):
24 host_arch = 'arm64'
25 elif host_arch.startswith('mips'):
26 host_arch = 'mips'
27 elif host_arch.startswith('ppc'):
28 host_arch = 'ppc'
29 elif host_arch.startswith('s390'):
30 host_arch = 's390'
31
32 # platform.machine is based on running kernel. It's possible to use 64-bit
33 # kernel with 32-bit userland, e.g. to give linker slightly more memory.
34 # Distinguish between different userland bitness by querying
35 # the python binary.
36 if host_arch == 'x64' and platform.architecture()[0] == '32bit':
37 host_arch = 'ia32'
38 if host_arch == 'arm64' and platform.architecture()[0] == '32bit':
39 host_arch = 'arm'
40
41 return host_arch
42
43