From 453e88a8755cdccad024ceba7b961099aa5ee89d Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 30 Jul 2008 20:33:28 +0100 Subject: [PATCH] Cope with os.uname not existing. Some systems don't support it yet. --- zeroinstall/0launch-gui/bugs.py | 5 ++++- zeroinstall/injector/arch.py | 13 ++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/zeroinstall/0launch-gui/bugs.py b/zeroinstall/0launch-gui/bugs.py index 9ca4b20..021c3da 100644 --- a/zeroinstall/0launch-gui/bugs.py +++ b/zeroinstall/0launch-gui/bugs.py @@ -42,7 +42,10 @@ def report_bug(policy, iface): else: text += ' No implementation selected\n' - text += '\nSystem:\n %s\n\nIssue:\n %s\n' % ('\n '.join(os.uname()), issue) + if hasattr(os, 'uname'): + text += '\nSystem:\n %s\n\nIssue:\n %s\n' % ('\n '.join(os.uname()), issue) + else: + text += '\nSystem without uname()\n' reporter = BugReporter(policy, iface, text) reporter.show() diff --git a/zeroinstall/injector/arch.py b/zeroinstall/injector/arch.py index ddc2274..1245d77 100644 --- a/zeroinstall/injector/arch.py +++ b/zeroinstall/injector/arch.py @@ -22,7 +22,18 @@ import os # os_ranks and mapping are mappings from names to how good they are. # 1 => Native (best) # Higher numbers are worse but usable. -_uname = os.uname() +try: + _uname = os.uname() +except AttributeError: + # No uname. Probably Windows (untested). + import sys + p = sys.platform + if p == 'win32': + _uname = ('Windows', 'i486') + elif p == 'win64': + _uname = ('Windows', 'x86_64') + else: + _uname = (p, 'i486') os_ranks = { # 'Linux' : 3, # Linux (lots of systems support emulation) -- 2.11.4.GIT