2 Information about the current system's architecture.
4 This module provides information about the current system. It is used to determine
5 whether an implementation is suitable for this machine, and to compare different implementations.
7 For example, it will indicate that:
9 - An i486 machine cannot run an i686 binary.
10 - An i686 machine can run an i486 binary, but would prefer an i586 one.
11 - A Windows binary cannot run on a Linux machine.
13 Each dictionary maps from a supported architecture type to a preference level. Lower numbers are
14 better, Unsupported architectures are not listed at all.
17 # Copyright (C) 2006, Thomas Leonard
18 # See the README file for details, or visit http://0install.net.
22 # os_ranks and mapping are mappings from names to how good they are.
24 # Higher numbers are worse but usable.
28 # 'Linux' : 3, # Linux (lots of systems support emulation)
30 _uname
[0] : 1, # Current OS
33 def _get_machine_ranks():
34 # Binaries compiled for _this_machine are best...
35 this_machine
= _uname
[-1]
36 machine_ranks
= {this_machine
: 0}
38 # If this_machine appears in the first column of this table, all
39 # following machine types on the line will also run on this one
40 # (earlier ones preferred):
43 'i586': ['i486', 'i386'],
44 'i686': ['i586', 'i486', 'i386'],
47 for supported
in _machine_matrix
.get(this_machine
, []):
48 machine_ranks
[supported
] = len(machine_ranks
)
50 # At the lowest priority, try a machine-independant implementation
51 machine_ranks
[None] = len(machine_ranks
)
54 machine_ranks
= _get_machine_ranks()