From ef1de9ecaf73e28234d284b79ec45e084d0f0c53 Mon Sep 17 00:00:00 2001
From: Chris Larson <chris_larson@mentor.com>
Date: Sun, 20 Jun 2010 12:08:07 -0700
Subject: Apply some 2to3 refactorings

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
---
 bitbake/bin/bitbake |  2 +-
 bitbake/bin/bitdoc  | 26 ++++++++++++--------------
 2 files changed, 13 insertions(+), 15 deletions(-)

(limited to 'bitbake/bin')

diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 34cfadb98..fdf1e20f8 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -200,7 +200,7 @@ Default BBFILES are the .bb files in the current directory.""")
     else:
         try:
             return_value = ui_init(serverConnection.connection, serverConnection.events)
-        except Exception, e:
+        except Exception as e:
             print "FATAL: Unable to start to '%s' UI: %s" % (ui, e)
             raise
     finally:
diff --git a/bitbake/bin/bitdoc b/bitbake/bin/bitdoc
index 4940f660a..8043b2bd1 100755
--- a/bitbake/bin/bitdoc
+++ b/bitbake/bin/bitdoc
@@ -48,7 +48,7 @@ class HTMLFormatter:
         From pydoc... almost identical at least
         """
         while pairs:
-            (a,b) = pairs[0]
+            (a, b) = pairs[0]
             text = join(split(text, a), b)
             pairs = pairs[1:]
         return text
@@ -87,7 +87,7 @@ class HTMLFormatter:
 
         return txt + ",".join(txts)
 
-    def groups(self,item):
+    def groups(self, item):
         """
         Create HTML to link to related groups
         """
@@ -99,12 +99,12 @@ class HTMLFormatter:
         txt = "<p><b>See also:</b><br>"
         txts = []
         for group in item.groups():
-            txts.append( """<a href="group%s.html">%s</a> """ % (group,group) )
+            txts.append( """<a href="group%s.html">%s</a> """ % (group, group) )
 
         return txt + ",".join(txts)
 
 
-    def createKeySite(self,item):
+    def createKeySite(self, item):
         """
         Create a site for a key. It contains the header/navigator, a heading,
         the description, links to related keys and to the groups.
@@ -149,8 +149,7 @@ class HTMLFormatter:
         """
 
         groups = ""
-        sorted_groups = doc.groups()
-        sorted_groups.sort()
+        sorted_groups = sorted(doc.groups())
         for group in sorted_groups:
             groups += """<a href="group%s.html">%s</a><br>""" % (group, group)
 
@@ -185,8 +184,7 @@ class HTMLFormatter:
         Create Overview of all avilable keys
         """
         keys = ""
-        sorted_keys = doc.doc_keys()
-        sorted_keys.sort()
+        sorted_keys = sorted(doc.doc_keys())
         for key in sorted_keys:
             keys += """<a href="key%s.html">%s</a><br>""" % (key, key)
 
@@ -214,7 +212,7 @@ class HTMLFormatter:
             description  += "<h2 Description of Grozp %s</h2>" % gr
             description  += _description
 
-        items.sort(lambda x,y:cmp(x.name(),y.name()))
+        items.sort(lambda x, y:cmp(x.name(), y.name()))
         for group in items:
             groups += """<a href="key%s.html">%s</a><br>""" % (group.name(), group.name())
 
@@ -343,7 +341,7 @@ class DocumentationItem:
     def addGroup(self, group):
         self._groups.append(group)
 
-    def addRelation(self,relation):
+    def addRelation(self, relation):
         self._related.append(relation)
 
     def sort(self):
@@ -396,7 +394,7 @@ class Documentation:
         """
         return self.__groups.keys()
 
-    def group_content(self,group_name):
+    def group_content(self, group_name):
         """
         Return a list of keys/names that are in a specefic
         group or the empty list
@@ -412,7 +410,7 @@ def parse_cmdline(args):
     Parse the CMD line and return the result as a n-tuple
     """
 
-    parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__,__version__))
+    parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__, __version__))
     usage  = """%prog [options]
 
 Create a set of html pages (documentation) for a bitbake.conf....
@@ -428,7 +426,7 @@ Create a set of html pages (documentation) for a bitbake.conf....
     parser.add_option( "-D",  "--debug", help = "Increase the debug level",
                        action = "count", dest = "debug", default = 0 )
 
-    parser.add_option( "-v","--verbose", help = "output more chit-char to the terminal",
+    parser.add_option( "-v", "--verbose", help = "output more chit-char to the terminal",
                        action = "store_true", dest = "verbose", default = False )
 
     options, args = parser.parse_args( sys.argv )
@@ -443,7 +441,7 @@ def main():
     The main Method
     """
 
-    (config_file,output_dir) = parse_cmdline( sys.argv )
+    (config_file, output_dir) = parse_cmdline( sys.argv )
 
     # right to let us load the file now
     try:
-- 
cgit v1.2.3