From: Fabian Groffen Date: Tue, 3 Jun 2008 12:28:15 +0000 (-0000) Subject: Use "platform" module instead of os.uname, or -- even worse -- a system X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d8bb5f85feb4ea39260149f864af694d32ebb767;p=portage.git Use "platform" module instead of os.uname, or -- even worse -- a system call to uname. Change repoman's identification string not to use "processor" on Linux (where it is huge), Interix (where it doesn't exist) and AIX/HP-UX (where it prints "unknown"), but "machine" instead. This patch is eligable for merging in "trunk". svn path=/main/branches/prefix/; revision=10554 --- diff --git a/bin/repoman b/bin/repoman index 9a2267d5a..27efd4ae7 100755 --- a/bin/repoman +++ b/bin/repoman @@ -20,6 +20,7 @@ import stat import sys import tempfile import time +import platform from itertools import izip from stat import S_ISDIR, ST_CTIME @@ -1752,7 +1753,11 @@ else: sys.stderr.write("Failed to insert portage version in message!\n") sys.stderr.flush() portage_version = "Unknown" - unameout = commands.getstatusoutput("uname -srp")[1] + unameout = platform.system() + " " + platform.release() + " " + if platform.system() in ["Darwin", "SunOS"]: + unameout += platform.processor() + else: + unameout += platform.machine() commitmessage+="\n(Portage version: "+str(portage_version)+"/"+vcs+"/"+unameout if options.force: commitmessage += ", RepoMan options: --force" diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index e4b493baa..e75178bec 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -29,6 +29,7 @@ try: from random import shuffle import UserDict from itertools import chain, izip + import platform except ImportError, e: sys.stderr.write("\n\n") sys.stderr.write("!!! Failed to complete python imports. These are internal modules for\n") @@ -41,7 +42,7 @@ except ImportError, e: raise bsd_chflags = None -if os.uname()[0] in ["FreeBSD"]: +if platform.system() in ["FreeBSD"]: def bsd_chflags(): pass def _chflags(path, flags, opts=""): diff --git a/pym/portage/data.py b/pym/portage/data.py index e7da2e521..28e3f2eee 100644 --- a/pym/portage/data.py +++ b/pym/portage/data.py @@ -3,14 +3,14 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -import os, sys, pwd, grp +import os, sys, pwd, grp, platform from portage.util import writemsg from portage.const import rootuid, portageuser, portagegroup, EPREFIX from portage.output import green,red from portage.output import create_color_func bad = create_color_func("BAD") -ostype=os.uname()[0] +ostype=platform.system() userland = None # Prefix always has USERLAND=GNU, even on # FreeBSD, OpenBSD and Darwin (thank the lord!).