From 85a651ec07a48b441f6c5c4294425cbe5d5a9ee9 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 15 Oct 2005 10:13:03 +0000 Subject: [PATCH] Don't assume Linux-x86 compatibility by default. Instead, wait for people to complain and add the systems that *do* work. git-svn-id: file:///home/talex/Backups/sf.net/Subversion/zero-install/injector/injector@562 9f8c893c-44ee-0310-b757-c8ca8341c71e --- zeroinstall/injector/arch.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/zeroinstall/injector/arch.py b/zeroinstall/injector/arch.py index 14aeeef..7560a17 100644 --- a/zeroinstall/injector/arch.py +++ b/zeroinstall/injector/arch.py @@ -6,14 +6,30 @@ import os _uname = os.uname() os_ranks = { - 'Linux' : 3, # Linux (lots of systems support emulation) - None : 2, # Any arch +# 'Linux' : 3, # Linux (lots of systems support emulation) + None : 2, # Any OS _uname[0] : 1, # Current OS } -machine_ranks = { - 'i386' : 4, # Hope for x86 emulation - 'i486' : 3, - None : 2, # Any OS - _uname[-1] : 1, # Current machine -} +def _get_machine_ranks(): + # Binaries compiled for _this_machine are best... + this_machine = _uname[-1] + machine_ranks = {this_machine : 0} + + # If this_machine appears in the first column of this table, all + # following machine types on the line will also run on this one + # (earlier ones preferred): + _machine_matrix = { + 'i486': ['i386'], + 'i586': ['i486', 'i386'], + 'i686': ['i586', 'i486', 'i386'], + } + for supported in _machine_matrix.get(this_machine, []): + machine_ranks[supported] = len(machine_ranks) + + # At the lowest priority, try a machine-independant implementation + machine_ranks[None] = len(machine_ranks) + return machine_ranks + +machine_ranks = _get_machine_ranks() +print machine_ranks -- 2.11.4.GIT