ia64/xen-unstable

changeset 8104:d8786656ebab

Use StringIO to simplify string_iterator here. Altered the up-front
documentation.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Mon Nov 28 12:21:17 2005 +0000 (2005-11-28)
parents d5368f7fda5d
children 7638cf95b63c
files tools/python/xen/util/bugtool.py
line diff
     1.1 --- a/tools/python/xen/util/bugtool.py	Mon Nov 28 12:20:33 2005 +0000
     1.2 +++ b/tools/python/xen/util/bugtool.py	Mon Nov 28 12:21:17 2005 +0000
     1.3 @@ -22,6 +22,7 @@ import httplib
     1.4  import re
     1.5  import os
     1.6  import os.path
     1.7 +import StringIO
     1.8  import sys
     1.9  import tarfile
    1.10  import tempfile
    1.11 @@ -53,12 +54,16 @@ def main(argv = None):
    1.12      print '''
    1.13  This application will collate the Xen dmesg output, details of the hardware
    1.14  configuration of your machine, information about the build of Xen that you are
    1.15 -using, plus, if you allow it, various logs.  These logs may contain private
    1.16 -information, and if you are at all worried about that, you should exit now.
    1.17 +using, plus, if you allow it, various logs.
    1.18  
    1.19  The information collated can either be posted to a Xen Bugzilla bug (this bug
    1.20  must already exist in the system, and you must be a registered user there), or
    1.21  it can be saved as a .tar.bz2 for sending or archiving.
    1.22 +
    1.23 +The collated logs may contain private information, and if you are at all
    1.24 +worried about that, you should exit now, or you should explicitly exclude
    1.25 +those logs from the archive.
    1.26 +
    1.27  '''
    1.28      
    1.29      bugball = []
    1.30 @@ -201,35 +206,13 @@ def prettyDict(d):
    1.31      return '\n'.join([format % i for i in d.items()]) + '\n'
    1.32  
    1.33  
    1.34 -class string_iterator:
    1.35 +class string_iterator(StringIO.StringIO):
    1.36      def __init__(self, name, val):
    1.37 +        StringIO.StringIO.__init__(self, val)
    1.38          self.name = name
    1.39 -        self.val = val
    1.40 -        self.vallist = val.splitlines(True)
    1.41 -        self.line = 0
    1.42 -    
    1.43 -    def readlines(self):
    1.44 -        return self.vallist
    1.45 -
    1.46 -    def readline(self):
    1.47 -        result = self.vallist[line]
    1.48 -        line += 1
    1.49 -        return result
    1.50 -
    1.51 -    def read(self, n = None):
    1.52 -        if n is None:
    1.53 -            return self.val
    1.54 -        else:
    1.55 -            return self.val[0:n]
    1.56 -
    1.57 -    def close(self):
    1.58 -        pass
    1.59  
    1.60      def size(self):
    1.61 -        return len(self.val)
    1.62 -
    1.63 -    def seek(self, _1, _2 = None):
    1.64 -        pass
    1.65 +        return len(self.getvalue())
    1.66  
    1.67  
    1.68  def yes(prompt):