ppc64 can use ppc32 binaries.
[zeroinstall.git] / zeroinstall / injector / arch.py
blob25a62ea75a46cb9b2d644e19a938f1ce8e9534ff
1 import os
3 # os_ranks and mapping are mappings from names to how good they are.
4 # 1 => Native (best)
5 # Higher numbers are worse but usable.
6 _uname = os.uname()
8 os_ranks = {
9 # 'Linux' : 3, # Linux (lots of systems support emulation)
10 None : 2, # Any OS
11 _uname[0] : 1, # Current OS
14 def _get_machine_ranks():
15 # Binaries compiled for _this_machine are best...
16 this_machine = _uname[-1]
17 machine_ranks = {this_machine : 0}
19 # If this_machine appears in the first column of this table, all
20 # following machine types on the line will also run on this one
21 # (earlier ones preferred):
22 _machine_matrix = {
23 'i486': ['i386'],
24 'i586': ['i486', 'i386'],
25 'i686': ['i586', 'i486', 'i386'],
26 'ppc64': ['ppc32'],
28 for supported in _machine_matrix.get(this_machine, []):
29 machine_ranks[supported] = len(machine_ranks)
31 # At the lowest priority, try a machine-independant implementation
32 machine_ranks[None] = len(machine_ranks)
33 return machine_ranks
35 machine_ranks = _get_machine_ranks()
36 #print machine_ranks