Index: /trunk/Config.kmk
===================================================================
--- /trunk/Config.kmk	(revision 59794)
+++ /trunk/Config.kmk	(revision 59795)
@@ -6474,3 +6474,2 @@
 	$(MAKE) VBOX_QUICK=1
 
-
Index: /trunk/doc/manual/en_US/SDKRef.xml
===================================================================
--- /trunk/doc/manual/en_US/SDKRef.xml	(revision 59794)
+++ /trunk/doc/manual/en_US/SDKRef.xml	(revision 59795)
@@ -781,6 +781,4 @@
         <xref linkend="glue-python"/>.</para>
 
-        <para>The minimum supported Python version is 2.6.</para>
-
         <para>As indicated in <xref linkend="webservice-or-com"/>, the
         COM/XPCOM API gives better performance without the SOAP overhead, and
@@ -790,13 +788,16 @@
         platform<footnote>
             <para>On On Mac OS X only the Python versions bundled with the OS
-            are officially supported. This means 2.6 and 2.7 for 10.8 and later.</para>
+            are officially supported. This means Python 2.3 for 10.4, Python
+            2.5 for 10.5 and Python 2.5 and 2.6 for 10.6.</para>
           </footnote>). On Windows, you can use the Main API from Python if the
           Win32 extensions package for Python<footnote>
             <para>See <ulink
             url="http://sourceforge.net/project/showfiles.php?group_id=78018">http://sourceforge.net/project/showfiles.php?group_id=78018</ulink>.</para>
-          </footnote> is installed. Versions of Python Win32 extensions earlier
+          </footnote> is installed. Version of Python Win32 extensions earlier
           than 2.16 are known to have bugs, leading to issues with VirtualBox
-          Python bindings, so please make sure to use latest available Python
-          and Win32 extensions.</para>
+          Python bindings, and also some early builds of Python 2.5 for Windows
+          have issues with reporting platform name on some Windows versions, so
+          please make sure to use latest available Python and Win32
+          extensions.</para>
 
         <para>The VirtualBox OOWS for Python relies on the Python ZSI SOAP
@@ -1496,6 +1497,4 @@
         the glue layer if you want to use a different Python
         installation.</para>
-
-        <para>The minimum supported Python version is 2.6.</para>
 
         <para>In this layer, the class
Index: /trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
===================================================================
--- /trunk/src/VBox/Frontends/VBoxShell/vboxshell.py	(revision 59794)
+++ /trunk/src/VBox/Frontends/VBoxShell/vboxshell.py	(revision 59795)
@@ -2,5 +2,4 @@
 # -*- coding: utf-8 -*-
 # $Id$
-
 """
 VirtualBox Python Shell.
@@ -20,9 +19,7 @@
 """
 
-from __future__ import print_function
-
 __copyright__ = \
 """
-Copyright (C) 2009-2016 Oracle Corporation
+Copyright (C) 2009-2015 Oracle Corporation
 
 This file is part of VirtualBox Open Source Edition (OSE), as
@@ -37,6 +34,5 @@
 
 
-import os
-import sys
+import os, sys
 import traceback
 import shlex
@@ -46,4 +42,5 @@
 from optparse import OptionParser
 from pprint import pprint
+
 
 
@@ -155,5 +152,5 @@
                             matches.append(word)
 
-            except Exception as e:
+            except Exception, e:
                 printErr(self.ctx, e)
                 if g_fVerbose:
@@ -167,5 +164,5 @@
 
     comps = {}
-    for (key, _value) in list(cmds.items()):
+    for (key, _value) in cmds.items():
         comps[key] = None
     completer = CompleterNG(comps, ctx)
@@ -192,5 +189,5 @@
     try:
         while not progress.completed:
-            print("%s %%\r" % (colored(str(progress.percent), 'red')), end="")
+            print "%s %%\r" % (colored(str(progress.percent), 'red')),
             sys.stdout.flush()
             progress.waitForCompletion(wait)
@@ -200,22 +197,22 @@
         return 1
     except KeyboardInterrupt:
-        print("Interrupted.")
+        print "Interrupted."
         ctx['interrupt'] = True
         if progress.cancelable:
-            print("Canceling task...")
+            print "Canceling task..."
             progress.cancel()
         return 0
 
 def printErr(_ctx, e):
-    oVBoxMgr = _ctx['global']
+    oVBoxMgr = _ctx['global'];
     if oVBoxMgr.errIsOurXcptKind(e):
-        print(colored('%s: %s' % (oVBoxMgr.xcptToString(e), oVBoxMgr.xcptGetMessage(e)), 'red'))
-    else:
-        print(colored(str(e), 'red'))
+        print colored('%s: %s' % (oVBoxMgr.xcptToString(e), oVBoxMgr.xcptGetMessage(e)), 'red');
+    else:
+        print colored(str(e), 'red')
 
 def reportError(_ctx, progress):
     errorinfo = progress.errorInfo
     if errorinfo:
-        print(colored("Error in module '%s': %s" % (errorinfo.component, errorinfo.text), 'red'))
+        print colored("Error in module '%s': %s" % (errorinfo.component, errorinfo.text), 'red')
 
 def colCat(_ctx, strg):
@@ -244,5 +241,5 @@
     mach = vbox.createMachine("", name, [], kind, "")
     mach.saveSettings()
-    print("created machine with UUID", mach.id)
+    print "created machine with UUID", mach.id
     vbox.registerMachine(mach)
     # update cache
@@ -251,5 +248,5 @@
 def removeVm(ctx, mach):
     uuid = mach.id
-    print("removing machine ", mach.name, "with UUID", uuid)
+    print "removing machine ", mach.name, "with UUID", uuid
     cmdClosedVm(ctx, mach, detachVmDevice, ["ALL"])
     disks = mach.unregister(ctx['global'].constants.CleanupMode_Full)
@@ -257,5 +254,5 @@
         progress = mach.deleteConfig(disks)
         if progressBar(ctx, progress, 100) and int(progress.resultCode) == 0:
-            print("Success!")
+            print "Success!"
         else:
             reportError(ctx, progress)
@@ -274,5 +271,5 @@
             try:
                 perf.setup(['*'], [mach], 10, 15)
-            except Exception as e:
+            except Exception, e:
                 printErr(ctx, e)
                 if g_fVerbose:
@@ -327,17 +324,17 @@
         return
     for metric in ctx['perf'].query(["*"], [mach]):
-        print(metric['name'], metric['values_as_string'])
+        print metric['name'], metric['values_as_string']
 
 def guestExec(ctx, machine, console, cmds):
-    exec(cmds)
+    exec cmds
 
 def printMouseEvent(_ctx, mev):
-    print("Mouse : mode=%d x=%d y=%d z=%d w=%d buttons=%x" % (mev.mode, mev.x, mev.y, mev.z, mev.w, mev.buttons))
+    print "Mouse : mode=%d x=%d y=%d z=%d w=%d buttons=%x" % (mev.mode, mev.x, mev.y, mev.z, mev.w, mev.buttons)
 
 def printKbdEvent(ctx, kev):
-    print("Kbd: ", ctx['global'].getArray(kev, 'scancodes'))
+    print "Kbd: ", ctx['global'].getArray(kev, 'scancodes')
 
 def printMultiTouchEvent(ctx, mtev):
-    print("MultiTouch : contacts=%d time=%d" % (mtev.contactCount, mtev.scanTime))
+    print "MultiTouch : contacts=%d time=%d" % (mtev.contactCount, mtev.scanTime)
     xPositions = ctx['global'].getArray(mtev, 'xPositions')
     yPositions = ctx['global'].getArray(mtev, 'yPositions')
@@ -346,22 +343,22 @@
 
     for i in range(0, mtev.contactCount):
-        print("  [%d] %d,%d %d %d" % (i, xPositions[i], yPositions[i], contactIds[i], contactFlags[i]))
+        print "  [%d] %d,%d %d %d" % (i, xPositions[i], yPositions[i], contactIds[i], contactFlags[i])
 
 def monitorSource(ctx, eventSource, active, dur):
     def handleEventImpl(event):
         evtype = event.type
-        print("got event: %s %s" % (str(evtype), asEnumElem(ctx, 'VBoxEventType', evtype)))
+        print "got event: %s %s" % (str(evtype), asEnumElem(ctx, 'VBoxEventType', evtype))
         if evtype == ctx['global'].constants.VBoxEventType_OnMachineStateChanged:
             scev = ctx['global'].queryInterface(event, 'IMachineStateChangedEvent')
             if scev:
-                print("machine state event: mach=%s state=%s" % (scev.machineId, scev.state))
+                print "machine state event: mach=%s state=%s" % (scev.machineId, scev.state)
         elif  evtype == ctx['global'].constants.VBoxEventType_OnSnapshotTaken:
             stev = ctx['global'].queryInterface(event, 'ISnapshotTakenEvent')
             if stev:
-                print("snapshot taken event: mach=%s snap=%s" % (stev.machineId, stev.snapshotId))
+                print "snapshot taken event: mach=%s snap=%s" % (stev.machineId, stev.snapshotId)
         elif  evtype == ctx['global'].constants.VBoxEventType_OnGuestPropertyChanged:
             gpcev = ctx['global'].queryInterface(event, 'IGuestPropertyChangedEvent')
             if gpcev:
-                print("guest property change: name=%s value=%s" % (gpcev.name, gpcev.value))
+                print "guest property change: name=%s value=%s" % (gpcev.name, gpcev.value)
         elif  evtype == ctx['global'].constants.VBoxEventType_OnMousePointerShapeChanged:
             psev = ctx['global'].queryInterface(event, 'IMousePointerShapeChangedEvent')
@@ -369,7 +366,7 @@
                 shape = ctx['global'].getArray(psev, 'shape')
                 if shape is None:
-                    print("pointer shape event - empty shape")
+                    print "pointer shape event - empty shape"
                 else:
-                    print("pointer shape event: w=%d h=%d shape len=%d" % (psev.width, psev.height, len(shape)))
+                    print "pointer shape event: w=%d h=%d shape len=%d" % (psev.width, psev.height, len(shape))
         elif evtype == ctx['global'].constants.VBoxEventType_OnGuestMouse:
             mev = ctx['global'].queryInterface(event, 'IGuestMouseEvent')
@@ -444,5 +441,5 @@
     def handleEventImpl(event):
         evtype = event.type
-        #print("got event: %s %s" % (str(evtype), asEnumElem(ctx, 'VBoxEventType', evtype)))
+        #print "got event: %s %s" % (str(evtype), asEnumElem(ctx, 'VBoxEventType', evtype))
         if evtype == ctx['global'].constants.VBoxEventType_OnGuestMouse:
             mev = ctx['global'].queryInterface(event, 'IGuestMouseEvent')
@@ -492,5 +489,5 @@
 
     header = demo.readline()
-    print("Header is", header)
+    print "Header is", header
     basere = re.compile(r'(?P<s>\d+): (?P<t>[km]) (?P<p>.*)')
     mre = re.compile(r'(?P<a>\d+) (?P<x>-*\d+) (?P<y>-*\d+) (?P<z>-*\d+) (?P<w>-*\d+) (?P<b>-*\d+)')
@@ -518,5 +515,5 @@
             if rtype == 'k':
                 codes = kre.findall(params)
-                #print("KBD:", codes)
+                #print "KBD:", codes
                 kbd.putScancodes(codes)
             elif rtype == 'm':
@@ -526,8 +523,8 @@
                     if mdict['a'] == '1':
                         # absolute
-                        #print("MA: ", mdict['x'], mdict['y'], mdict['z'], mdict['b'])
+                        #print "MA: ", mdict['x'], mdict['y'], mdict['z'], mdict['b']
                         mouse.putMouseEventAbsolute(int(mdict['x']), int(mdict['y']), int(mdict['z']), int(mdict['w']), int(mdict['b']))
                     else:
-                        #print("MR: ", mdict['x'], mdict['y'], mdict['b'])
+                        #print "MR: ", mdict['x'], mdict['y'], mdict['b']
                         mouse.putMouseEvent(int(mdict['x']), int(mdict['y']), int(mdict['z']), int(mdict['w']), int(mdict['b']))
 
@@ -562,5 +559,5 @@
         h = fbh
 
-    print("Saving screenshot (%d x %d) screen %d in %s..." % (w, h, screen, f))
+    print "Saving screenshot (%d x %d) screen %d in %s..." % (w, h, screen, f)
     data = display.takeScreenShotToArray(screen, w, h, ctx['const'].BitmapFormat_RGBA)
     size = (w, h)
@@ -589,5 +586,5 @@
         h = fbh
 
-    print("Saving screenshot (%d x %d) screen %d in %s..." % (w, h, screen, f))
+    print "Saving screenshot (%d x %d) screen %d in %s..." % (w, h, screen, f)
     data = display.takeScreenShotToArray(screen, w, h, ctx['const'].BitmapFormat_PNG)
     pngfile = open(f, 'wb')
@@ -597,5 +594,5 @@
 def teleport(ctx, _session, console, args):
     if args[0].find(":") == -1:
-        print("Use host:port format for teleport target")
+        print "Use host:port format for teleport target"
         return
     (host, port) = args[0].split(":")
@@ -611,8 +608,8 @@
 
     port = int(port)
-    print("Teleporting to %s:%d..." % (host, port))
+    print "Teleporting to %s:%d..." % (host, port)
     progress = console.teleport(host, port, passwd, maxDowntime)
     if progressBar(ctx, progress, 100) and int(progress.resultCode) == 0:
-        print("Success!")
+        print "Success!"
     else:
         reportError(ctx, progress)
@@ -635,8 +632,8 @@
     all_stats = ctx['const'].all_values('GuestStatisticType')
     cpu = 0
-    for s in list(all_stats.keys()):
+    for s in all_stats.keys():
         try:
             val = guest.getStatistic( cpu, all_stats[s])
-            print("%s: %d" % (s, val))
+            print "%s: %d" % (s, val)
         except:
             # likely not implemented
@@ -645,10 +642,10 @@
 def plugCpu(_ctx, machine, _session, args):
     cpu = int(args[0])
-    print("Adding CPU %d..." % (cpu))
+    print "Adding CPU %d..." % (cpu)
     machine.hotPlugCPU(cpu)
 
 def unplugCpu(_ctx, machine, _session, args):
     cpu = int(args[0])
-    print("Removing CPU %d..." % (cpu))
+    print "Removing CPU %d..." % (cpu)
     machine.hotUnplugCPU(cpu)
 
@@ -664,31 +661,31 @@
 
 def printHostUsbDev(ctx, ud):
-    print("  %s: %s (vendorId=%d productId=%d serial=%s) %s" % (ud.id, colored(ud.product, 'blue'), ud.vendorId, ud.productId, ud.serialNumber, asEnumElem(ctx, 'USBDeviceState', ud.state)))
+    print "  %s: %s (vendorId=%d productId=%d serial=%s) %s" % (ud.id, colored(ud.product, 'blue'), ud.vendorId, ud.productId, ud.serialNumber, asEnumElem(ctx, 'USBDeviceState', ud.state))
 
 def printUsbDev(_ctx, ud):
-    print("  %s: %s (vendorId=%d productId=%d serial=%s)" % (ud.id,  colored(ud.product, 'blue'), ud.vendorId, ud.productId, ud.serialNumber))
+    print "  %s: %s (vendorId=%d productId=%d serial=%s)" % (ud.id,  colored(ud.product, 'blue'), ud.vendorId, ud.productId, ud.serialNumber)
 
 def printSf(ctx, sf):
-    print("    name=%s host=%s %s %s" % (sf.name, colPath(ctx, sf.hostPath), cond(sf.accessible, "accessible", "not accessible"), cond(sf.writable, "writable", "read-only")))
+    print "    name=%s host=%s %s %s" % (sf.name, colPath(ctx, sf.hostPath), cond(sf.accessible, "accessible", "not accessible"), cond(sf.writable, "writable", "read-only"))
 
 def ginfo(ctx, console, _args):
     guest = console.guest
     if guest.additionsRunLevel != ctx['const'].AdditionsRunLevelType_None:
-        print("Additions active, version %s" % (guest.additionsVersion))
-        print("Support seamless: %s" % (getFacilityStatus(ctx, guest, ctx['const'].AdditionsFacilityType_Seamless)))
-        print("Support graphics: %s" % (getFacilityStatus(ctx, guest, ctx['const'].AdditionsFacilityType_Graphics)))
-        print("Balloon size: %d" % (guest.memoryBalloonSize))
-        print("Statistic update interval: %d" % (guest.statisticsUpdateInterval))
-    else:
-        print("No additions")
+        print "Additions active, version %s" % (guest.additionsVersion)
+        print "Support seamless: %s" % (getFacilityStatus(ctx, guest, ctx['const'].AdditionsFacilityType_Seamless))
+        print "Support graphics: %s" % (getFacilityStatus(ctx, guest, ctx['const'].AdditionsFacilityType_Graphics))
+        print "Balloon size: %d" % (guest.memoryBalloonSize)
+        print "Statistic update interval: %d" % (guest.statisticsUpdateInterval)
+    else:
+        print "No additions"
     usbs = ctx['global'].getArray(console, 'USBDevices')
-    print("Attached USB:")
+    print "Attached USB:"
     for ud in usbs:
         printUsbDev(ctx, ud)
     rusbs = ctx['global'].getArray(console, 'remoteUSBDevices')
-    print("Remote USB:")
+    print "Remote USB:"
     for ud in rusbs:
         printHostUsbDev(ctx, ud)
-    print("Transient shared folders:")
+    print "Transient shared folders:"
     sfs = rusbs = ctx['global'].getArray(console, 'sharedFolders')
     for sf in sfs:
@@ -701,5 +698,5 @@
         session = ctx['global'].getSessionObject(vbox)
         mach.lockMachine(session, ctx['global'].constants.LockType_Shared)
-    except Exception as e:
+    except Exception, e:
         printErr(ctx, "Session to '%s' not open: %s" % (mach.name, str(e)))
         if g_fVerbose:
@@ -707,5 +704,5 @@
         return
     if session.state != ctx['const'].SessionState_Locked:
-        print("Session to '%s' in wrong state: %s" % (mach.name, session.state))
+        print "Session to '%s' in wrong state: %s" % (mach.name, session.state)
         session.unlockMachine()
         return
@@ -713,5 +710,5 @@
     # in Webservices) functionality
     if ctx['remote'] and cmd == 'some_local_only_command':
-        print('Trying to use local only functionality, ignored')
+        print 'Trying to use local only functionality, ignored'
         session.unlockMachine()
         return
@@ -737,5 +734,5 @@
     except KeyboardInterrupt:
         ctx['interrupt'] = True
-    except Exception as e:
+    except Exception, e:
         printErr(ctx, e)
         if g_fVerbose:
@@ -750,5 +747,5 @@
     try:
         cmd(ctx, mach, args)
-    except Exception as e:
+    except Exception, e:
         save = False
         printErr(ctx, e)
@@ -758,5 +755,5 @@
         try:
             mach.saveSettings()
-        except Exception as e:
+        except Exception, e:
             printErr(ctx, e)
             if g_fVerbose:
@@ -770,5 +767,5 @@
     try:
         cmd(ctx, mach, session.console, args)
-    except Exception as e:
+    except Exception, e:
         save = False
         printErr(ctx, e)
@@ -780,5 +777,8 @@
 
 def machById(ctx, uuid):
-    mach = ctx['vb'].findMachine(uuid)
+    try:
+        mach = ctx['vb'].getMachine(uuid)
+    except:
+        mach = ctx['vb'].findMachine(uuid)
     return mach
 
@@ -899,10 +899,10 @@
 def argsToMach(ctx, args):
     if len(args) < 2:
-        print("usage: %s [vmname|uuid]" % (args[0]))
+        print "usage: %s [vmname|uuid]" % (args[0])
         return None
     uuid = args[1]
     mach = machById(ctx, uuid)
     if mach == None:
-        print("Machine '%s' is unknown, use list command to find available machines" % (uuid))
+        print "Machine '%s' is unknown, use list command to find available machines" % (uuid)
     return mach
 
@@ -912,10 +912,10 @@
     else:
         spec = ""
-    print("    %s: %s%s" % (colored(cmd, 'blue'), h, spec))
+    print "    %s: %s%s" % (colored(cmd, 'blue'), h, spec)
 
 def helpCmd(_ctx, args):
     if len(args) == 1:
-        print("Help page:")
-        names = list(commands.keys())
+        print "Help page:"
+        names = commands.keys()
         names.sort()
         for i in names:
@@ -925,5 +925,5 @@
         c = commands.get(cmd)
         if c == None:
-            print("Command '%s' not known" % (cmd))
+            print "Command '%s' not known" % (cmd)
         else:
             helpSingleCmd(cmd, c[0], c[2])
@@ -932,5 +932,5 @@
 def asEnumElem(ctx, enum, elem):
     enumVals = ctx['const'].all_values(enum)
-    for e in list(enumVals.keys()):
+    for e in enumVals.keys():
         if str(elem) == str(enumVals[e]):
             return colored(e, 'green')
@@ -948,6 +948,6 @@
             else:
                 tele = "    "
-                print("%sMachine '%s' [%s], machineState=%s, sessionState=%s" % (tele, colVm(ctx, mach.name), mach.id, asEnumElem(ctx, "MachineState", mach.state), asEnumElem(ctx, "SessionState", mach.sessionState)))
-        except Exception as e:
+                print "%sMachine '%s' [%s], machineState=%s, sessionState=%s" % (tele, colVm(ctx, mach.name), mach.id, asEnumElem(ctx, "MachineState", mach.state), asEnumElem(ctx, "SessionState", mach.sessionState))
+        except Exception, e:
             printErr(ctx, e)
             if g_fVerbose:
@@ -956,6 +956,6 @@
 
 def infoCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: info [vmname|uuid]")
+    if (len(args) < 2):
+        print "usage: info [vmname|uuid]"
         return 0
     mach = argsToMach(ctx, args)
@@ -963,109 +963,109 @@
         return 0
     vmos = ctx['vb'].getGuestOSType(mach.OSTypeId)
-    print(" One can use setvar <mach> <var> <value> to change variable, using name in [].")
-    print("  Name [name]: %s" % (colVm(ctx, mach.name)))
-    print("  Description [description]: %s" % (mach.description))
-    print("  ID [n/a]: %s" % (mach.id))
-    print("  OS Type [via OSTypeId]: %s" % (vmos.description))
-    print("  Firmware [firmwareType]: %s (%s)" % (asEnumElem(ctx, "FirmwareType", mach.firmwareType), mach.firmwareType))
-    print()
-    print("  CPUs [CPUCount]: %d" % (mach.CPUCount))
-    print("  RAM [memorySize]: %dM" % (mach.memorySize))
-    print("  VRAM [VRAMSize]: %dM" % (mach.VRAMSize))
-    print("  Monitors [monitorCount]: %d" % (mach.monitorCount))
-    print("  Chipset [chipsetType]: %s (%s)" % (asEnumElem(ctx, "ChipsetType", mach.chipsetType), mach.chipsetType))
-    print()
-    print("  Clipboard mode [clipboardMode]: %s (%s)" % (asEnumElem(ctx, "ClipboardMode", mach.clipboardMode), mach.clipboardMode))
-    print("  Machine status [n/a]: %s (%s)" % (asEnumElem(ctx, "SessionState", mach.sessionState), mach.sessionState))
-    print()
+    print " One can use setvar <mach> <var> <value> to change variable, using name in []."
+    print "  Name [name]: %s" % (colVm(ctx, mach.name))
+    print "  Description [description]: %s" % (mach.description)
+    print "  ID [n/a]: %s" % (mach.id)
+    print "  OS Type [via OSTypeId]: %s" % (vmos.description)
+    print "  Firmware [firmwareType]: %s (%s)" % (asEnumElem(ctx, "FirmwareType", mach.firmwareType), mach.firmwareType)
+    print
+    print "  CPUs [CPUCount]: %d" % (mach.CPUCount)
+    print "  RAM [memorySize]: %dM" % (mach.memorySize)
+    print "  VRAM [VRAMSize]: %dM" % (mach.VRAMSize)
+    print "  Monitors [monitorCount]: %d" % (mach.monitorCount)
+    print "  Chipset [chipsetType]: %s (%s)" % (asEnumElem(ctx, "ChipsetType", mach.chipsetType), mach.chipsetType)
+    print
+    print "  Clipboard mode [clipboardMode]: %s (%s)" % (asEnumElem(ctx, "ClipboardMode", mach.clipboardMode), mach.clipboardMode)
+    print "  Machine status [n/a]: %s (%s)" % (asEnumElem(ctx, "SessionState", mach.sessionState), mach.sessionState)
+    print
     if mach.teleporterEnabled:
-        print("  Teleport target on port %d (%s)" % (mach.teleporterPort, mach.teleporterPassword))
-        print()
+        print "  Teleport target on port %d (%s)" % (mach.teleporterPort, mach.teleporterPassword)
+        print
     bios = mach.BIOSSettings
-    print("  ACPI [BIOSSettings.ACPIEnabled]: %s" % (asState(bios.ACPIEnabled)))
-    print("  APIC [BIOSSettings.IOAPICEnabled]: %s" % (asState(bios.IOAPICEnabled)))
+    print "  ACPI [BIOSSettings.ACPIEnabled]: %s" % (asState(bios.ACPIEnabled))
+    print "  APIC [BIOSSettings.IOAPICEnabled]: %s" % (asState(bios.IOAPICEnabled))
     hwVirtEnabled = mach.getHWVirtExProperty(ctx['global'].constants.HWVirtExPropertyType_Enabled)
-    print("  Hardware virtualization [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_Enabled, value)]: " + asState(hwVirtEnabled))
+    print "  Hardware virtualization [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_Enabled, value)]: " + asState(hwVirtEnabled)
     hwVirtVPID = mach.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_VPID)
-    print("  VPID support [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_VPID, value)]: " + asState(hwVirtVPID))
+    print "  VPID support [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_VPID, value)]: " + asState(hwVirtVPID)
     hwVirtNestedPaging = mach.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_NestedPaging)
-    print("  Nested paging [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_NestedPaging, value)]: " + asState(hwVirtNestedPaging))
-
-    print("  Hardware 3d acceleration [accelerate3DEnabled]: " + asState(mach.accelerate3DEnabled))
-    print("  Hardware 2d video acceleration [accelerate2DVideoEnabled]: " + asState(mach.accelerate2DVideoEnabled))
-
-    print("  Use universal time [RTCUseUTC]: %s" % (asState(mach.RTCUseUTC)))
-    print("  HPET [HPETEnabled]: %s" % (asState(mach.HPETEnabled)))
+    print "  Nested paging [guest win machine.setHWVirtExProperty(ctx[\\'const\\'].HWVirtExPropertyType_NestedPaging, value)]: " + asState(hwVirtNestedPaging)
+
+    print "  Hardware 3d acceleration [accelerate3DEnabled]: " + asState(mach.accelerate3DEnabled)
+    print "  Hardware 2d video acceleration [accelerate2DVideoEnabled]: " + asState(mach.accelerate2DVideoEnabled)
+
+    print "  Use universal time [RTCUseUTC]: %s" % (asState(mach.RTCUseUTC))
+    print "  HPET [HPETEnabled]: %s" % (asState(mach.HPETEnabled))
     if mach.audioAdapter.enabled:
-        print("  Audio [via audioAdapter]: chip %s; host driver %s" % (asEnumElem(ctx, "AudioControllerType", mach.audioAdapter.audioController), asEnumElem(ctx, "AudioDriverType",  mach.audioAdapter.audioDriver)))
-    print("  CPU hotplugging [CPUHotPlugEnabled]: %s" % (asState(mach.CPUHotPlugEnabled)))
-
-    print("  Keyboard [keyboardHIDType]: %s (%s)" % (asEnumElem(ctx, "KeyboardHIDType", mach.keyboardHIDType), mach.keyboardHIDType))
-    print("  Pointing device [pointingHIDType]: %s (%s)" % (asEnumElem(ctx, "PointingHIDType", mach.pointingHIDType), mach.pointingHIDType))
-    print("  Last changed [n/a]: " + time.asctime(time.localtime(mach.lastStateChange/1000)))
+        print "  Audio [via audioAdapter]: chip %s; host driver %s" % (asEnumElem(ctx, "AudioControllerType", mach.audioAdapter.audioController), asEnumElem(ctx, "AudioDriverType",  mach.audioAdapter.audioDriver))
+    print "  CPU hotplugging [CPUHotPlugEnabled]: %s" % (asState(mach.CPUHotPlugEnabled))
+
+    print "  Keyboard [keyboardHIDType]: %s (%s)" % (asEnumElem(ctx, "KeyboardHIDType", mach.keyboardHIDType), mach.keyboardHIDType)
+    print "  Pointing device [pointingHIDType]: %s (%s)" % (asEnumElem(ctx, "PointingHIDType", mach.pointingHIDType), mach.pointingHIDType)
+    print "  Last changed [n/a]: " + time.asctime(time.localtime(long(mach.lastStateChange)/1000))
     # OSE has no VRDE
     try:
-        print("  VRDE server [VRDEServer.enabled]: %s" % (asState(mach.VRDEServer.enabled)))
+        print "  VRDE server [VRDEServer.enabled]: %s" % (asState(mach.VRDEServer.enabled))
     except:
         pass
 
-    print()
-    print(colCat(ctx, "  USB Controllers:"))
+    print
+    print colCat(ctx, "  USB Controllers:")
     for oUsbCtrl in ctx['global'].getArray(mach, 'USBControllers'):
-        print("    '%s': type %s  standard: %#x" \
-            % (oUsbCtrl.name, asEnumElem(ctx, "USBControllerType", oUsbCtrl.type), oUsbCtrl.USBStandard))
-
-    print()
-    print(colCat(ctx, "  I/O subsystem info:"))
-    print("   Cache enabled [IOCacheEnabled]: %s" % (asState(mach.IOCacheEnabled)))
-    print("   Cache size [IOCacheSize]: %dM" % (mach.IOCacheSize))
+        print "    '%s': type %s  standard: %#x" \
+            % (oUsbCtrl.name, asEnumElem(ctx, "USBControllerType", oUsbCtrl.type), oUsbCtrl.USBStandard);
+
+    print
+    print colCat(ctx, "  I/O subsystem info:")
+    print "   Cache enabled [IOCacheEnabled]: %s" % (asState(mach.IOCacheEnabled))
+    print "   Cache size [IOCacheSize]: %dM" % (mach.IOCacheSize)
 
     controllers = ctx['global'].getArray(mach, 'storageControllers')
     if controllers:
-        print()
-        print(colCat(ctx, "  Storage Controllers:"))
+        print
+        print colCat(ctx, "  Storage Controllers:")
     for controller in controllers:
-        print("    '%s': bus %s type %s" % (controller.name, asEnumElem(ctx, "StorageBus", controller.bus), asEnumElem(ctx, "StorageControllerType", controller.controllerType)))
+        print "    '%s': bus %s type %s" % (controller.name, asEnumElem(ctx, "StorageBus", controller.bus), asEnumElem(ctx, "StorageControllerType", controller.controllerType))
 
     attaches = ctx['global'].getArray(mach, 'mediumAttachments')
     if attaches:
-        print()
-        print(colCat(ctx, "  Media:"))
+        print
+        print colCat(ctx, "  Media:")
     for a in attaches:
-        print("   Controller: '%s' port/device: %d:%d type: %s (%s):" % (a.controller, a.port, a.device, asEnumElem(ctx, "DeviceType", a.type), a.type))
+        print "   Controller: '%s' port/device: %d:%d type: %s (%s):" % (a.controller, a.port, a.device, asEnumElem(ctx, "DeviceType", a.type), a.type)
         medium = a.medium
         if a.type == ctx['global'].constants.DeviceType_HardDisk:
-            print("   HDD:")
-            print("    Id: %s" % (medium.id))
-            print("    Location: %s" % (colPath(ctx, medium.location)))
-            print("    Name: %s" % (medium.name))
-            print("    Format: %s" % (medium.format))
+            print "   HDD:"
+            print "    Id: %s" % (medium.id)
+            print "    Location: %s" % (colPath(ctx, medium.location))
+            print "    Name: %s" % (medium.name)
+            print "    Format: %s" % (medium.format)
 
         if a.type == ctx['global'].constants.DeviceType_DVD:
-            print("   DVD:")
+            print "   DVD:"
             if medium:
-                print("    Id: %s" % (medium.id))
-                print("    Name: %s" % (medium.name))
+                print "    Id: %s" % (medium.id)
+                print "    Name: %s" % (medium.name)
                 if medium.hostDrive:
-                    print("    Host DVD %s" % (colPath(ctx, medium.location)))
+                    print "    Host DVD %s" % (colPath(ctx, medium.location))
                     if a.passthrough:
-                        print("    [passthrough mode]")
+                        print "    [passthrough mode]"
                 else:
-                    print("    Virtual image at %s" % (colPath(ctx, medium.location)))
-                    print("    Size: %s" % (medium.size))
+                    print "    Virtual image at %s" % (colPath(ctx, medium.location))
+                    print "    Size: %s" % (medium.size)
 
         if a.type == ctx['global'].constants.DeviceType_Floppy:
-            print("   Floppy:")
+            print "   Floppy:"
             if medium:
-                print("    Id: %s" % (medium.id))
-                print("    Name: %s" % (medium.name))
+                print "    Id: %s" % (medium.id)
+                print "    Name: %s" % (medium.name)
                 if medium.hostDrive:
-                    print("    Host floppy %s" % (colPath(ctx, medium.location)))
+                    print "    Host floppy %s" % (colPath(ctx, medium.location))
                 else:
-                    print("    Virtual image at %s" % (colPath(ctx, medium.location)))
-                    print("    Size: %s" % (medium.size))
-
-    print()
-    print(colCat(ctx, "  Shared folders:"))
+                    print "    Virtual image at %s" % (colPath(ctx, medium.location))
+                    print "    Size: %s" % (medium.size)
+
+    print
+    print colCat(ctx, "  Shared folders:")
     for sf in ctx['global'].getArray(mach, 'sharedFolders'):
         printSf(ctx, sf)
@@ -1075,5 +1075,5 @@
 def startCmd(ctx, args):
     if len(args) < 2:
-        print("usage: start name <frontend>")
+        print "usage: start name <frontend>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1088,6 +1088,6 @@
 
 def createVmCmd(ctx, args):
-    if len(args) != 3:
-        print("usage: createvm name ostype")
+    if (len(args) != 3):
+        print "usage: createvm name ostype"
         return 0
     name = args[1]
@@ -1096,5 +1096,5 @@
         ctx['vb'].getGuestOSType(oskind)
     except Exception:
-        print('Unknown OS type:', oskind)
+        print 'Unknown OS type:', oskind
         return 0
     createVm(ctx, name, oskind)
@@ -1102,6 +1102,6 @@
 
 def ginfoCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: ginfo [vmname|uuid]")
+    if (len(args) < 2):
+        print "usage: ginfo [vmname|uuid]"
         return 0
     mach = argsToMach(ctx, args)
@@ -1113,5 +1113,5 @@
 def execInGuest(ctx, console, args, env, user, passwd, tmo, inputPipe=None, outputPipe=None):
     if len(args) < 1:
-        print("exec in guest needs at least program name")
+        print "exec in guest needs at least program name"
         return
     guest = console.guest
@@ -1119,11 +1119,11 @@
     # shall contain program name as argv[0]
     gargs = args
-    print("executing %s with args %s as %s" % (args[0], gargs, user))
+    print "executing %s with args %s as %s" % (args[0], gargs, user)
     flags = 0
     if inputPipe is not None:
         flags = 1 # set WaitForProcessStartOnly
-    print(args[0])
+    print args[0]
     process = guestSession.processCreate(args[0], gargs, env, [], tmo)
-    print("executed with pid %d" % (process.PID))
+    print "executed with pid %d" % (process.PID)
     if pid != 0:
         try:
@@ -1161,10 +1161,10 @@
 
         except KeyboardInterrupt:
-            print("Interrupted.")
+            print "Interrupted."
             ctx['interrupt'] = True
             if progress.cancelable:
                 progress.cancel()
         (_reason, code, _flags) = guest.getProcessStatus(pid)
-        print("Exit code: %d" % (code))
+        print "Exit code: %d" % (code)
         return 0
     else:
@@ -1175,5 +1175,5 @@
     dst = args[1]
     flags = 0
-    print("Copying host %s to guest %s" % (src, dst))
+    print "Copying host %s to guest %s" % (src, dst)
     progress = console.guest.copyToGuest(src, dst, user, passwd, flags)
     progressBar(ctx, progress)
@@ -1196,5 +1196,5 @@
     user = getpass.getuser()
     user_inp = nh_raw_input("User (%s): " % (user))
-    if len(user_inp) > 0:
+    if len (user_inp) > 0:
         user = user_inp
     passwd = getpass.getpass()
@@ -1203,6 +1203,6 @@
 
 def gexecCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: gexec [vmname|uuid] command args")
+    if (len(args) < 2):
+        print "usage: gexec [vmname|uuid] command args"
         return 0
     mach = argsToMach(ctx, args)
@@ -1217,6 +1217,6 @@
 
 def gcopyCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: gcopy [vmname|uuid] host_path guest_path")
+    if (len(args) < 2):
+        print "usage: gcopy [vmname|uuid] host_path guest_path"
         return 0
     mach = argsToMach(ctx, args)
@@ -1236,6 +1236,6 @@
 
 def gpipeCmd(ctx, args):
-    if len(args) < 4:
-        print("usage: gpipe [vmname|uuid] hostProgram guestProgram, such as gpipe linux  '/bin/uname -a' '/bin/sh -c \"/usr/bin/tee; /bin/uname -a\"'")
+    if (len(args) < 4):
+        print "usage: gpipe [vmname|uuid] hostProgram guestProgram, such as gpipe linux  '/bin/uname -a' '/bin/sh -c \"/usr/bin/tee; /bin/uname -a\"'"
         return 0
     mach = argsToMach(ctx, args)
@@ -1309,6 +1309,6 @@
 
 def guestCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: guest name commands")
+    if (len(args) < 3):
+        print "usage: guest name commands"
         return 0
     mach = argsToMach(ctx, args)
@@ -1322,6 +1322,6 @@
 
 def screenshotCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: screenshot vm <file> <width> <height> <monitor>")
+    if (len(args) < 2):
+        print "usage: screenshot vm <file> <width> <height> <monitor>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1332,6 +1332,6 @@
 
 def teleportCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: teleport name host:port <password>")
+    if (len(args) < 3):
+        print "usage: teleport name host:port <password>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1351,6 +1351,6 @@
 
 def openportalCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: openportal name port <password>")
+    if (len(args) < 3):
+        print "usage: openportal name port <password>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1358,5 +1358,5 @@
         return 0
     port = int(args[2])
-    if len(args) > 3:
+    if (len(args) > 3):
         passwd = args[3]
     else:
@@ -1368,6 +1368,6 @@
 
 def closeportalCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: closeportal name")
+    if (len(args) < 2):
+        print "usage: closeportal name"
         return 0
     mach = argsToMach(ctx, args)
@@ -1379,6 +1379,6 @@
 
 def gueststatsCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: gueststats name <check interval>")
+    if (len(args) < 2):
+        print "usage: gueststats name <check interval>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1392,13 +1392,13 @@
     cpu = args[1]
     if plug:
-        print("Adding CPU %d..." % (cpu))
+        print "Adding CPU %d..." % (cpu)
         mach.hotPlugCPU(cpu)
     else:
-        print("Removing CPU %d..." % (cpu))
+        print "Removing CPU %d..." % (cpu)
         mach.hotUnplugCPU(cpu)
 
 def plugcpuCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: plugcpu name cpuid")
+    if (len(args) < 2):
+        print "usage: plugcpu name cpuid"
         return 0
     mach = argsToMach(ctx, args)
@@ -1413,6 +1413,6 @@
 
 def unplugcpuCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: unplugcpu name cpuid")
+    if (len(args) < 2):
+        print "usage: unplugcpu name cpuid"
         return 0
     mach = argsToMach(ctx, args)
@@ -1428,10 +1428,10 @@
 def setvar(_ctx, _mach, args):
     expr = 'mach.'+args[0]+' = '+args[1]
-    print("Executing", expr)
-    exec(expr)
+    print "Executing", expr
+    exec expr
 
 def setvarCmd(ctx, args):
-    if len(args) < 4:
-        print("usage: setvar [vmname|uuid] expr value")
+    if (len(args) < 4):
+        print "usage: setvar [vmname|uuid] expr value"
         return 0
     mach = argsToMach(ctx, args)
@@ -1444,10 +1444,10 @@
     key = args[0]
     value = args[1]
-    print("%s: setting %s to %s" % (mach.name, key, value if value else None))
+    print "%s: setting %s to %s" % (mach.name, key, value if value else None)
     mach.setExtraData(key, value)
 
 def setExtraDataCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: setextra [vmname|uuid|global] key <value>")
+    if (len(args) < 3):
+        print "usage: setextra [vmname|uuid|global] key <value>"
         return 0
     key = args[2]
@@ -1467,9 +1467,9 @@
 
 def printExtraKey(obj, key, value):
-    print("%s: '%s' = '%s'" % (obj, key, value))
+    print "%s: '%s' = '%s'" % (obj, key, value)
 
 def getExtraDataCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: getextra [vmname|uuid|global] <key>")
+    if (len(args) < 2):
+        print "usage: getextra [vmname|uuid|global] <key>"
         return 0
     if len(args) == 3:
@@ -1498,15 +1498,15 @@
 
 def aliasCmd(ctx, args):
-    if len(args) == 3:
+    if (len(args) == 3):
         aliases[args[1]] = args[2]
         return 0
 
-    for (key, value) in list(aliases.items()):
-        print("'%s' is an alias for '%s'" % (key, value))
+    for (key, value) in aliases.items():
+        print "'%s' is an alias for '%s'" % (key, value)
     return 0
 
 def verboseCmd(ctx, args):
     global g_fVerbose
-    if len(args) > 1:
+    if (len(args) > 1):
         g_fVerbose = (args[1]=='on')
     else:
@@ -1516,5 +1516,5 @@
 def colorsCmd(ctx, args):
     global g_fHasColors
-    if len(args) > 1:
+    if (len(args) > 1):
         g_fHasColors = (args[1] == 'on')
     else:
@@ -1525,44 +1525,44 @@
     vbox = ctx['vb']
     try:
-        print("VirtualBox version %s" % (colored(vbox.version, 'blue')))
-    except Exception as e:
+        print "VirtualBox version %s" % (colored(vbox.version, 'blue'))
+    except Exception, e:
         printErr(ctx, e)
         if g_fVerbose:
             traceback.print_exc()
     props = vbox.systemProperties
-    print("Machines: %s" % (colPath(ctx, props.defaultMachineFolder)))
-
-    #print("Global shared folders:")
+    print "Machines: %s" % (colPath(ctx, props.defaultMachineFolder))
+
+    #print "Global shared folders:"
     #for ud in ctx['global'].getArray(vbox, 'sharedFolders'):
     #    printSf(ctx, sf)
     host = vbox.host
     cnt = host.processorCount
-    print(colCat(ctx, "Processors:"))
-    print("  available/online: %d/%d " % (cnt, host.processorOnlineCount))
+    print colCat(ctx, "Processors:")
+    print "  available/online: %d/%d " % (cnt, host.processorOnlineCount)
     for i in range(0, cnt):
-        print("  processor #%d speed: %dMHz %s" % (i, host.getProcessorSpeed(i), host.getProcessorDescription(i)))
-
-    print(colCat(ctx, "RAM:"))
-    print("  %dM (free %dM)" % (host.memorySize, host.memoryAvailable))
-    print(colCat(ctx, "OS:"))
-    print("  %s (%s)" % (host.operatingSystem, host.OSVersion))
+        print "  processor #%d speed: %dMHz %s" % (i, host.getProcessorSpeed(i), host.getProcessorDescription(i))
+
+    print colCat(ctx, "RAM:")
+    print "  %dM (free %dM)" % (host.memorySize, host.memoryAvailable)
+    print colCat(ctx, "OS:")
+    print "  %s (%s)" % (host.operatingSystem, host.OSVersion)
     if host.acceleration3DAvailable:
-        print(colCat(ctx, "3D acceleration available"))
-    else:
-        print(colCat(ctx, "3D acceleration NOT available"))
-
-    print(colCat(ctx, "Network interfaces:"))
+        print colCat(ctx, "3D acceleration available")
+    else:
+        print colCat(ctx, "3D acceleration NOT available")
+
+    print colCat(ctx, "Network interfaces:")
     for ni in ctx['global'].getArray(host, 'networkInterfaces'):
-        print("  %s (%s)" % (ni.name, ni.IPAddress))
-
-    print(colCat(ctx, "DVD drives:"))
+        print "  %s (%s)" % (ni.name, ni.IPAddress)
+
+    print colCat(ctx, "DVD drives:")
     for dd in ctx['global'].getArray(host, 'DVDDrives'):
-        print("  %s - %s" % (dd.name, dd.description))
-
-    print(colCat(ctx, "Floppy drives:"))
+        print "  %s - %s" % (dd.name, dd.description)
+
+    print colCat(ctx, "Floppy drives:")
     for dd in ctx['global'].getArray(host, 'floppyDrives'):
-        print("  %s - %s" % (dd.name, dd.description))
-
-    print(colCat(ctx, "USB devices:"))
+        print "  %s - %s" % (dd.name, dd.description)
+
+    print colCat(ctx, "USB devices:")
     for ud in ctx['global'].getArray(host, 'USBDevices'):
         printHostUsbDev(ctx, ud)
@@ -1570,11 +1570,11 @@
     if ctx['perf']:
         for metric in ctx['perf'].query(["*"], [host]):
-            print(metric['name'], metric['values_as_string'])
+            print metric['name'], metric['values_as_string']
 
     return 0
 
 def monitorGuestCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: monitorGuest name (duration)")
+    if (len(args) < 2):
+        print "usage: monitorGuest name (duration)"
         return 0
     mach = argsToMach(ctx, args)
@@ -1589,6 +1589,6 @@
 
 def monitorGuestKbdCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: monitorGuestKbd name (duration)")
+    if (len(args) < 2):
+        print "usage: monitorGuestKbd name (duration)"
         return 0
     mach = argsToMach(ctx, args)
@@ -1603,6 +1603,6 @@
 
 def monitorGuestMouseCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: monitorGuestMouse name (duration)")
+    if (len(args) < 2):
+        print "usage: monitorGuestMouse name (duration)"
         return 0
     mach = argsToMach(ctx, args)
@@ -1617,6 +1617,6 @@
 
 def monitorGuestMultiTouchCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: monitorGuestMultiTouch name (duration)")
+    if (len(args) < 2):
+        print "usage: monitorGuestMultiTouch name (duration)"
         return 0
     mach = argsToMach(ctx, args)
@@ -1631,6 +1631,6 @@
 
 def monitorVBoxCmd(ctx, args):
-    if len(args) > 2:
-        print("usage: monitorVBox (duration)")
+    if (len(args) > 2):
+        print "usage: monitorVBox (duration)"
         return 0
     dur = 5
@@ -1659,6 +1659,6 @@
 
 def portForwardCmd(ctx, args):
-    if len(args) != 5:
-        print("usage: portForward <vm> <adapter> <hostPort> <guestPort>")
+    if (len(args) != 5):
+        print "usage: portForward <vm> <adapter> <hostPort> <guestPort>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1690,6 +1690,6 @@
 
 def showLogCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: showLog vm <num>")
+    if (len(args) < 2):
+        print "usage: showLog vm <num>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1698,5 +1698,5 @@
 
     log = 0
-    if len(args) > 2:
+    if (len(args) > 2):
         log = args[2]
 
@@ -1704,5 +1704,5 @@
     while True:
         data = mach.readLog(log, uOffset, 4096)
-        if len(data) == 0:
+        if (len(data) == 0):
             break
         # print adds either NL or space to chunks not ending with a NL
@@ -1713,6 +1713,6 @@
 
 def findLogCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: findLog vm pattern <num>")
+    if (len(args) < 3):
+        print "usage: findLog vm pattern <num>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1721,5 +1721,5 @@
 
     log = 0
-    if len(args) > 3:
+    if (len(args) > 3):
         log = args[3]
 
@@ -1729,5 +1729,5 @@
         # to reduce line splits on buffer boundary
         data = mach.readLog(log, uOffset, 512*1024)
-        if len(data) == 0:
+        if (len(data) == 0):
             break
         d = str(data).split("\n")
@@ -1737,5 +1737,5 @@
                 for mt in match:
                     s = s.replace(mt, colored(mt, 'red'))
-                print(s)
+                print s
         uOffset += len(data)
 
@@ -1744,6 +1744,6 @@
 
 def findAssertCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: findAssert vm <num>")
+    if (len(args) < 2):
+        print "usage: findAssert vm <num>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1752,5 +1752,5 @@
 
     log = 0
-    if len(args) > 2:
+    if (len(args) > 2):
         log = args[2]
 
@@ -1762,10 +1762,10 @@
         # to reduce line splits on buffer boundary
         data = mach.readLog(log, uOffset, 512*1024)
-        if len(data) == 0:
+        if (len(data) == 0):
             break
         d = str(data).split("\n")
         for s in d:
             if active:
-                print(s)
+                print s
                 if context == 0:
                     active = False
@@ -1777,5 +1777,5 @@
                 active = True
                 context = 50
-                print(s)
+                print s
         uOffset += len(data)
 
@@ -1785,6 +1785,6 @@
     expr = ' '.join(args[1:])
     try:
-        exec(expr)
-    except Exception as e:
+        exec expr
+    except Exception, e:
         printErr(ctx, e)
         if g_fVerbose:
@@ -1799,11 +1799,11 @@
 
 def runScriptCmd(ctx, args):
-    if len(args) != 2:
-        print("usage: runScript <script>")
+    if (len(args) != 2):
+        print "usage: runScript <script>"
         return 0
     try:
         lf = open(args[1], 'r')
-    except IOError as e:
-        print("cannot open:", args[1], ":", e)
+    except IOError, e:
+        print "cannot open:", args[1], ":", e
         return 0
 
@@ -1819,5 +1819,5 @@
                 break
 
-    except Exception as e:
+    except Exception, e:
         printErr(ctx, e)
         if g_fVerbose:
@@ -1827,6 +1827,6 @@
 
 def sleepCmd(ctx, args):
-    if len(args) != 2:
-        print("usage: sleep <secs>")
+    if (len(args) != 2):
+        print "usage: sleep <secs>"
         return 0
 
@@ -1840,6 +1840,6 @@
 
 def shellCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: shell <commands>")
+    if (len(args) < 2):
+        print "usage: shell <commands>"
         return 0
     cmd = ' '.join(args[1:])
@@ -1854,23 +1854,23 @@
 
 def connectCmd(ctx, args):
-    if len(args) > 4:
-        print("usage: connect url <username> <passwd>")
+    if (len(args) > 4):
+        print "usage: connect url <username> <passwd>"
         return 0
 
     if ctx['vb'] is not None:
-        print("Already connected, disconnect first...")
-        return 0
-
-    if len(args) > 1:
+        print "Already connected, disconnect first..."
+        return 0
+
+    if (len(args) > 1):
         url = args[1]
     else:
         url = None
 
-    if len(args) > 2:
+    if (len(args) > 2):
         user = args[2]
     else:
         user = ""
 
-    if len(args) > 3:
+    if (len(args) > 3):
         passwd = args[3]
     else:
@@ -1881,6 +1881,6 @@
     ctx['vb'] = vbox
     try:
-        print("Running VirtualBox version %s" % (vbox.version))
-    except Exception as e:
+        print "Running VirtualBox version %s" % (vbox.version)
+    except Exception, e:
         printErr(ctx, e)
         if g_fVerbose:
@@ -1890,10 +1890,10 @@
 
 def disconnectCmd(ctx, args):
-    if len(args) != 1:
-        print("usage: disconnect")
+    if (len(args) != 1):
+        print "usage: disconnect"
         return 0
 
     if ctx['vb'] is None:
-        print("Not connected yet.")
+        print "Not connected yet."
         return 0
 
@@ -1909,5 +1909,5 @@
 def reconnectCmd(ctx, args):
     if ctx['wsinfo'] is None:
-        print("Never connected...")
+        print "Never connected..."
         return 0
 
@@ -1920,6 +1920,6 @@
     ctx['vb'] = ctx['global'].platform.connect(url, user, passwd)
     try:
-        print("Running VirtualBox version %s" % (ctx['vb'].version))
-    except Exception as e:
+        print "Running VirtualBox version %s" % (ctx['vb'].version)
+    except Exception, e:
         printErr(ctx, e)
         if g_fVerbose:
@@ -1929,5 +1929,5 @@
 def exportVMCmd(ctx, args):
     if len(args) < 3:
-        print("usage: exportVm <machine> <path> <format> <license>")
+        print "usage: exportVm <machine> <path> <format> <license>"
         return 0
     mach = argsToMach(ctx, args)
@@ -1935,9 +1935,9 @@
         return 0
     path = args[2]
-    if len(args) > 3:
+    if (len(args) > 3):
         fmt = args[3]
     else:
         fmt = "ovf-1.0"
-    if len(args) > 4:
+    if (len(args) > 4):
         lic = args[4]
     else:
@@ -1949,5 +1949,5 @@
     progress = app.write(fmt, path)
     if (progressBar(ctx, progress) and int(progress.resultCode) == 0):
-        print("Exported to %s in format %s" % (path, fmt))
+        print "Exported to %s in format %s" % (path, fmt)
     else:
         reportError(ctx, progress)
@@ -2053,5 +2053,5 @@
     extCode = extScancodes.get(ch, [])
     if len(extCode) == 0:
-        print("bad ext", ch)
+        print "bad ext", ch
     return extCode
 
@@ -2125,5 +2125,5 @@
 def typeGuestCmd(ctx, args):
     if len(args) < 3:
-        print("usage: typeGuest <machine> <text> <charDelay>")
+        print "usage: typeGuest <machine> <text> <charDelay>"
         return 0
     mach = argsToMach(ctx, args)
@@ -2161,29 +2161,29 @@
         verbose = False
     hdds = ctx['global'].getArray(ctx['vb'], 'hardDisks')
-    print(colCat(ctx, "Hard disks:"))
+    print colCat(ctx, "Hard disks:")
     for hdd in hdds:
         if hdd.state != ctx['global'].constants.MediumState_Created:
             hdd.refreshState()
-        print("   %s (%s)%s %s [logical %s]" % (colPath(ctx, hdd.location), hdd.format, optId(verbose, hdd.id), colSizeM(ctx, asSize(hdd.size, True)), colSizeM(ctx, asSize(hdd.logicalSize, True))))
+        print "   %s (%s)%s %s [logical %s]" % (colPath(ctx, hdd.location), hdd.format, optId(verbose, hdd.id), colSizeM(ctx, asSize(hdd.size, True)), colSizeM(ctx, asSize(hdd.logicalSize, True)))
 
     dvds = ctx['global'].getArray(ctx['vb'], 'DVDImages')
-    print(colCat(ctx, "CD/DVD disks:"))
+    print colCat(ctx, "CD/DVD disks:")
     for dvd in dvds:
         if dvd.state != ctx['global'].constants.MediumState_Created:
             dvd.refreshState()
-        print("   %s (%s)%s %s" % (colPath(ctx, dvd.location), dvd.format, optId(verbose, dvd.id), colSizeM(ctx, asSize(dvd.size, True))))
+        print "   %s (%s)%s %s" % (colPath(ctx, dvd.location), dvd.format, optId(verbose, dvd.id), colSizeM(ctx, asSize(dvd.size, True)))
 
     floppys = ctx['global'].getArray(ctx['vb'], 'floppyImages')
-    print(colCat(ctx, "Floppy disks:"))
+    print colCat(ctx, "Floppy disks:")
     for floppy in floppys:
         if floppy.state != ctx['global'].constants.MediumState_Created:
             floppy.refreshState()
-        print("   %s (%s)%s %s" % (colPath(ctx, floppy.location), floppy.format, optId(verbose, floppy.id), colSizeM(ctx, asSize(floppy.size, True))))
+        print "   %s (%s)%s %s" % (colPath(ctx, floppy.location), floppy.format, optId(verbose, floppy.id), colSizeM(ctx, asSize(floppy.size, True)))
 
     return 0
 
 def listUsbCmd(ctx, args):
-    if len(args) > 1:
-        print("usage: listUsb")
+    if (len(args) > 1):
+        print "usage: listUsb"
         return 0
 
@@ -2202,6 +2202,6 @@
 
 def createHddCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: createHdd sizeM location type")
+    if (len(args) < 3):
+        print "usage: createHdd sizeM location type"
         return 0
 
@@ -2216,7 +2216,7 @@
     progress = hdd.createBaseStorage(size, (ctx['global'].constants.MediumVariant_Standard, ))
     if progressBar(ctx,progress) and hdd.id:
-        print("created HDD at %s as %s" % (colPath(ctx,hdd.location), hdd.id))
-    else:
-       print("cannot create disk (file %s exist?)" % (loc))
+        print "created HDD at %s as %s" % (colPath(ctx,hdd.location), hdd.id)
+    else:
+       print "cannot create disk (file %s exist?)" % (loc)
        reportError(ctx,progress)
        return 0
@@ -2225,6 +2225,6 @@
 
 def registerHddCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: registerHdd location")
+    if (len(args) < 2):
+        print "usage: registerHdd location"
         return 0
 
@@ -2236,5 +2236,5 @@
     parentId = ""
     hdd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_HardDisk, ctx['global'].constants.AccessMode_ReadWrite, False)
-    print("registered HDD as %s" % (hdd.id))
+    print "registered HDD as %s" % (hdd.id)
     return 0
 
@@ -2244,6 +2244,6 @@
 
 def attachHddCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: attachHdd vm hdd controller port:slot")
+    if (len(args) < 3):
+        print "usage: attachHdd vm hdd controller port:slot"
         return 0
 
@@ -2256,5 +2256,5 @@
         hdd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_HardDisk, ctx['global'].constants.AccessMode_ReadWrite, False)
     except:
-        print("no HDD with path %s registered" % (loc))
+        print "no HDD with path %s registered" % (loc)
         return 0
     if len(args) > 3:
@@ -2279,6 +2279,6 @@
 
 def detachHddCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: detachHdd vm hdd")
+    if (len(args) < 3):
+        print "usage: detachHdd vm hdd"
         return 0
 
@@ -2291,5 +2291,5 @@
         hdd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_HardDisk, ctx['global'].constants.AccessMode_ReadWrite, False)
     except:
-        print("no HDD with path %s registered" % (loc))
+        print "no HDD with path %s registered" % (loc)
         return 0
 
@@ -2298,11 +2298,11 @@
 
 def unregisterHddCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: unregisterHdd path <vmunreg>")
+    if (len(args) < 2):
+        print "usage: unregisterHdd path <vmunreg>"
         return 0
 
     vbox = ctx['vb']
     loc = args[1]
-    if len(args) > 2:
+    if (len(args) > 2):
         vmunreg = int(args[2])
     else:
@@ -2311,5 +2311,5 @@
         hdd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_HardDisk, ctx['global'].constants.AccessMode_ReadWrite, False)
     except:
-        print("no HDD with path %s registered" % (loc))
+        print "no HDD with path %s registered" % (loc)
         return 0
 
@@ -2318,8 +2318,8 @@
         try:
             for mach in machs:
-                print("Trying to detach from %s" % (mach))
+                print "Trying to detach from %s" % (mach)
                 detachMedium(ctx, mach, hdd)
-        except Exception as e:
-            print('failed: ', e)
+        except Exception, e:
+            print 'failed: ', e
             return 0
     hdd.close()
@@ -2327,6 +2327,6 @@
 
 def removeHddCmd(ctx, args):
-    if len(args) != 2:
-        print("usage: removeHdd path")
+    if (len(args) != 2):
+        print "usage: removeHdd path"
         return 0
 
@@ -2336,5 +2336,5 @@
         hdd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_HardDisk, ctx['global'].constants.AccessMode_ReadWrite, False)
     except:
-        print("no HDD with path %s registered" % (loc))
+        print "no HDD with path %s registered" % (loc)
         return 0
 
@@ -2345,6 +2345,6 @@
 
 def registerIsoCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: registerIso location")
+    if (len(args) < 2):
+        print "usage: registerIso location"
         return 0
 
@@ -2352,10 +2352,10 @@
     loc = args[1]
     iso = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
-    print("registered ISO as %s" % (iso.id))
+    print "registered ISO as %s" % (iso.id)
     return 0
 
 def unregisterIsoCmd(ctx, args):
-    if len(args) != 2:
-        print("usage: unregisterIso path")
+    if (len(args) != 2):
+        print "usage: unregisterIso path"
         return 0
 
@@ -2365,15 +2365,15 @@
         dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     except:
-        print("no DVD with path %s registered" % (loc))
+        print "no DVD with path %s registered" % (loc)
         return 0
 
     progress = dvd.close()
-    print("Unregistered ISO at %s" % (colPath(ctx, loc)))
+    print "Unregistered ISO at %s" % (colPath(ctx, loc))
 
     return 0
 
 def removeIsoCmd(ctx, args):
-    if len(args) != 2:
-        print("usage: removeIso path")
+    if (len(args) != 2):
+        print "usage: removeIso path"
         return 0
 
@@ -2383,10 +2383,10 @@
         dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     except:
-        print("no DVD with path %s registered" % (loc))
+        print "no DVD with path %s registered" % (loc)
         return 0
 
     progress = dvd.deleteStorage()
     if progressBar(ctx, progress):
-        print("Removed ISO at %s" % (colPath(ctx, dvd.location)))
+        print "Removed ISO at %s" % (colPath(ctx, dvd.location))
     else:
         reportError(ctx, progress)
@@ -2394,6 +2394,6 @@
 
 def attachIsoCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: attachIso vm iso controller port:slot")
+    if (len(args) < 3):
+        print "usage: attachIso vm iso controller port:slot"
         return 0
 
@@ -2406,5 +2406,5 @@
         dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     except:
-        print("no DVD with path %s registered" % (loc))
+        print "no DVD with path %s registered" % (loc)
         return 0
     if len(args) > 3:
@@ -2417,6 +2417,6 @@
 
 def detachIsoCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: detachIso vm iso")
+    if (len(args) < 3):
+        print "usage: detachIso vm iso"
         return 0
 
@@ -2429,5 +2429,5 @@
         dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     except:
-        print("no DVD with path %s registered" % (loc))
+        print "no DVD with path %s registered" % (loc)
         return 0
 
@@ -2436,6 +2436,6 @@
 
 def mountIsoCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: mountIso vm iso controller port:slot")
+    if (len(args) < 3):
+        print "usage: mountIso vm iso controller port:slot"
         return 0
 
@@ -2448,5 +2448,5 @@
         dvd = vbox.openMedium(loc, ctx['global'].constants.DeviceType_DVD, ctx['global'].constants.AccessMode_ReadOnly, False)
     except:
-        print("no DVD with path %s registered" % (loc))
+        print "no DVD with path %s registered" % (loc)
         return 0
 
@@ -2463,6 +2463,6 @@
 
 def unmountIsoCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: unmountIso vm controller port:slot")
+    if (len(args) < 2):
+        print "usage: unmountIso vm controller port:slot"
         return 0
 
@@ -2490,6 +2490,6 @@
 
 def attachCtrCmd(ctx, args):
-    if len(args) < 4:
-        print("usage: attachCtr vm cname bus <type>")
+    if (len(args) < 4):
+        print "usage: attachCtr vm cname bus <type>"
         return 0
 
@@ -2497,5 +2497,5 @@
         ctrltype = enumFromString(ctx, 'StorageControllerType', args[4])
         if ctrltype == None:
-            print("Controller type %s unknown" % (args[4]))
+            print "Controller type %s unknown" % (args[4])
             return 0
     else:
@@ -2507,5 +2507,5 @@
     bus = enumFromString(ctx, 'StorageBus', args[3])
     if bus is None:
-        print("Bus type %s unknown" % (args[3]))
+        print "Bus type %s unknown" % (args[3])
         return 0
     name = args[2]
@@ -2514,6 +2514,6 @@
 
 def detachCtrCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: detachCtr vm name")
+    if (len(args) < 3):
+        print "usage: detachCtr vm name"
         return 0
 
@@ -2526,5 +2526,5 @@
 
 def usbctr(ctx, mach, console, args):
-    if args[0]:
+    if (args[0]):
         console.attachUSBDevice(args[1], "")
     else:
@@ -2532,6 +2532,6 @@
 
 def attachUsbCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: attachUsb vm deviceuid")
+    if (len(args) < 3):
+        print "usage: attachUsb vm deviceuid"
         return 0
 
@@ -2544,6 +2544,6 @@
 
 def detachUsbCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: detachUsb vm deviceuid")
+    if (len(args) < 3):
+        print "usage: detachUsb vm deviceuid"
         return 0
 
@@ -2557,6 +2557,6 @@
 
 def guiCmd(ctx, args):
-    if len(args) > 1:
-        print("usage: gui")
+    if (len(args) > 1):
+        print "usage: gui"
         return 0
 
@@ -2572,6 +2572,6 @@
 
 def shareFolderCmd(ctx, args):
-    if len(args) < 4:
-        print("usage: shareFolder vm path name <writable> <persistent>")
+    if (len(args) < 4):
+        print "usage: shareFolder vm path name <writable> <persistent>"
         return 0
 
@@ -2596,6 +2596,6 @@
 
 def unshareFolderCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: unshareFolder vm name")
+    if (len(args) < 3):
+        print "usage: unshareFolder vm name"
         return 0
 
@@ -2617,7 +2617,7 @@
 def snapshotCmd(ctx, args):
     if (len(args) < 2 or args[1] == 'help'):
-        print("Take snapshot:    snapshot vm take name <description>")
-        print("Restore snapshot: snapshot vm restore name")
-        print("Merge snapshot:   snapshot vm merge name")
+        print "Take snapshot:    snapshot vm take name <description>"
+        print "Restore snapshot: snapshot vm restore name"
+        print "Merge snapshot:   snapshot vm merge name"
         return 0
 
@@ -2627,9 +2627,9 @@
     cmd = args[2]
     if cmd == 'take':
-        if len(args) < 4:
-            print("usage: snapshot vm take name <description>")
+        if (len(args) < 4):
+            print "usage: snapshot vm take name <description>"
             return 0
         name = args[3]
-        if len(args) > 4:
+        if (len(args) > 4):
             desc = args[4]
         else:
@@ -2639,6 +2639,6 @@
 
     if cmd == 'restore':
-        if len(args) < 4:
-            print("usage: snapshot vm restore name")
+        if (len(args) < 4):
+            print "usage: snapshot vm restore name"
             return 0
         name = args[3]
@@ -2648,6 +2648,6 @@
 
     if cmd == 'restorecurrent':
-        if len(args) < 4:
-            print("usage: snapshot vm restorecurrent")
+        if (len(args) < 4):
+            print "usage: snapshot vm restorecurrent"
             return 0
         snap = mach.currentSnapshot()
@@ -2656,6 +2656,6 @@
 
     if cmd == 'delete':
-        if len(args) < 4:
-            print("usage: snapshot vm delete name")
+        if (len(args) < 4):
+            print "usage: snapshot vm delete name"
             return 0
         name = args[3]
@@ -2664,5 +2664,5 @@
         return 0
 
-    print("Command '%s' is unknown" % (cmd))
+    print "Command '%s' is unknown" % (cmd)
     return 0
 
@@ -2683,5 +2683,5 @@
         first = 0
         msg = ''
-        for aliasmode, aliaskey in list(alias.items()):
+        for aliasmode, aliaskey in alias.iteritems():
             if first == 0:
                 first = 1
@@ -2689,7 +2689,8 @@
                 msg += ', '
             if int(nat.aliasMode) & aliaskey:
-                msg += '%s: %s' % (aliasmode, 'on')
+                msg += '%d: %s' % (aliasmode, 'on')
             else:
-                msg += '%s: %s' % (aliasmode, 'off')
+                msg += '%d: %s' % (aliasmode, 'off')
+        msg += ')'
         return (0, [msg])
     else:
@@ -2697,7 +2698,7 @@
         if 'default' not in args:
             for a in range(1, len(args)):
-                if args[a] not in alias:
-                    print('Invalid alias mode: ' + args[a])
-                    print(natAlias.__doc__)
+                if not alias.has_key(args[a]):
+                    print 'Invalid alias mode: ' + args[a]
+                    print natAlias.__doc__
                     return (1, None)
                 nat.aliasMode = int(nat.aliasMode) | alias[args[a]]
@@ -2722,9 +2723,9 @@
     else:
         if args[1] < 16000:
-            print('invalid mtu value (%s not in range [65 - 16000])' % (args[1]))
+            print 'invalid mtu value (%s not in range [65 - 16000])' % (args[1])
             return (1, None)
         for i in range(2, len(args)):
             if not args[i].isdigit() or int(args[i]) < 8 or int(args[i]) > 1024:
-                print('invalid %s parameter (%i not in range [8-1024])' % (i, args[i]))
+                print 'invalid %s parameter (%i not in range [8-1024])' % (i, args[i])
                 return (1, None)
         a = [args[1]]
@@ -2734,5 +2735,5 @@
         else:
             for i in range(2, len(args)): a.append(args[i])
-        #print(a)
+        #print a
         nat.setNetworkSettings(int(a[0]), int(a[1]), int(a[2]), int(a[3]), int(a[4]))
     return (0, None)
@@ -2785,6 +2786,6 @@
         cmd = args[1]
         if len(args) != 3:
-            print('invalid args:', args)
-            print(natTftp.__doc__)
+            print 'invalid args:', args
+            print natTftp.__doc__
             return (1, None)
         if cmd == 'prefix': nat.TFTPPrefix = args[2]
@@ -2792,5 +2793,5 @@
         elif cmd == 'server': nat.TFTPNextServer = args[2]
         else:
-            print("invalid cmd:", cmd)
+            print "invalid cmd:", cmd
             return (1, None)
     return (0, None)
@@ -2817,13 +2818,13 @@
         pfcmd = {
             'simple': {
-                'validate': lambda: args[1] in list(pfcmd.keys()) and args[2] in list(proto.keys()) and len(args) == 5,
+                'validate': lambda: args[1] in pfcmd.keys() and args[2] in proto.keys() and len(args) == 5,
                 'func':lambda: nat.addRedirect('', proto[args[2]], '', int(args[3]), '', int(args[4]))
             },
             'no_name': {
-                'validate': lambda: args[1] in list(pfcmd.keys()) and args[2] in list(proto.keys()) and len(args) == 7,
+                'validate': lambda: args[1] in pfcmd.keys() and args[2] in proto.keys() and len(args) == 7,
                 'func': lambda: nat.addRedirect('', proto[args[2]], args[3], int(args[4]), args[5], int(args[6]))
             },
             'ex': {
-                'validate': lambda: args[1] in list(pfcmd.keys()) and args[2] in list(proto.keys()) and len(args) == 8,
+                'validate': lambda: args[1] in pfcmd.keys() and args[2] in proto.keys() and len(args) == 8,
                 'func': lambda: nat.addRedirect(args[3], proto[args[2]], args[4], int(args[5]), args[6], int(args[7]))
             },
@@ -2835,6 +2836,6 @@
 
         if not pfcmd[args[1]]['validate']():
-            print('invalid port-forwarding or args of sub command ', args[1])
-            print(natPortForwarding.__doc__)
+            print 'invalid port-forwarding or args of sub command ', args[1]
+            print natPortForwarding.__doc__
             return (1, None)
 
@@ -2855,5 +2856,5 @@
         (addr, mask) = args[1].split('/')
         if addr.count('.') > 3 or int(mask) < 0 or int(mask) > 32:
-            print('Invalid arguments')
+            print 'Invalid arguments'
             return (1, None)
         nat.network = args[1]
@@ -2879,17 +2880,17 @@
     if len(args) < 2 or args[1] == 'help':
         if len(args) > 2:
-            print(natcommands[args[2]].__doc__)
+            print natcommands[args[2]].__doc__
         else:
-            print(natCmd.__doc__)
+            print natCmd.__doc__
         return 0
     if len(args) == 1 or len(args) < 4 or args[3] not in natcommands:
-        print(natCmd.__doc__)
+        print natCmd.__doc__
         return 0
     mach = ctx['argsToMach'](args)
     if mach == None:
-        print("please specify vm")
-        return 0
-    if len(args) < 3 or not args[2].isdigit() or int(args[2]) not in list(range(0, ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType))):
-        print('please specify adapter num %d isn\'t in range [0-%d]' % (args[2], ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType)))
+        print "please specify vm"
+        return 0
+    if len(args) < 3 or not args[2].isdigit() or int(args[2]) not in range(0, ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType)):
+        print 'please specify adapter num %d isn\'t in range [0-%d]' % (args[2], ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType))
         return 0
     nicnum = int(args[2])
@@ -2918,5 +2919,5 @@
         for r in report:
             msg ='%s nic%d %s: %s' % (mach.name, nicnum, func, r)
-            print(msg)
+            print msg
     return 0
 
@@ -2929,5 +2930,5 @@
         yesno = {'off' : 0, 'on' : 1}
         if args[1] not in yesno:
-            print('%s isn\'t acceptable, please choose %s' % (args[1], list(yesno.keys())))
+            print '%s isn\'t acceptable, please choose %s' % (args[1], yesno.keys())
             return (1, None)
         adapter.__setattr__(attr, yesno[args[1]])
@@ -2952,6 +2953,6 @@
     else:
         if not args[1].isdigit():
-            print('%s isn\'t a number' % (args[1]))
-            return (1, None)
+            print '%s isn\'t a number' % (args[1])
+            print (1, None)
         adapter.lineSpeed = int(args[1])
     return (0, None)
@@ -2975,5 +2976,5 @@
     if len(args) == 1:
         nictypes = ctx['const'].all_values('NetworkAdapterType')
-        for key in list(nictypes.keys()):
+        for key in nictypes.keys():
             if str(adapter.adapterType) == str(nictypes[key]):
                 return (0, str(key))
@@ -2981,6 +2982,6 @@
     else:
         nictypes = ctx['const'].all_values('NetworkAdapterType')
-        if args[1] not in list(nictypes.keys()):
-            print('%s not in acceptable values (%s)' % (args[1], list(nictypes.keys())))
+        if args[1] not in nictypes.keys():
+            print '%s not in acceptable values (%s)' % (args[1], nictypes.keys())
             return (1, None)
         adapter.adapterType = nictypes[args[1]]
@@ -3001,5 +3002,6 @@
             ctx['global'].constants.NetworkAttachmentType_Generic: ('Generic', ''),
         }
-        if type(adapter.attachmentType) != int:
+        import types
+        if type(adapter.attachmentType) != types.IntType:
             t = str(adapter.attachmentType)
         else:
@@ -3035,9 +3037,9 @@
                 'f': lambda: ctx['global'].constants.NetworkAttachmentType_Generic}
         }
-        if args[1] not in list(nicAttachmentType.keys()):
-            print('%s not in acceptable values (%s)' % (args[1], list(nicAttachmentType.keys())))
+        if args[1] not in nicAttachmentType.keys():
+            print '%s not in acceptable values (%s)' % (args[1], nicAttachmentType.keys())
             return (1, None)
         if not nicAttachmentType[args[1]]['v']():
-            print(nicAttachmentType.__doc__)
+            print nicAttachmentType.__doc__
             return (1, None)
         nicAttachmentType[args[1]]['p']()
@@ -3065,17 +3067,17 @@
         if len(args) == 3 \
            and args[2] in niccomand:
-            print(niccomand[args[2]].__doc__)
+            print niccomand[args[2]].__doc__
         else:
-            print(nicCmd.__doc__)
+            print nicCmd.__doc__
         return 0
 
     vm = ctx['argsToMach'](args)
     if vm is None:
-        print('please specify vm')
+        print 'please specify vm'
         return 0
 
     if    len(args) < 3 \
-       or int(args[2]) not in list(range(0, ctx['vb'].systemProperties.getMaxNetworkAdapters(vm.chipsetType))):
-        print('please specify adapter num %d isn\'t in range [0-%d]'% (args[2], ctx['vb'].systemProperties.getMaxNetworkAdapters(vm.chipsetType)))
+       or int(args[2]) not in range(0, ctx['vb'].systemProperties.getMaxNetworkAdapters(vm.chipsetType)):
+        print 'please specify adapter num %d isn\'t in range [0-%d]'% (args[2], ctx['vb'].systemProperties.getMaxNetworkAdapters(vm.chipsetType))
         return 0
     nicnum = int(args[2])
@@ -3090,5 +3092,5 @@
         vm.saveSettings()
     if report is not None:
-        print('%s nic %d %s: %s' % (vm.name, nicnum, args[3], report))
+        print '%s nic %d %s: %s' % (vm.name, nicnum, args[3], report)
     session.unlockMachine()
     return 0
@@ -3097,5 +3099,5 @@
 def promptCmd(ctx, args):
     if    len(args) < 2:
-        print("Current prompt: '%s'" % (ctx['prompt']))
+        print "Current prompt: '%s'" % (ctx['prompt'])
         return 0
 
@@ -3105,5 +3107,5 @@
 def foreachCmd(ctx, args):
     if len(args) < 3:
-        print("usage: foreach scope command, where scope is XPath-like expression //vms/vm[@CPUCount='2']")
+        print "usage: foreach scope command, where scope is XPath-like expression //vms/vm[@CPUCount='2']"
         return 0
 
@@ -3115,5 +3117,5 @@
             e.apply(cmd)
     except:
-        print("Error executing")
+        print "Error executing"
         traceback.print_exc()
     return 0
@@ -3121,5 +3123,5 @@
 def foreachvmCmd(ctx, args):
     if len(args) < 2:
-        print("foreachvm command <args>")
+        print "foreachvm command <args>"
         return 0
     cmdargs = args[1:]
@@ -3131,6 +3133,6 @@
 
 def recordDemoCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: recordDemo vm filename (duration)")
+    if (len(args) < 3):
+        print "usage: recordDemo vm filename (duration)"
         return 0
     mach = argsToMach(ctx, args)
@@ -3145,6 +3147,6 @@
 
 def playbackDemoCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: playbackDemo vm filename (duration)")
+    if (len(args) < 3):
+        print "usage: playbackDemo vm filename (duration)"
         return 0
     mach = argsToMach(ctx, args)
@@ -3167,12 +3169,12 @@
     for a in assigned:
         if a.isPhysicalDevice:
-            print("%s: assigned host device %s guest %s" % (colDev(ctx, a.name), pciAddr(ctx, a.hostAddress), pciAddr(ctx, a.guestAddress)))
+            print "%s: assigned host device %s guest %s" % (colDev(ctx, a.name), pciAddr(ctx, a.hostAddress), pciAddr(ctx, a.guestAddress))
 
     atts = ctx['global'].getArray(console, 'attachedPCIDevices')
     for a in atts:
         if a.isPhysicalDevice:
-            print("%s: physical, guest %s, host %s" % (colDev(ctx, a.name), pciAddr(ctx, a.guestAddress), pciAddr(ctx, a.hostAddress)))
+            print "%s: physical, guest %s, host %s" % (colDev(ctx, a.name), pciAddr(ctx, a.guestAddress), pciAddr(ctx, a.hostAddress))
         else:
-            print("%s: virtual, guest %s" % (colDev(ctx, a.name), pciAddr(ctx, a.guestAddress)))
+            print "%s: virtual, guest %s" % (colDev(ctx, a.name), pciAddr(ctx, a.guestAddress))
     return
 
@@ -3186,6 +3188,6 @@
 
 def lspciCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: lspci vm")
+    if (len(args) < 2):
+        print "usage: lspci vm"
         return 0
     mach = argsToMach(ctx, args)
@@ -3196,6 +3198,6 @@
 
 def attachpciCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: attachpci vm hostpci <guestpci>")
+    if (len(args) < 3):
+        print "usage: attachpci vm hostpci <guestpci>"
         return 0
     mach = argsToMach(ctx, args)
@@ -3204,11 +3206,11 @@
     hostaddr = parsePci(args[2])
     if hostaddr == -1:
-        print("invalid host PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" % (args[2]))
-        return 0
-
-    if len(args) > 3:
+        print "invalid host PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" % (args[2])
+        return 0
+
+    if (len(args) > 3):
         guestaddr = parsePci(args[3])
         if guestaddr == -1:
-            print("invalid guest PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" % (args[3]))
+            print "invalid guest PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" % (args[3])
             return 0
     else:
@@ -3218,6 +3220,6 @@
 
 def detachpciCmd(ctx, args):
-    if len(args) < 3:
-        print("usage: detachpci vm hostpci")
+    if (len(args) < 3):
+        print "usage: detachpci vm hostpci"
         return 0
     mach = argsToMach(ctx, args)
@@ -3226,5 +3228,5 @@
     hostaddr = parsePci(args[2])
     if hostaddr == -1:
-        print("invalid host PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" % (args[2]))
+        print "invalid host PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" % (args[2])
         return 0
 
@@ -3233,6 +3235,6 @@
 
 def gotoCmd(ctx, args):
-    if len(args) < 2:
-        print("usage: goto line")
+    if (len(args) < 2):
+        print "usage: goto line"
         return 0
 
@@ -3271,5 +3273,5 @@
             'verbose':['Toggle verbosity', verboseCmd, 0],
             'setvar':['Set VMs variable: setvar Fedora BIOSSettings.ACPIEnabled True', setvarCmd, 0],
-            'eval':['Evaluate arbitrary Python construction: eval \'for m in getMachines(ctx): print(m.name, "has", m.memorySize, "M")\'', evalCmd, 0],
+            'eval':['Evaluate arbitrary Python construction: eval \'for m in getMachines(ctx): print m.name, "has", m.memorySize, "M"\'', evalCmd, 0],
             'quit':['Exits', quitCmd, 0],
             'host':['Show host information', hostCmd, 0],
@@ -3327,5 +3329,5 @@
             'prompt' : ['Control shell prompt', promptCmd, 0],
             'foreachvm' : ['Perform command for each VM', foreachvmCmd, 0],
-            'foreach' : ['Generic "for each" construction, using XPath-like notation: foreach //vms/vm[@OSTypeId=\'MacOS\'] "print(obj.name)"', foreachCmd, 0],
+            'foreach' : ['Generic "for each" construction, using XPath-like notation: foreach //vms/vm[@OSTypeId=\'MacOS\'] "print obj.name"', foreachCmd, 0],
             'recordDemo':['Record demo: recordDemo Win32 file.dmo 10', recordDemoCmd, 0],
             'playbackDemo':['Playback demo: playbackDemo Win32 file.dmo 10', playbackDemoCmd, 0],
@@ -3342,9 +3344,9 @@
     ci = commands.get(c, None)
     if ci == None:
-        print("Unknown command: '%s', type 'help' for list of known commands" % (c))
+        print "Unknown command: '%s', type 'help' for list of known commands" % (c)
         return 0
     if ctx['remote'] and ctx['vb'] is None:
         if c not in ['connect', 'reconnect', 'help', 'quit']:
-            print("First connect to remote server with %s command." % (colored('connect', 'blue')))
+            print "First connect to remote server with %s command." % (colored('connect', 'blue'))
             return 0
     return ci[1](ctx, args)
@@ -3352,5 +3354,5 @@
 
 def runCommand(ctx, cmd):
-    if not cmd: return 0
+    if len(cmd) == 0: return 0
     args = split_no_quotes(cmd)
     if len(args) == 0: return 0
@@ -3362,5 +3364,5 @@
 #
 # def runTestCmd(ctx, args):
-#    print("Testy test", ctx['vb'])
+#    print "Testy test", ctx['vb']
 #    return 0
 #
@@ -3379,11 +3381,11 @@
     d = {}
     try:
-        exec(compile(open(filename).read(), filename, 'exec'), d, d)
-        for (k, v) in list(d['commands'].items()):
+        execfile(filename, d, d)
+        for (k, v) in d['commands'].items():
             if g_fVerbose:
-                print("customize: adding \"%s\" - %s" % (k, v[0]))
+                print "customize: adding \"%s\" - %s" % (k, v[0])
             cmds[k] = [v[0], v[1], filename]
     except:
-        print("Error loading user extensions from %s" % (filename))
+        print "Error loading user extensions from %s" % (filename)
         traceback.print_exc()
 
@@ -3421,6 +3423,6 @@
     if vbox is not None:
         try:
-            print("Running VirtualBox version %s" % (vbox.version))
-        except Exception as e:
+            print "Running VirtualBox version %s" % (vbox.version)
+        except Exception, e:
             printErr(ctx, e)
             if g_fVerbose:
@@ -3459,10 +3461,7 @@
                 cmd = 'runScript %s'% (g_sScriptFile)
             elif g_sCmd is not None:
-                cmd = next(it)
+                cmd = it.next()
             else:
-                if sys.version_info[0] <= 2:
-                    cmd = raw_input(ctx['prompt'])
-                else:
-                    cmd = input(ctx['prompt'])
+                cmd = raw_input(ctx['prompt'])
             done = runCommand(ctx, cmd)
             if done != 0: break
@@ -3470,10 +3469,10 @@
                 break
         except KeyboardInterrupt:
-            print('====== You can type quit or q to leave')
+            print '====== You can type quit or q to leave'
         except StopIteration:
             break
         except EOFError:
             break
-        except Exception as e:
+        except Exception, e:
             printErr(ctx, e)
             if g_fVerbose:
@@ -3537,11 +3536,11 @@
 
     if options.autopath:
-        asLocations = [ os.getcwd(), ]
-        try:    sScriptDir = os.path.dirname(os.path.abspath(__file__))
+        asLocations = [ os.getcwd(), ];
+        try:    sScriptDir = os.path.dirname(os.path.abspath(__file__));
         except: pass; # In case __file__ isn't there.
         else:
             if platform.system() in [ 'SunOS', ]:
-                asLocations.append(os.path.join(sScriptDir, 'amd64'))
-            asLocations.append(sScriptDir)
+                asLocations.append(os.path.join(sScriptDir, 'amd64'));
+            asLocations.append(sScriptDir);
 
 
@@ -3551,8 +3550,8 @@
                 if   os.path.isfile(os.path.join(sCurLoc, "VirtualBox")) \
                   or os.path.isfile(os.path.join(sCurLoc, "VirtualBox.exe")):
-                    print("Autodetected VBOX_PROGRAM_PATH as", sCurLoc)
+                    print "Autodetected VBOX_PROGRAM_PATH as", sCurLoc
                     os.environ["VBOX_PROGRAM_PATH"] = sCurLoc
                     sPath = sCurLoc
-                    break
+                    break;
         if sPath:
             sys.path.append(os.path.join(sPath, "sdk", "installer"))
@@ -3562,15 +3561,15 @@
             for sCurLoc in asLocations:
                 if os.path.isfile(os.path.join(sCurLoc, "sdk", "bindings", "VirtualBox.xidl")):
-                    sCurLoc = os.path.join(sCurLoc, "sdk")
-                    print("Autodetected VBOX_SDK_PATH as", sCurLoc)
+                    sCurLoc = os.path.join(sCurLoc, "sdk");
+                    print "Autodetected VBOX_SDK_PATH as", sCurLoc
                     os.environ["VBOX_SDK_PATH"] = sCurLoc
-                    sPath = sCurLoc
-                    break
+                    sPath = sCurLoc;
+                    break;
         if sPath:
-            sTmp = os.path.join(sCurLoc, 'bindings', 'xpcom', 'python')
+            sTmp = os.path.join(sCurLoc, 'sdk', 'bindings', 'xpcom', 'python');
             if os.path.isdir(sTmp):
-                sys.path.append(sTmp)
-            del sTmp
-        del sPath, asLocations
+                sys.path.append(sTmp);
+            del sTmp;
+        del sPath, asLocations;
 
 
Index: /trunk/src/VBox/Installer/common/vboxapisetup.py
===================================================================
--- /trunk/src/VBox/Installer/common/vboxapisetup.py	(revision 59794)
+++ /trunk/src/VBox/Installer/common/vboxapisetup.py	(revision 59795)
@@ -1,4 +1,4 @@
 """
-Copyright (C) 2009-2016 Oracle Corporation
+Copyright (C) 2009-2015 Oracle Corporation
 
 This file is part of VirtualBox Open Source Edition (OSE), as
@@ -19,5 +19,5 @@
     comCache1 = os.path.join(get_python_lib(), 'win32com', 'gen_py')
     comCache2 = os.path.join(os.environ.get("TEMP", "c:\\tmp"), 'gen_py')
-    print("Cleaning COM cache at",comCache1,"and",comCache2)
+    print "Cleaning COM cache at",comCache1,"and",comCache2
     shutil.rmtree(comCache1, True)
     shutil.rmtree(comCache2, True)
Index: /trunk/src/VBox/Main/glue/vboxapi.py
===================================================================
--- /trunk/src/VBox/Main/glue/vboxapi.py	(revision 59794)
+++ /trunk/src/VBox/Main/glue/vboxapi.py	(revision 59795)
@@ -7,5 +7,5 @@
 __copyright__ = \
     """
-    Copyright (C) 2009-2016 Oracle Corporation
+    Copyright (C) 2009-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
@@ -32,4 +32,62 @@
     xrange = range
     long = int
+    import builtins
+    print_ = getattr(builtins, 'print', None)
+elif sys.version_info >= (2, 6):
+    import __builtin__
+    print_ = getattr(__builtin__, 'print', None)
+else:
+    def print_(*args, **kwargs):
+        """The new-style print function for Python 2.4 and 2.5."""
+        fp = kwargs.pop("file", sys.stdout)
+        if fp is None:
+            return
+
+        def write(data):
+            if not isinstance(data, basestring):
+                data = str(data)
+            # If the file has an encoding, encode unicode with it.
+            if isinstance(fp, file) and isinstance(data, unicode) and fp.encoding is not None:
+                errors = getattr(fp, "errors", None)
+                if errors is None:
+                    errors = "strict"
+                data = data.encode(fp.encoding, errors)
+            fp.write(data)
+
+        want_unicode = False
+        sep = kwargs.pop("sep", None)
+        if sep is not None:
+            if isinstance(sep, unicode):
+                want_unicode = True
+            elif not isinstance(sep, str):
+                raise TypeError("sep must be None or a string")
+        end = kwargs.pop("end", None)
+        if end is not None:
+            if isinstance(end, unicode):
+                want_unicode = True
+            elif not isinstance(end, str):
+                raise TypeError("end must be None or a string")
+        if kwargs:
+            raise TypeError("invalid keyword arguments to print()")
+        if not want_unicode:
+            for arg in args:
+                if isinstance(arg, unicode):
+                    want_unicode = True
+                    break
+        if want_unicode:
+            newline = unicode("\n")
+            space = unicode(" ")
+        else:
+            newline = "\n"
+            space = " "
+        if sep is None:
+            sep = space
+        if end is None:
+            end = newline
+        for i, arg in enumerate(args):
+            if i:
+                write(sep)
+            write(arg)
+        write(end)
 
 #
@@ -167,5 +225,5 @@
     # Try case-insensitivity workaround for class attributes (COM methods).
     sAttrLower = sAttr.lower()
-    for k in list(self.__class__.__dict__.keys()):
+    for k in self.__class__.__dict__.keys():
         if k.lower() == sAttrLower:
             setattr(self.__class__, sAttr, self.__class__.__dict__[k])
Index: /trunk/src/VBox/Main/webservice/websrv-python.xsl
===================================================================
--- /trunk/src/VBox/Main/webservice/websrv-python.xsl	(revision 59794)
+++ /trunk/src/VBox/Main/webservice/websrv-python.xsl	(revision 59795)
@@ -193,20 +193,20 @@
       if self.isarray:
           return self.handle.__next()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
    def __size(self):
       if self.isarray:
           return self.handle.__size()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
    def __len__(self):
       if self.isarray:
           return self.handle.__len__()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
    def __getitem__(self, index):
       if self.isarray:
           return <xsl:value-of select="$ifname" />(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
    def __str__(self):
@@ -326,5 +326,5 @@
 
     def <xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>(self):
-       raise Error('setters not supported')
+       raise Error, 'setters not supported'
     </xsl:for-each>
 
@@ -332,20 +332,20 @@
       if self.isarray:
           return self.handle.__next()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
     def __size(self):
       if self.isarray:
           return self.handle.__size()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
     def __len__(self):
       if self.isarray:
           return self.handle.__len__()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
     def __getitem__(self, index):
       if self.isarray:
           return <xsl:value-of select="$ifname" />(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 <xsl:call-template name="xsltprocNewlineOutputHack"/>
 </xsl:template>
@@ -511,5 +511,5 @@
      c = self.map.get(handle,-1)
      if c == -1:
-        raise Error('wrong refcount')
+        raise Error, 'wrong refcount'
      c = c - 1
      if c == 0:
@@ -533,20 +533,20 @@
       if self.isarray:
           return self.handle.__next()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __size(self):
       if self.isarray:
           return self.handle.__size()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __len__(self):
       if self.isarray:
           return self.handle.__len__()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __getitem__(self, index):
       if self.isarray:
           return String(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __str__(self):
@@ -624,20 +624,20 @@
       if self.isarray:
           return self.handle.__next()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __size(self):
       if self.isarray:
           return self.handle.__size()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __len__(self):
       if self.isarray:
           return self.handle.__len__()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __getitem__(self, index):
       if self.isarray:
           return Boolean(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class Number:
@@ -650,15 +650,15 @@
       if self.isarray:
           return self.handle.__next()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __size(self):
       if self.isarray:
           return self.handle.__size()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __len__(self):
       if self.isarray:
           return self.handle.__len__()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __str__(self):
@@ -711,5 +711,5 @@
            self.handle = mgr.decodebase64(handle)
        else:
-           raise TypeError("only octet arrays")
+           raise TypeError, "only octet arrays"
 
   def __getitem__(self, index):
@@ -731,5 +731,5 @@
       if self.isarray:
           return UnsignedInt(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 
@@ -743,5 +743,5 @@
       if self.isarray:
           return Int(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class UnsignedShort(Number):
@@ -754,5 +754,5 @@
       if self.isarray:
           return UnsignedShort(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class Short(Number):
@@ -765,5 +765,5 @@
       if self.isarray:
           return Short(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class UnsignedLong(Number):
@@ -776,5 +776,5 @@
       if self.isarray:
           return UnsignedLong(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class Long(Number):
@@ -787,5 +787,5 @@
       if self.isarray:
           return Long(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class Double(Number):
@@ -798,5 +798,5 @@
       if self.isarray:
           return Double(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class Float(Number):
@@ -809,5 +809,5 @@
       if self.isarray:
           return Float(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
 class IUnknown:
@@ -826,20 +826,20 @@
       if self.isarray:
           return self.handle.__next()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __size(self):
       if self.isarray:
           return self.handle.__size()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __len__(self):
       if self.isarray:
           return self.handle.__len__()
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __getitem__(self, index):
       if self.isarray:
           return IUnknown(self.mgr, self.handle[index])
-      raise TypeError("iteration over non-sequence")
+      raise TypeError, "iteration over non-sequence"
 
   def __str__(self):
Index: /trunk/src/VBox/ValidationKit/testdriver/vbox.py
===================================================================
--- /trunk/src/VBox/ValidationKit/testdriver/vbox.py	(revision 59794)
+++ /trunk/src/VBox/ValidationKit/testdriver/vbox.py	(revision 59795)
@@ -9,5 +9,5 @@
 __copyright__ = \
 """
-Copyright (C) 2010-2016 Oracle Corporation
+Copyright (C) 2010-2015 Oracle Corporation
 
 This file is part of VirtualBox Open Source Edition (OSE), as
Index: /trunk/src/libs/xpcom18a4/python/Makefile.kmk
===================================================================
--- /trunk/src/libs/xpcom18a4/python/Makefile.kmk	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/Makefile.kmk	(revision 59795)
@@ -5,5 +5,5 @@
 
 #
-# Copyright (C) 2009-2016 Oracle Corporation
+# Copyright (C) 2009-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
@@ -27,8 +27,12 @@
 #
 # List of supported Python versions, defining a number of
-# VBOX_PYTHON[26|27|31|32|33|34|35|DEF]_[INC|LIB] variables
-# which get picked up below.
+# VBOX_PYTHON[25|26|27|DEF]_[INC|LIB] variables which get picked up below.
 #
 ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
+ ifeq ($(KBUILD_TARGET_ARCH),x86)
+  VBOX_PYTHON25_INC = $(VBOX_PATH_MACOSX_SDK)/usr/include/python2.5
+  VBOX_PYTHON25_LIB = $(VBOX_PATH_MACOSX_SDK)/usr/lib/libpython2.5.dylib
+  VBOX_PYTHON25_LIB_X86 = $(VBOX_PYTHON25_LIB)
+ endif
  if  !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6) \
   && (   !defined(VBOX_OSE) \
@@ -45,5 +49,4 @@
   VBOX_PYTHON27_LIB_X86 = $(VBOX_PYTHON27_LIB)
  endif
- # No Python 3.x yet as part of OSX versions including El Capitan, 10.11.
 
 else
@@ -112,4 +115,63 @@
 
 
+ifdef VBOX_PYTHON23_INC
+#
+# Python 2.3 version
+#
+DLLS += VBoxPython2_3
+VBoxPython2_3_EXTENDS    = VBoxPythonBase
+VBoxPython2_3_EXTENDS_BY = appending
+VBoxPython2_3_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX104,)
+VBoxPython2_3_INCS       = $(VBOX_PYTHON23_INC)
+VBoxPython2_3_LIBS       = $(VBOX_PYTHON23_LIB)
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+DLLS += VBoxPython2_3_x86
+VBoxPython2_3_x86_EXTENDS    = VBoxPythonBase_x86
+VBoxPython2_3_x86_EXTENDS_BY = appending
+VBoxPython2_3_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX104,-x86)
+VBoxPython2_3_x86_INCS       = $(VBOX_PYTHON23_INC)
+VBoxPython2_3_x86_LIBS       = $(VBOX_PYTHON23_LIB_X86)
+ endif
+endif
+
+ifdef VBOX_PYTHON24_INC
+#
+# Python 2.4 version
+#
+DLLS += VBoxPython2_4
+VBoxPython2_4_EXTENDS    = VBoxPythonBase
+VBoxPython2_4_EXTENDS_BY = appending
+VBoxPython2_4_INCS       = $(VBOX_PYTHON24_INC)
+VBoxPython2_4_LIBS       = $(VBOX_PYTHON24_LIB)
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+DLLS += VBoxPython2_4_x86
+VBoxPython2_4_x86_EXTENDS    = VBoxPythonBase_x86
+VBoxPython2_4_x86_EXTENDS_BY = appending
+VBoxPython2_4_x86_INCS       = $(VBOX_PYTHON24_INC)
+VBoxPython2_4_x86_LIBS       = $(VBOX_PYTHON24_LIB_X86)
+ endif
+endif
+
+ifdef VBOX_PYTHON25_INC
+#
+# Python 2.5 version
+#
+DLLS += VBoxPython2_5
+VBoxPython2_5_EXTENDS    = VBoxPythonBase
+VBoxPython2_5_EXTENDS_BY = appending
+VBoxPython2_5_INCS       = $(VBOX_PYTHON25_INC)
+VBoxPython2_5_LIBS       = $(VBOX_PYTHON25_LIB)
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+DLLS += VBoxPython2_5_x86
+VBoxPython2_5_x86_EXTENDS    = VBoxPythonBase_x86
+VBoxPython2_5_x86_EXTENDS_BY = appending
+VBoxPython2_5_x86_INCS       = $(VBOX_PYTHON25_INC)
+VBoxPython2_5_x86_LIBS       = $(VBOX_PYTHON25_LIB_X86)
+ endif
+endif
+
 ifdef VBOX_PYTHON26_INC
 #
@@ -151,109 +213,4 @@
 VBoxPython2_7_x86_INCS       = $(VBOX_PYTHON27_INC)
 VBoxPython2_7_x86_LIBS       = $(VBOX_PYTHON27_LIB_X86)
- endif
-endif
-
-ifdef VBOX_PYTHON31_INC
-#
-# Python 3.1 version
-#
-DLLS += VBoxPython3_1
-VBoxPython3_1_EXTENDS    = VBoxPythonBase
-VBoxPython3_1_EXTENDS_BY = appending
-VBoxPython3_1_TEMPLATE   = XPCOM
-VBoxPython3_1_INCS       = $(VBOX_PYTHON31_INC)
-VBoxPython3_1_LIBS       = $(VBOX_PYTHON31_LIB)
-
- ifdef VBOX_WITH_32_ON_64_MAIN_API
-DLLS += VBoxPython3_1_x86
-VBoxPython3_1_x86_EXTENDS    = VBoxPythonBase_x86
-VBoxPython3_1_x86_EXTENDS_BY = appending
-VBoxPython3_1_x86_TEMPLATE   = XPCOM
-VBoxPython3_1_x86_INCS       = $(VBOX_PYTHON31_INC)
-VBoxPython3_1_x86_LIBS       = $(VBOX_PYTHON31_LIB_X86)
- endif
-endif
-
-ifdef VBOX_PYTHON32_INC
-#
-# Python 3.2 version
-#
-DLLS += VBoxPython3_2
-VBoxPython3_2_EXTENDS    = VBoxPythonBase
-VBoxPython3_2_EXTENDS_BY = appending
-VBoxPython3_2_TEMPLATE   = XPCOM
-VBoxPython3_2_INCS       = $(VBOX_PYTHON32_INC)
-VBoxPython3_2_LIBS       = $(VBOX_PYTHON32_LIB)
-
- ifdef VBOX_WITH_32_ON_64_MAIN_API
-DLLS += VBoxPython3_2_x86
-VBoxPython3_2_x86_EXTENDS    = VBoxPythonBase_x86
-VBoxPython3_2_x86_EXTENDS_BY = appending
-VBoxPython3_2_x86_TEMPLATE   = XPCOM
-VBoxPython3_2_x86_INCS       = $(VBOX_PYTHON32_INC)
-VBoxPython3_2_x86_LIBS       = $(VBOX_PYTHON32_LIB_X86)
- endif
-endif
-
-ifdef VBOX_PYTHON33_INC
-#
-# Python 3.3 version
-#
-DLLS += VBoxPython3_3
-VBoxPython3_3_EXTENDS    = VBoxPythonBase
-VBoxPython3_3_EXTENDS_BY = appending
-VBoxPython3_3_TEMPLATE   = XPCOM
-VBoxPython3_3_INCS       = $(VBOX_PYTHON33_INC)
-VBoxPython3_3_LIBS       = $(VBOX_PYTHON33_LIB)
-
- ifdef VBOX_WITH_32_ON_64_MAIN_API
-DLLS += VBoxPython3_3_x86
-VBoxPython3_3_x86_EXTENDS    = VBoxPythonBase_x86
-VBoxPython3_3_x86_EXTENDS_BY = appending
-VBoxPython3_3_x86_TEMPLATE   = XPCOM
-VBoxPython3_3_x86_INCS       = $(VBOX_PYTHON33_INC)
-VBoxPython3_3_x86_LIBS       = $(VBOX_PYTHON33_LIB_X86)
- endif
-endif
-
-ifdef VBOX_PYTHON34_INC
-#
-# Python 3.4 version
-#
-DLLS += VBoxPython3_4
-VBoxPython3_4_EXTENDS    = VBoxPythonBase
-VBoxPython3_4_EXTENDS_BY = appending
-VBoxPython3_4_TEMPLATE   = XPCOM
-VBoxPython3_4_INCS       = $(VBOX_PYTHON34_INC)
-VBoxPython3_4_LIBS       = $(VBOX_PYTHON34_LIB)
-
- ifdef VBOX_WITH_32_ON_64_MAIN_API
-DLLS += VBoxPython3_4_x86
-VBoxPython3_4_x86_EXTENDS    = VBoxPythonBase_x86
-VBoxPython3_4_x86_EXTENDS_BY = appending
-VBoxPython3_4_x86_TEMPLATE   = XPCOM
-VBoxPython3_4_x86_INCS       = $(VBOX_PYTHON34_INC)
-VBoxPython3_4_x86_LIBS       = $(VBOX_PYTHON34_LIB_X86)
- endif
-endif
-
-ifdef VBOX_PYTHON35_INC
-#
-# Python 3.5 version
-#
-DLLS += VBoxPython3_5
-VBoxPython3_5_EXTENDS    = VBoxPythonBase
-VBoxPython3_5_EXTENDS_BY = appending
-VBoxPython3_5_TEMPLATE   = XPCOM
-VBoxPython3_5_INCS       = $(VBOX_PYTHON35_INC)
-VBoxPython3_5_LIBS       = $(VBOX_PYTHON35_LIB)
-
- ifdef VBOX_WITH_32_ON_64_MAIN_API
-DLLS += VBoxPython3_5_x86
-VBoxPython3_5_x86_EXTENDS    = VBoxPythonBase_x86
-VBoxPython3_5_x86_EXTENDS_BY = appending
-VBoxPython3_5_x86_TEMPLATE   = XPCOM
-VBoxPython3_5_x86_INCS       = $(VBOX_PYTHON35_INC)
-VBoxPython3_5_x86_LIBS       = $(VBOX_PYTHON35_LIB_X86)
  endif
 endif
Index: /trunk/src/libs/xpcom18a4/python/__init__.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/__init__.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/__init__.py	(revision 59795)
@@ -38,11 +38,5 @@
 
 # The XPCOM (Cross Platform COM) package.
-from __future__ import print_function
-import sys
-if sys.version_info[0] <= 2:
-    import exceptions
-    XPCOMBaseException = exceptions.Exception
-else:
-    XPCOMBaseException = Exception
+import exceptions
 
 # A global "verbose" flag - currently used by the
@@ -54,14 +48,14 @@
 # The standard XPCOM exception object.
 # Instances of this class are raised by the XPCOM extension module.
-class Exception(XPCOMBaseException):
+class Exception(exceptions.Exception):
     def __init__(self, errno, message = None):
         assert int(errno) == errno, "The errno param must be an integer"
         self.errno = errno
         self.msg = message
-        XPCOMBaseException.__init__(self, errno)
+        exceptions.Exception.__init__(self, errno)
     def __str__(self):
         if not hr_map:
-            from . import nsError
-            for name, val in list(nsError.__dict__.items()):
+            import nsError
+            for name, val in nsError.__dict__.items():
                 if type(val)==type(0):
                     hr_map[val] = name
@@ -86,5 +80,5 @@
     def __init__(self, errno=None, *args, **kw):
         if errno is None:
-            from . import nsError
+            import nsError
             errno = nsError.NS_ERROR_FAILURE
         Exception.__init__(self, errno, *args, **kw)
@@ -104,5 +98,5 @@
         pass
     def write(self, msg):
-        import xpcom._xpcom as _xpcom
+        import _xpcom
         _xpcom.LogConsoleMessage(msg)
     def close(self):
@@ -110,7 +104,5 @@
 
 def setupLogging():
-    import os
-    if sys.version_info[0] <= 2:
-        import threading, thread
+    import sys, os, threading, thread
     hdlr = logging.StreamHandler(ConsoleServiceStream())
     fmt = logging.Formatter(logging.BASIC_FORMAT)
@@ -121,7 +113,6 @@
     # Later versions of logging use an RLock, so we detect an "old" style
     # handler and update its lock
-    if sys.version_info[0] <= 2:
-        if type(hdlr.lock) == thread.LockType:
-            hdlr.lock = threading.RLock()
+    if type(hdlr.lock) == thread.LockType:
+        hdlr.lock = threading.RLock()
 
     logger.addHandler(hdlr)
@@ -135,13 +126,13 @@
             # open without buffering so never pending output
             stream = open(filename, "wU", 0)
-        except IOError as why:
-            print("pyxpcom failed to open log file '%s': %s"  % (filename, why), file=sys.stderr)
+        except IOError, why:
+            print >> sys.stderr, "pyxpcom failed to open log file '%s': %s" \
+                                 % (filename, why)
             # stream remains default
 
     hdlr = logging.StreamHandler(stream)
     # see above - fix a deadlock problem on this handler too.
-    if sys.version_info[0] <= 2:
-        if type(hdlr.lock) == thread.LockType:
-            hdlr.lock = threading.RLock()
+    if type(hdlr.lock) == thread.LockType:
+        hdlr.lock = threading.RLock()
 
     fmt = logging.Formatter(logging.BASIC_FORMAT)
Index: /trunk/src/libs/xpcom18a4/python/client/__init__.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/client/__init__.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/client/__init__.py	(revision 59795)
@@ -37,5 +37,5 @@
 
 import os
-from types import MethodType
+import new
 import logging
 from xpcom import xpt, COMException, nsError, logger
@@ -126,7 +126,7 @@
     # Exec the code object
     tempNameSpace = {}
-    exec(codeObject, globals(), tempNameSpace)
+    exec codeObject in globals(), tempNameSpace
     ret = tempNameSpace[name]
-    if iid not in interface_method_cache:
+    if not interface_method_cache.has_key(iid):
         interface_method_cache[iid] = {}
     interface_method_cache[iid][name] = ret
@@ -153,8 +153,8 @@
             if flags & FLAGS_TO_IGNORE == 0:
                 if flags & XPT_MD_SETTER:
-                    param_flags = list([(x.param_flags,) + xpt.MakeReprForInvoke(x) for x in m.params])
+                    param_flags = map(lambda x: (x.param_flags,) + xpt.MakeReprForInvoke(x), m.params)
                     setters[m.name] = m.method_index, param_flags
                 elif flags & XPT_MD_GETTER:
-                    param_flags = list([(x.param_flags,) + xpt.MakeReprForInvoke(x) for x in m.params])
+                    param_flags = map(lambda x: (x.param_flags,) + xpt.MakeReprForInvoke(x), m.params)
                     getters[m.name] = m.method_index, param_flags
                 else:
@@ -220,5 +220,5 @@
             except COMException:
                 pass
-        raise ValueError("This object does not support automatic numeric conversion to this type")
+        raise ValueError, "This object does not support automatic numeric conversion to this type"
 
     def __int__(self):
@@ -281,5 +281,5 @@
                 for nominated_iid in interface_infos:
                     # Interface may appear twice in the class info list, so check this here.
-                    if nominated_iid not in self.__dict__['_interface_infos_']:
+                    if not self.__dict__['_interface_infos_'].has_key(nominated_iid):
                         # Just invoke our QI on the object
                         self.queryInterface(nominated_iid)
@@ -290,5 +290,5 @@
                     contractid_info_cache[real_cid] = contractid_info
             else:
-                for key, val in list(contractid_info.items()):
+                for key, val in contractid_info.items():
                     self.__dict__[key].update(val)
 
@@ -300,8 +300,8 @@
         # rebuild the world for each new object.
         iis = self.__dict__['_interface_infos_']
-        assert iid not in iis, "Already remembered this interface!"
+        assert not iis.has_key(iid), "Already remembered this interface!"
         try:
             method_infos, getters, setters, constants = BuildInterfaceInfo(iid)
-        except COMException as why:
+        except COMException, why:
             # Failing to build an interface info generally isn't a real
             # problem - its probably just that the interface is non-scriptable.
@@ -314,15 +314,15 @@
         iis[iid] = method_infos, getters, setters, constants
         names = self.__dict__['_name_to_interface_iid_']
-        for name in list(method_infos.keys()): names[name] = iid
-        for name in list(getters.keys()): names[name] = iid
-        for name in list(setters.keys()): names[name] = iid
-        for name in list(constants.keys()):  names[name] = iid
+        for name in method_infos.keys(): names[name] = iid
+        for name in getters.keys(): names[name] = iid
+        for name in setters.keys(): names[name] = iid
+        for name in constants.keys():  names[name] = iid
 
     def QueryInterface(self, iid):
-        if iid in self._interfaces_:
-            assert iid_name in self._interface_names_, "_interfaces_ has the key, but _interface_names_ does not!"
+        if self._interfaces_.has_key(iid):
+            assert self._interface_names_.has_key(iid.name), "_interfaces_ has the key, but _interface_names_ does not!"
             return self
         # Haven't seen this before - do a real QI.
-        if iid not in self._interface_infos_:
+        if not self._interface_infos_.has_key(iid):
             self._remember_interface_info(iid)
         iface_info = self._interface_infos_[iid]
@@ -350,5 +350,5 @@
     def __getattr__(self, attr):
         if attr in _special_getattr_names:
-            raise AttributeError(attr)
+            raise AttributeError, attr
         # First allow the interface name to return the "raw" interface
         interface = self.__dict__['_interface_names_'].get(attr, None)
@@ -375,5 +375,5 @@
         # Some interfaces may provide this name via "native" support.
         # Loop over all interfaces, and if found, cache it for next time.
-        for interface in list(self.__dict__['_interfaces_'].values()):
+        for interface in self.__dict__['_interfaces_'].values():
             try:
                 ret = getattr(interface, attr)
@@ -382,5 +382,5 @@
             except AttributeError:
                 pass
-        raise AttributeError("XPCOM component '%s' has no attribute '%s'" % (self._object_name_, attr))
+        raise AttributeError, "XPCOM component '%s' has no attribute '%s'" % (self._object_name_, attr)
         
     def __setattr__(self, attr, val):
@@ -397,5 +397,5 @@
             setattr(interface, attr, val)
             return
-        raise AttributeError("XPCOM component '%s' has no attribute '%s'" % (self._object_name_, attr))
+        raise AttributeError, "XPCOM component '%s' has no attribute '%s'" % (self._object_name_, attr)
 
     def _get_classinfo_repr_(self):
@@ -410,5 +410,5 @@
             self.__dict__['_tried_classinfo_'] = 0
 
-        iface_names = list(self.__dict__['_interface_names_'].keys())
+        iface_names = self.__dict__['_interface_names_'].keys()
         try:
             iface_names.remove("nsISupports")
@@ -436,10 +436,10 @@
         self.__dict__.update(constants)
         # We remember the constant names to prevent the user trying to assign to them!
-        self.__dict__['_constant_names_'] = list(constants.keys())
+        self.__dict__['_constant_names_'] = constants.keys()
 
     def __getattr__(self, attr):
         # Allow the underlying interface to provide a better implementation if desired.
         if attr in _special_getattr_names:
-            raise AttributeError(attr)
+            raise AttributeError, attr
 
         ret = getattr(self.__dict__['_comobj_'], attr, None)
@@ -449,5 +449,5 @@
         unbound_method = self.__dict__['_methods_'].get(attr, None)
         if unbound_method is not None:
-            return MethodType(unbound_method, self)
+            return new.instancemethod(unbound_method, self, self.__class__)
 
         getters = self.__dict__['_property_getters_']
@@ -456,5 +456,5 @@
             method_index, param_infos = info
             if len(param_infos)!=1: # Only expecting a retval
-                raise RuntimeError("Can't get properties with this many args!")
+                raise RuntimeError, "Can't get properties with this many args!"
             args = ( param_infos, () )
             return XPTC_InvokeByIndex(self._comobj_, method_index, args)
@@ -467,12 +467,12 @@
             # Cache it locally
             self.__dict__['_methods_'][attr] = unbound_method
-            return MethodType(unbound_method, self)
-
-        raise AttributeError("XPCOM component '%s' has no attribute '%s'" % (self._object_name_, attr))
+            return new.instancemethod(unbound_method, self, self.__class__)
+
+        raise AttributeError, "XPCOM component '%s' has no attribute '%s'" % (self._object_name_, attr)
 
     def __setattr__(self, attr, val):
         # If we already have a __dict__ item of that name, and its not one of
         # our constants, we just directly set it, and leave.
-        if attr in self.__dict__ and attr not in self.__dict__['_constant_names_']:
+        if self.__dict__.has_key(attr) and attr not in self.__dict__['_constant_names_']:
             self.__dict__[attr] = val
             return
@@ -481,8 +481,8 @@
         info = setters.get(attr)
         if info is None:
-            raise AttributeError("XPCOM component '%s' can not set attribute '%s'" % (self._object_name_, attr))
+            raise AttributeError, "XPCOM component '%s' can not set attribute '%s'" % (self._object_name_, attr)
         method_index, param_infos = info
         if len(param_infos)!=1: # Only expecting a single input val
-            raise RuntimeError("Can't set properties with this many args!")
+            raise RuntimeError, "Can't set properties with this many args!"
         real_param_infos = ( param_infos, (val,) )
         return XPTC_InvokeByIndex(self._comobj_, method_index, real_param_infos)
@@ -527,5 +527,5 @@
         try:
             return Component(self._comobj_.QueryReferent(iid)._comobj_, iid)
-        except COMException as details:
+        except COMException, details:
             if details.errno != nsError.NS_ERROR_NULL_POINTER:
                 raise
Index: /trunk/src/libs/xpcom18a4/python/components.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/components.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/components.py	(revision 59795)
@@ -37,11 +37,11 @@
 
 # This module provides the JavaScript "components" interface
-from . import xpt
-import xpcom
-import xpcom._xpcom as _xpcom
+import xpt
+import xpcom, _xpcom
 import xpcom.client
 import xpcom.server
-
-StringTypes = [bytes, str]
+import types
+
+StringTypes = [types.StringType, types.UnicodeType]
 
 def _get_good_iid(iid):
@@ -79,17 +79,17 @@
         if self._dict_data is None:
             self._dict_data = self._build_dict()
-        return list(self._dict_data.keys())
+        return self._dict_data.keys()
     def items(self):
         if self._dict_data is None:
             self._dict_data = self._build_dict()
-        return list(self._dict_data.items())
+        return self._dict_data.items()
     def values(self):
         if self._dict_data is None:
             self._dict_data = self._build_dict()
-        return list(self._dict_data.values())
-#    def has_key(self, key):
-#        if self._dict_data is None:
-#            self._dict_data = self._build_dict()
-#        return self._dict_data.has_key(key)
+        return self._dict_data.values()
+    def has_key(self, key):
+        if self._dict_data is None:
+            self._dict_data = self._build_dict()
+        return self._dict_data.has_key(key)
 
     def __len__(self):
@@ -99,9 +99,9 @@
 
     def __getattr__(self, attr):
-        if self._dict_data is not None and attr in self._dict_data:
+        if self._dict_data is not None and self._dict_data.has_key(attr):
             return self._dict_data[attr]
         return self._get_one(attr)
     def __getitem__(self, item):
-        if self._dict_data is not None and item in self._dict_data:
+        if self._dict_data is not None and self._dict_data.has_key(item):
             return self._dict_data[item]
         return self._get_one(item)
@@ -120,8 +120,4 @@
         other_iid = getattr(other, "_iidobj_", other)
         return cmp(this_iid, other_iid)
-    def __eq__(self, other):
-        this_iid = self._iidobj_
-        other_iid = getattr(other, "_iidobj_", other)
-        return this_iid == other_iid
     def __hash__(self):
         return hash(self._iidobj_)
@@ -129,9 +125,9 @@
         return str(self._iidobj_)
     def __getitem__(self, item):
-        raise TypeError("components.interface objects are not subscriptable")
+        raise TypeError, "components.interface objects are not subscriptable"
     def __setitem__(self, item, value):
-        raise TypeError("components.interface objects are not subscriptable")
+        raise TypeError, "components.interface objects are not subscriptable"
     def __setattr__(self, attr, value):
-        raise AttributeError("Can not set attributes on components.Interface objects")
+        raise AttributeError, "Can not set attributes on components.Interface objects"
     def __getattr__(self, attr):
         # Support constants as attributes.
@@ -143,7 +139,7 @@
                 c[c_ob.name] = c_ob.value
             _constants_by_iid_map[self._iidobj_] = c
-        if attr in c:
+        if c.has_key(attr):
             return c[attr]
-        raise AttributeError("'%s' interfaces do not define a constant '%s'" % (self.name, attr))
+        raise AttributeError, "'%s' interfaces do not define a constant '%s'" % (self.name, attr)
 
 
@@ -152,7 +148,7 @@
         try:
             item = interfaceInfoManager.GetInfoForName(name)
-        except xpcom.COMException as why:
+        except xpcom.COMException, why:
             # Present a better exception message, and give a more useful error code.
-            from . import nsError
+            import nsError
             raise xpcom.COMException(nsError.NS_ERROR_NO_INTERFACE, "The interface '%s' does not exist" % (name,))
         return _Interface(item.GetName(), item.GetIID())
@@ -184,11 +180,11 @@
             self.clsid = rc
             return rc
-        raise AttributeError("%s class has no attribute '%s'" % (self.contractid, attr))
+        raise AttributeError, "%s class has no attribute '%s'" % (self.contractid, attr)
     def createInstance(self, iid = None):
         import xpcom.client
         try:
             return xpcom.client.Component(self.contractid, _get_good_iid(iid))
-        except xpcom.COMException as details:
-            from . import nsError
+        except xpcom.COMException, details:
+            import nsError
             # Handle "no such component" in a cleaner way for the user.
             if details.errno == nsError.NS_ERROR_FACTORY_NOT_REGISTERED:
@@ -223,5 +219,5 @@
 
 # The ID function
-ID = _xpcom.ID
+ID = _xpcom.IID
 
 # A helper to cleanup our namespace as xpcom shuts down.
Index: /trunk/src/libs/xpcom18a4/python/file.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/file.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/file.py	(revision 59795)
@@ -156,5 +156,5 @@
         self.close()
         if mode != "r":
-            raise ValueError("only 'r' mode supported")
+            raise ValueError, "only 'r' mode supported'"
         io_service = components.classes["@mozilla.org/network/io-service;1"] \
                         .getService(components.interfaces.nsIIOService)
@@ -165,5 +165,5 @@
         # Mozilla asserts and starts saying "NULL POINTER" if this is wrong!
         if not url_ob.scheme:
-            raise ValueError("The URI '%s' is invalid (no scheme)" 
+            raise ValueError, ("The URI '%s' is invalid (no scheme)" 
                                   % (url_ob.spec,))
         self.channel = io_service.newChannelFromURI(url_ob)
@@ -202,5 +202,5 @@
             self.inputStream.init(self.fileIO)
         else:
-            raise ValueError("Unknown mode")
+            raise ValueError, "Unknown mode"
 
     def close(self):
@@ -226,5 +226,5 @@
     got = got + file.read()
     if got != expected:
-        raise RuntimeError("Reading '%s' failed - got %d bytes, but expected %d bytes" % (file, len(got), len(expected)))
+        raise RuntimeError, "Reading '%s' failed - got %d bytes, but expected %d bytes" % (file, len(got), len(expected))
 
 def _DoTestBufferRead(file, expected):
@@ -240,5 +240,5 @@
         got = got + str(buffer[:num])
     if got != expected:
-        raise RuntimeError("Reading '%s' failed - got %d bytes, but expected %d bytes" % (file, len(got), len(expected)))
+        raise RuntimeError, "Reading '%s' failed - got %d bytes, but expected %d bytes" % (file, len(got), len(expected))
 
 def _TestLocalFile():
@@ -266,5 +266,5 @@
         # Open the same file again for writing - this should delete the old one.
         if not os.path.isfile(fname):
-            raise RuntimeError("The file '%s' does not exist, but we are explicitly testing create semantics when it does" % (fname,))
+            raise RuntimeError, "The file '%s' does not exist, but we are explicitly testing create semantics when it does" % (fname,)
         test_file = LocalFile(fname, "w")
         test_file.write(data)
@@ -305,7 +305,7 @@
 def _TestURI(url):
     test_file = URIFile(url)
-    print("Opened file is", test_file)
+    print "Opened file is", test_file
     got = test_file.read()
-    print("Read %d bytes of data from %r" % (len(got), url))
+    print "Read %d bytes of data from %r" % (len(got), url)
     test_file.close()
 
@@ -313,5 +313,5 @@
     import sys
     if len(sys.argv) < 2:
-        print("No URL specified on command line - performing self-test")
+        print "No URL specified on command line - performing self-test"
         _TestAll()
     else:
Index: /trunk/src/libs/xpcom18a4/python/gen_python_deps.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/gen_python_deps.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/gen_python_deps.py	(revision 59795)
@@ -2,5 +2,5 @@
 
 """
-Copyright (C) 2009-2016 Oracle Corporation
+Copyright (C) 2009-2013 Oracle Corporation
 
 This file is part of VirtualBox Open Source Edition (OSE), as
@@ -14,7 +14,6 @@
 
 import os,sys
-from distutils.version import StrictVersion
 
-versions = ["2.6", "2.7", "3.1", "3.2", "3.3", "3.4", "3.5"]
+versions = ["2.3", "2.4", "2.5", "2.6", "2.7",]
 prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"]
 known = {}
@@ -42,10 +41,10 @@
 
 def print_vars(vers, known, sep, bitness_magic):
-    print("VBOX_PYTHON%s_INC=%s%s" %(vers, known[0], sep))
+    print "VBOX_PYTHON%s_INC=%s%s" %(vers, known[0], sep)
     if bitness_magic > 0:
-        print("VBOX_PYTHON%s_LIB=%s%s" %(vers, known[2], sep))
-        print("VBOX_PYTHON%s_LIB_X86=%s%s" %(vers, known[1], sep))
+        print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[2], sep)
+        print "VBOX_PYTHON%s_LIB_X86=%s%s" %(vers, known[1], sep)
     else:
-        print("VBOX_PYTHON%s_LIB=%s%s" %(vers, known[1], sep))
+        print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[1], sep)
 
 
@@ -92,6 +91,4 @@
 
     for v in versions:
-        if StrictVersion(v) < StrictVersion('2.6'):
-            continue
         for p in prefixes:
             c = checkPair(p, v, dllpre, dllsuff, bitness_magic)
@@ -99,5 +96,5 @@
                 known[v] = c
                 break
-    keys = list(known.keys())
+    keys = known.keys()
     # we want default to be the lowest versioned Python
     keys.sort()
Index: /trunk/src/libs/xpcom18a4/python/primitives.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/primitives.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/primitives.py	(revision 59795)
@@ -35,5 +35,5 @@
         better = _primitives_map[prin.type]
     except KeyError:
-        raise ValueError("This primitive type (%d) is not supported" % (prin.type,))
+        raise ValueError, "This primitive type (%d) is not supported" % (prin.type,)
     prin = prin.QueryInterface(better)
     return prin.data
Index: /trunk/src/libs/xpcom18a4/python/server/__init__.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/server/__init__.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/server/__init__.py	(revision 59795)
@@ -38,5 +38,5 @@
 # The xpcom.server package.
 
-from xpcom.server.policy import DefaultPolicy
+from policy import DefaultPolicy
 from xpcom import _xpcom
 
@@ -80,9 +80,9 @@
 # Python!
 def NS_GetModule( serviceManager, nsIFile ):
-    from . import loader
+    import loader
     iid = _xpcom.IID_nsIModule
     return WrapObject(loader.MakePythonComponentLoaderModule(serviceManager, nsIFile), iid, bWrapClient = 0)
 
 def _shutdown():
-    from server.policy import _shutdown
+    from policy import _shutdown
     _shutdown()
Index: /trunk/src/libs/xpcom18a4/python/server/loader.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/server/loader.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/server/loader.py	(revision 59795)
@@ -38,7 +38,9 @@
 import xpcom
 from xpcom import components, logger
-from . import module
-import glob
-import os
+
+import module
+
+import glob, os, types
+
 from xpcom.client import Component
 
@@ -55,7 +57,7 @@
     # For now, just run over all classes looking for likely candidates.
     comps = []
-    for name, object in list(py_module.__dict__.items()):
+    for name, object in py_module.__dict__.items():
         try:
-            if (type(object) == type or issubclass(object, object)) and \
+            if (type(object) == types.ClassType or issubclass(object, object)) and \
                _has_good_attr(object, "_com_interfaces_") and \
                _has_good_attr(object, "_reg_clsid_") and \
@@ -146,5 +148,5 @@
                     self.autoRegisterComponent(when, entry)
                 # Handle some common user errors
-                except xpcom.COMException as details:
+                except xpcom.COMException, details:
                     from xpcom import nsError
                     # If the interface name does not exist, suppress the traceback
@@ -154,5 +156,5 @@
                     else:
                         logger.exception("Registration of '%s' failed!", entry.leafName)
-                except SyntaxError as details:
+                except SyntaxError, details:
                     # Syntax error in source file - no useful traceback here either.
                     logger.error("Registration of '%s' failed\n %s",
@@ -224,4 +226,4 @@
 
 def MakePythonComponentLoaderModule(serviceManager, nsIFile):
-    from . import module
+    import module
     return module.Module( [PythonComponentLoader] )
Index: /trunk/src/libs/xpcom18a4/python/server/module.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/server/module.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/server/module.py	(revision 59795)
@@ -39,5 +39,5 @@
 from xpcom import nsError
 
-from . import factory
+import factory
 
 import types
@@ -66,7 +66,7 @@
         # void function.
         fname = os.path.basename(location.path)
-        for klass in list(self.components.values()):
+        for klass in self.components.values():
             reg_contractid = klass._reg_contractid_
-            print("Registering '%s' (%s)" % (reg_contractid, fname))
+            print "Registering '%s' (%s)" % (reg_contractid, fname)
             reg_desc = getattr(klass, "_reg_desc_", reg_contractid)
             compMgr = compMgr.queryInterface(components.interfaces.nsIComponentRegistrar)
@@ -85,5 +85,5 @@
     def unregisterSelf(self, compMgr, location, loaderStr):
         # void function.
-        for klass in list(self.components.values()):
+        for klass in self.components.values():
             ok = 1
             try:
@@ -99,7 +99,7 @@
                     ok = 0
             if ok:
-                print("Successfully unregistered", klass.__name__)
+                print "Successfully unregistered", klass.__name__
             else:
-                print("Unregistration of", klass.__name__, "failed. (probably just not already registered)")
+                print "Unregistration of", klass.__name__, "failed. (probably just not already registered)"
         
     def canUnload(self, compMgr):
Index: /trunk/src/libs/xpcom18a4/python/server/policy.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/server/policy.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/server/policy.py	(revision 59795)
@@ -43,5 +43,4 @@
 import types
 import logging
-import sys
 
 
@@ -62,9 +61,6 @@
 _supports_primitives_map_ = {} # Filled on first use.
 
-_interface_sequence_types_ = tuple, list
-if sys.version_info[0] <= 2:
-    _string_types_ = str, unicode
-else:
-    _string_types_ = bytes, str
+_interface_sequence_types_ = types.TupleType, types.ListType
+_string_types_ = types.StringType, types.UnicodeType
 XPTI_GetInterfaceInfoManager = _xpcom.XPTI_GetInterfaceInfoManager
 
@@ -146,5 +142,5 @@
         self._iid_ = iid
         if ni is None:
-            raise ValueError("The object '%r' can not be used as a COM object" % (instance,))
+            raise ValueError, "The object '%r' can not be used as a COM object" % (instance,)
         # This is really only a check for the user
         if __debug__:
@@ -290,5 +286,5 @@
             if logger.isEnabledFor(logging.DEBUG):
                 try:
-                    raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])
+                    raise exc_info[0], exc_info[1], exc_info[2]
                 except:
                     logger.debug("'%s' raised COM Exception %s",
@@ -298,5 +294,5 @@
         # As above, trick the logging module to handle Python 2.3
         try:
-            raise exc_info[0](exc_info[1]).with_traceback(exc_info[2])
+            raise exc_info[0], exc_info[1], exc_info[2]
         except:
             logger.exception("Unhandled exception calling '%s'", func_name)
@@ -335,7 +331,7 @@
 _supports_primitives_data_ = [
     ("nsISupportsCString", "__str__", str),
-    ("nsISupportsString", "__unicode__", str),
-    ("nsISupportsPRUint64", "__long__", int),
-    ("nsISupportsPRInt64", "__long__", int),
+    ("nsISupportsString", "__unicode__", unicode),
+    ("nsISupportsPRUint64", "__long__", long),
+    ("nsISupportsPRInt64", "__long__", long),
     ("nsISupportsPRUint32", "__int__", int),
     ("nsISupportsPRInt32", "__int__", int),
Index: /trunk/src/libs/xpcom18a4/python/src/ErrorUtils.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/ErrorUtils.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/ErrorUtils.cpp	(revision 59795)
@@ -111,17 +111,9 @@
 	c += "('%s', ";
 	// Pull a trick to ensure a valid string - use Python repr!
-#if PY_MAJOR_VERSION <= 2
 	PyObject *obMessage = PyString_FromString(pszMessageText);
-#else
-	PyObject *obMessage = PyUnicode_FromString(pszMessageText);
-#endif
 	if (obMessage) {
 		PyObject *repr = PyObject_Repr(obMessage);
 		if (repr) {
-#if PY_MAJOR_VERSION <= 2
 			c += PyString_AsString(repr);
-#else
-			c += PyUnicode_AsUTF8(repr);
-#endif
 			Py_DECREF(repr);
 		}
@@ -201,9 +193,5 @@
 	PyObject *temp = PyObject_Str(exc_typ);
 	if (temp) {
-#if PY_MAJOR_VERSION <= 2
 		streamout += PyString_AsString(temp);
-#else
-		streamout += PyUnicode_AsUTF8(temp);
-#endif
 		Py_DECREF(temp);
 	} else
@@ -213,9 +201,5 @@
 		temp = PyObject_Str(exc_val);
 		if (temp) {
-#if PY_MAJOR_VERSION <= 2
 			streamout += PyString_AsString(temp);
-#else
-			streamout += PyUnicode_AsUTF8(temp);
-#endif
 			Py_DECREF(temp);
 		} else
@@ -371,5 +355,4 @@
 	PyObject *obResult = NULL;
 
-#if PY_MAJOR_VERSION <= 2
 	/* Import the modules we need - cStringIO and traceback */
 	modStringIO = PyImport_ImportModule("cStringIO");
@@ -387,21 +370,4 @@
 	if (obStringIO==NULL)
 		TRACEBACK_FETCH_ERROR("cStringIO.StringIO() failed\n");
-#else
-	/* Import the modules we need - io and traceback */
-	modStringIO = PyImport_ImportModule("io");
-	if (modStringIO==NULL)
-		TRACEBACK_FETCH_ERROR("cant import io\n");
-
-	modTB = PyImport_ImportModule("traceback");
-	if (modTB==NULL)
-		TRACEBACK_FETCH_ERROR("cant import traceback\n");
-	/* Construct a StringIO object */
-	obFuncStringIO = PyObject_GetAttrString(modStringIO, "StringIO");
-	if (obFuncStringIO==NULL)
-		TRACEBACK_FETCH_ERROR("cant find io.StringIO\n");
-	obStringIO = PyObject_CallObject(obFuncStringIO, NULL);
-	if (obStringIO==NULL)
-		TRACEBACK_FETCH_ERROR("io.StringIO() failed\n");
-#endif
 	/* Get the traceback.print_exception function, and call it. */
 	obFuncTB = PyObject_GetAttrString(modTB, "print_tb");
@@ -430,17 +396,9 @@
 
 	/* And it should be a string all ready to go - duplicate it. */
-#if PY_MAJOR_VERSION <= 2
 	if (!PyString_Check(obResult))
-#else
-	if (!PyUnicode_Check(obResult))
-#endif
 			TRACEBACK_FETCH_ERROR("getvalue() did not return a string\n");
 
 	{ // a temp scope so I can use temp locals.
-#if PY_MAJOR_VERSION <= 2
 	char *tempResult = PyString_AsString(obResult);
-#else
-	char *tempResult = PyUnicode_AsUTF8(obResult);
-#endif
 	result = (char *)PyMem_Malloc(strlen(tempResult)+1);
 	if (result==NULL)
Index: /trunk/src/libs/xpcom18a4/python/src/PyGBase.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyGBase.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyGBase.cpp	(revision 59795)
@@ -67,5 +67,5 @@
 PRBool CheckDefaultGateway(PyObject *real_inst, REFNSIID iid, nsISupports **ret_gateway);
 
-/*static*/ nsresult
+/*static*/ nsresult 
 PyG_Base::CreateNew(PyObject *pPyInstance, const nsIID &iid, void **ppResult)
 {
@@ -115,9 +115,5 @@
 	}
 	else
-#if PY_MAJOR_VERSION <= 2
 		szRepr = PyString_AsString(r);
-#else
-		szRepr = PyUnicode_AsUTF8(r);
-#endif
 	if (szRepr==NULL) szRepr = "";
 	int reprOffset = *szRepr=='<' ? 1 : 0;
@@ -189,5 +185,5 @@
 	if (iid.Equals(NS_GET_IID(nsISupportsWeakReference)))
 		return (nsISupportsWeakReference *)this;
-	if (iid.Equals(NS_GET_IID(nsIInternalPython)))
+	if (iid.Equals(NS_GET_IID(nsIInternalPython))) 
 		return (nsISupports *)(nsIInternalPython *)this;
 	return NULL;
@@ -196,5 +192,5 @@
 // Call back into Python, passing a Python instance, and get back
 // an interface object that wraps the instance.
-/*static*/ PRBool
+/*static*/ PRBool 
 PyG_Base::AutoWrapPythonInstance(PyObject *ob, const nsIID &iid, nsISupports **ppret)
 {
@@ -249,5 +245,5 @@
 // the object to actually use as the gateway parameter for this interface.
 // For example, it is expected that the policy will wrap the interface
-// object in one of the xpcom.client.Interface objects, allowing
+// object in one of the xpcom.client.Interface objects, allowing 
 // natural usage of the interface from Python clients.
 // Note that piid will usually be NULL - this is because the runtime
@@ -260,8 +256,8 @@
 // so at least the user can simply QI the object.
 PyObject *
-PyG_Base::MakeInterfaceParam(nsISupports *pis,
-			     const nsIID *piid,
+PyG_Base::MakeInterfaceParam(nsISupports *pis, 
+			     const nsIID *piid, 
 			     int methodIndex /* = -1 */,
-			     const XPTParamDescriptor *d /* = NULL */,
+			     const XPTParamDescriptor *d /* = NULL */, 
 			     int paramIndex /* = -1 */)
 {
@@ -306,5 +302,5 @@
 		goto done;
 
-	result = PyObject_CallMethod(m_pPyObject,
+	result = PyObject_CallMethod(m_pPyObject, 
 	                               (char*)"_MakeInterfaceParam_",
 				       (char*)"OOiOi",
@@ -355,5 +351,5 @@
 		return NS_OK;
 	}
-	// If we have a "base object", then we need to delegate _every_ remaining
+	// If we have a "base object", then we need to delegate _every_ remaining 
 	// QI to it.
 	if (m_pBaseObject != NULL)
@@ -378,5 +374,5 @@
 
 		PyObject *result = PyObject_CallMethod(m_pPyObject, (char*)"_QueryInterface_",
-		                                                    (char*)"OO",
+		                                                    (char*)"OO", 
 		                                                    this_interface_ob, ob);
 		Py_DECREF(ob);
@@ -466,9 +462,9 @@
 	if (PyErr_Occurred()) {
 		// The error handling - fairly involved, but worth it as
-		// good error reporting is critical for users to know WTF
+		// good error reporting is critical for users to know WTF 
 		// is going on - especially with TypeErrors etc in their
 		// return values (ie, after the Python code has successfully
 		// exited, but we encountered errors unpacking their
-		// result values for the COM caller - there is literally no
+		// result values for the COM caller - there is literally no 
 		// way to catch these exceptions from Python code, as their
 		// is no Python function directly on the call-stack)
@@ -485,5 +481,5 @@
 		PyErr_Fetch(&exc_typ, &exc_val, &exc_tb);
 
-		PyObject *err_result = PyObject_CallMethod(m_pPyObject,
+		PyObject *err_result = PyObject_CallMethod(m_pPyObject, 
 	                                       (char*)"_GatewayException_",
 					       (char*)"z(OOO)",
@@ -645,6 +641,6 @@
 		ob_ret = PyObject_GetAttrString(real_ob, (char *)szPropertyName);
 		if (ob_ret==NULL) {
-			PyErr_Format(PyExc_AttributeError,
-				     "The object does not have a 'get_%s' function, or a '%s attribute.",
+			PyErr_Format(PyExc_AttributeError, 
+				     "The object does not have a 'get_%s' function, or a '%s attribute.", 
 				     szPropertyName, szPropertyName);
 		} else {
@@ -699,6 +695,6 @@
 			ret = NS_OK;
 		else {
-			PyErr_Format(PyExc_AttributeError,
-				     "The object does not have a 'set_%s' function, or a '%s attribute.",
+			PyErr_Format(PyExc_AttributeError, 
+				     "The object does not have a 'set_%s' function, or a '%s attribute.", 
 				     szPropertyName, szPropertyName);
 		}
@@ -741,5 +737,5 @@
   first thing we do is see if it has been auto-wrapped before.
 
-  If not, we create a new wrapper, then make a COM weak reference
+  If not, we create a new wrapper, then make a COM weak reference 
   to that wrapper, and store it directly back into the instance
   we are auto-wrapping!  The use of a weak-reference prevents
@@ -765,6 +761,6 @@
 		PRBool ok = PR_TRUE;
 		nsCOMPtr<nsIWeakReference> pWeakRef;
-		ok = NS_SUCCEEDED(Py_nsISupports::InterfaceFromPyObject(ob_existing_weak,
-		                                       NS_GET_IID(nsIWeakReference),
+		ok = NS_SUCCEEDED(Py_nsISupports::InterfaceFromPyObject(ob_existing_weak, 
+		                                       NS_GET_IID(nsIWeakReference), 
 		                                       getter_AddRefs(pWeakRef),
 		                                       PR_FALSE));
@@ -795,7 +791,7 @@
 		PRBool ok = PR_TRUE;
 		nsCOMPtr<nsIWeakReference> pWeakRef;
-		ok = NS_SUCCEEDED(Py_nsISupports::InterfaceFromPyObject(ob_existing_weak,
-		                                       NS_GET_IID(nsIWeakReference),
-		                                       getter_AddRefs(pWeakRef),
+		ok = NS_SUCCEEDED(Py_nsISupports::InterfaceFromPyObject(ob_existing_weak, 
+		                                       NS_GET_IID(nsIWeakReference), 
+		                                       getter_AddRefs(pWeakRef), 
 		                                       PR_FALSE));
 		Py_DECREF(ob_existing_weak);
@@ -831,5 +827,5 @@
 			swr->GetWeakReference( getter_AddRefs(pWeakReference) );
 			if (pWeakReference) {
-				PyObject *ob_new_weak = Py_nsISupports::PyObjectFromInterface(pWeakReference,
+				PyObject *ob_new_weak = Py_nsISupports::PyObjectFromInterface(pWeakReference, 
 										   NS_GET_IID(nsIWeakReference),
 										   PR_FALSE ); /* bMakeNicePyObject */
Index: /trunk/src/libs/xpcom18a4/python/src/PyIClassInfo.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyIClassInfo.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyIClassInfo.cpp	(revision 59795)
@@ -107,9 +107,5 @@
 {
 	if (v)
-#if PY_MAJOR_VERSION <= 2
 		return PyString_FromString(v);
-#else
-		return PyUnicode_FromString(v);
-#endif
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -171,5 +167,5 @@
 }
 
-struct PyMethodDef
+struct PyMethodDef 
 PyMethods_IClassInfo[] =
 {
Index: /trunk/src/libs/xpcom18a4/python/src/PyIComponentManagerObsolete.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyIComponentManagerObsolete.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyIComponentManagerObsolete.cpp	(revision 59795)
@@ -133,11 +133,6 @@
 		return PyXPCOM_BuildPyException(r);
 
-#if PY_MAJOR_VERSION <= 2
 	PyObject *ob_pid = PyString_FromString(ret_pid);
 	PyObject *ob_class = PyString_FromString(ret_class);
-#else
-	PyObject *ob_pid = PyUnicode_FromString(ret_pid);
-	PyObject *ob_class = PyUnicode_FromString(ret_class);
-#endif
 	PyObject *ret = Py_BuildValue("OO", ob_pid, ob_class);
 	nsMemory::Free(ret_pid);
@@ -188,5 +183,5 @@
 }
 
-struct PyMethodDef
+struct PyMethodDef 
 PyMethods_IComponentManagerObsolete[] =
 {
Index: /trunk/src/libs/xpcom18a4/python/src/PyIID.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyIID.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyIID.cpp	(revision 59795)
@@ -60,5 +60,4 @@
 	PyObject *obBuf;
 	if ( PyArg_ParseTuple(args, "O", &obBuf)) {
-#if PY_MAJOR_VERSION <= 2
 		if (PyBuffer_Check(obBuf)) {
 			PyBufferProcs *pb = NULL;
@@ -66,22 +65,7 @@
 			void *buf = NULL;
 			int size = (*pb->bf_getreadbuffer)(obBuf, 0, &buf);
-#else
-		if (PyObject_CheckBuffer(obBuf)) {
-			void *buf = NULL;
-            Py_buffer view;
-            if (PyObject_GetBuffer(obBuf, &view, PyBUF_CONTIG_RO) != 0)
-            {
-                PyErr_Format(PyExc_ValueError, "Could not get contiguous buffer from object");
-                return NULL;
-            }
-            Py_ssize_t size = view.len;
-            buf = view.buf;
-#endif
 			if (size != sizeof(nsIID) || buf==NULL) {
-#if PY_MAJOR_VERSION >= 3
-                PyBuffer_Release(&view);
-#endif
 #ifdef VBOX
-                PyErr_Format(PyExc_ValueError, "A buffer object to be converted to an IID must be exactly %d bytes long", (int)sizeof(nsIID));
+                                PyErr_Format(PyExc_ValueError, "A buffer object to be converted to an IID must be exactly %d bytes long", (int)sizeof(nsIID));
 #else
 				PyErr_Format(PyExc_ValueError, "A buffer object to be converted to an IID must be exactly %d bytes long", sizeof(nsIID));
@@ -101,7 +85,4 @@
 				ptr += sizeof(PRUint8);
 			}
-#if PY_MAJOR_VERSION >= 3
-            PyBuffer_Release(&view);
-#endif
 			return new Py_nsIID(iid);
 		}
@@ -126,11 +107,6 @@
 		return PR_FALSE;
 	}
-#if PY_MAJOR_VERSION <= 2
 	if (PyString_Check(ob)) {
 		ok = iid.Parse(PyString_AsString(ob));
-#else
-	if (PyUnicode_Check(ob)) {
-		ok = iid.Parse(PyUnicode_AsUTF8(ob));
-#endif
 		if (!ok) {
 			PyXPCOM_BuildPyException(NS_ERROR_ILLEGAL_VALUE);
@@ -168,5 +144,6 @@
 PyTypeObject Py_nsIID::type =
 {
-	PyVarObject_HEAD_INIT(&PyType_Type, 0)
+	PyObject_HEAD_INIT(&PyType_Type)
+	0,
 	"IID",
 	sizeof(Py_nsIID),
@@ -176,9 +153,5 @@
 	PyTypeMethod_getattr,                           /* tp_getattr */
 	0,                                              /* tp_setattr */
-#if PY_MAJOR_VERSION <= 2
 	PyTypeMethod_compare,                           /* tp_compare */
-#else
-	0,                                              /* reserved */
-#endif
 	PyTypeMethod_repr,                              /* tp_repr */
 	0,                                              /* tp_as_number */
@@ -188,19 +161,4 @@
 	0,                                              /* tp_call */
 	PyTypeMethod_str,                               /* tp_str */
-	0,                                              /* tp_getattro */
-	0,                                              /* tp_setattro */
-	0,                                              /* tp_as_buffer */
-	0,                                              /* tp_flags */
-	0,                                              /* tp_doc */
-	0,                                              /* tp_traverse */
-	0,                                              /* tp_clear */
-	PyTypeMethod_richcompare,                       /* tp_richcompare */
-	0,                                              /* tp_weaklistoffset */
-	0,                                              /* tp_iter */
-	0,                                              /* tp_iternext */
-	0,                                              /* tp_methods */
-	0,                                              /* tp_members */
-	0,                                              /* tp_getset */
-	0,                                              /* tp_base */
 };
 
@@ -226,16 +184,8 @@
 		PyObject *ret;
 		if (iid_repr != nsnull) {
-#if PY_MAJOR_VERSION <= 2
 			ret = PyString_FromString(iid_repr);
-#else
-			ret = PyUnicode_FromString(iid_repr);
-#endif
 			nsMemory::Free(iid_repr);
 		} else
-#if PY_MAJOR_VERSION <= 2
 			ret = PyString_FromString("<cant get IID info!>");
-#else
-			ret = PyUnicode_FromString("<cant get IID info!>");
-#endif
 		return ret;
 	}
@@ -243,5 +193,4 @@
 }
 
-#if PY_MAJOR_VERSION <= 2
 /* static */ int
 Py_nsIID::PyTypeMethod_compare(PyObject *self, PyObject *other)
@@ -252,37 +201,4 @@
 	return rc == 0 ? 0 : (rc < 0 ? -1 : 1);
 }
-#endif
-
-/* static */ PyObject *
-Py_nsIID::PyTypeMethod_richcompare(PyObject *self, PyObject *other, int op)
-{
-    PyObject *result = NULL;
-	Py_nsIID *s_iid = (Py_nsIID *)self;
-	Py_nsIID *o_iid = (Py_nsIID *)other;
-	int rc = memcmp(&s_iid->m_iid, &o_iid->m_iid, sizeof(s_iid->m_iid));
-    switch (op)
-    {
-        case Py_LT:
-            result = rc < 0 ? Py_True : Py_False;
-            break;
-        case Py_LE:
-            result = rc <= 0 ? Py_True : Py_False;
-            break;
-        case Py_EQ:
-            result = rc == 0 ? Py_True : Py_False;
-            break;
-        case Py_NE:
-            result = rc != 0 ? Py_True : Py_False;
-            break;
-        case Py_GT:
-            result = rc > 0 ? Py_True : Py_False;
-            break;
-        case Py_GE:
-            result = rc >= 0 ? Py_True : Py_False;
-            break;
-    }
-    Py_XINCREF(result);
-    return result;
-}
 
 /* static */ PyObject *
@@ -293,14 +209,10 @@
 	char *sziid = s_iid->m_iid.ToString();
 #ifdef VBOX
-	snprintf(buf, sizeof(buf), "_xpcom.ID('%s')", sziid);
+	snprintf(buf, sizeof(buf), "_xpcom.IID('%s')", sziid);
 #else
 	sprintf(buf, "_xpcom.IID('%s')", sziid);
 #endif
 	nsMemory::Free(sziid);
-#if PY_MAJOR_VERSION <= 2
 	return PyString_FromString(buf);
-#else
-	return PyUnicode_FromString(buf);
-#endif
 }
 
@@ -310,9 +222,5 @@
 	Py_nsIID *s_iid = (Py_nsIID *)self;
 	char *sziid = s_iid->m_iid.ToString();
-#if PY_MAJOR_VERSION <= 2
 	PyObject *ret = PyString_FromString(sziid);
-#else
-	PyObject *ret = PyUnicode_FromString(sziid);
-#endif
 	nsMemory::Free(sziid);
 	return ret;
Index: /trunk/src/libs/xpcom18a4/python/src/PyIInputStream.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyIInputStream.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyIInputStream.cpp	(revision 59795)
@@ -109,9 +109,5 @@
 	}
 	if (n==0) { // mozilla will assert if we alloc zero bytes.
-#if PY_MAJOR_VERSION <= 2
 		return PyBuffer_New(0);
-#else
-		return PyBytes_FromString("");
-#endif
 	}
 	char *buf = (char *)nsMemory::Alloc(n);
@@ -127,5 +123,4 @@
 	PyObject *rc = NULL;
 	if ( NS_SUCCEEDED(r) ) {
-#if PY_MAJOR_VERSION <= 2
 		rc = PyBuffer_New(nread);
 		if (rc != NULL) {
@@ -151,7 +146,4 @@
 			memcpy(ob_buf, buf, nread);
 		}
-#else
-        rc = PyBytes_FromStringAndSize(buf, nread);
-#endif
 	} else
 		PyXPCOM_BuildPyException(r);
Index: /trunk/src/libs/xpcom18a4/python/src/PyIInterfaceInfo.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyIInterfaceInfo.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyIInterfaceInfo.cpp	(revision 59795)
@@ -75,9 +75,5 @@
 	if ( NS_FAILED(r) )
 		return PyXPCOM_BuildPyException(r);
-#if PY_MAJOR_VERSION <= 2
 	PyObject *ret = PyString_FromString(name);
-#else
-	PyObject *ret = PyUnicode_FromString(name);
-#endif
 	nsMemory::Free(name);
 	return ret;
@@ -397,5 +393,5 @@
 }
 
-struct PyMethodDef
+struct PyMethodDef 
 PyMethods_IInterfaceInfo[] =
 {
Index: /trunk/src/libs/xpcom18a4/python/src/PyIInterfaceInfoManager.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyIInterfaceInfoManager.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyIInterfaceInfoManager.cpp	(revision 59795)
@@ -135,9 +135,5 @@
 		return PyXPCOM_BuildPyException(r);
 
-#if PY_MAJOR_VERSION <= 2
 	PyObject *ret = PyString_FromString(ret_name);
-#else
-	PyObject *ret = PyUnicode_FromString(ret_name);
-#endif
 	nsMemory::Free(ret_name);
 	return ret;
@@ -190,5 +186,5 @@
 // void autoRegisterInterfaces();
 
-PyMethodDef
+PyMethodDef 
 PyMethods_IInterfaceInfoManager[] =
 {
Index: /trunk/src/libs/xpcom18a4/python/src/PyISupports.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyISupports.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyISupports.cpp	(revision 59795)
@@ -218,34 +218,5 @@
 	}
 	PyXPCOM_TypeObject *this_type = (PyXPCOM_TypeObject *)ob_type;
-#if PY_MAJOR_VERSION <= 2
 	return Py_FindMethodInChain(&this_type->chain, this, (char *)name);
-#else
-    PyMethodChain *chain = &this_type->chain;
-    if (name[0] == '_' && name[1] == '_')
-    {
-        if (!strcmp(name, "__doc__"))
-        {
-            const char *doc = ob_type->tp_doc;
-            if (doc)
-#if PY_MAJOR_VERSION <= 2
-                return PyString_FromString(doc);
-#else
-                return PyUnicode_FromString(doc);
-#endif
-        }
-    }
-    while (chain)
-    {
-        PyMethodDef *ml = chain->methods;
-        for (; ml->ml_name; ml++)
-        {
-            if (!strcmp(name, ml->ml_name))
-                return PyCFunction_New(ml, this);
-        }
-        chain = chain->link;
-    }
-    PyErr_SetString(PyExc_AttributeError, name);
-    return NULL;
-#endif
 }
 
Index: /trunk/src/libs/xpcom18a4/python/src/PyIVariant.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyIVariant.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyIVariant.cpp	(revision 59795)
@@ -62,9 +62,5 @@
 }
 static PyObject *MyChar( char c) {
-#if PY_MAJOR_VERSION <= 2
 	return PyString_FromStringAndSize(&c, 1);
-#else
-	return PyUnicode_FromStringAndSize(&c, 1);
-#endif
 }
 static PyObject *MyUChar( PRUnichar c) {
@@ -127,15 +123,7 @@
 GET_SIMPLE(nsIID, GetAsID, Py_nsIID::PyObjectFromIID)
 
-#if PY_MAJOR_VERSION <= 2
 GET_ALLOCATED(char *, GetAsString, PyString_FromString, nsMemory::Free)
-#else
-GET_ALLOCATED(char *, GetAsString, PyUnicode_FromString, nsMemory::Free)
-#endif
 GET_ALLOCATED(PRUnichar *, GetAsWString, MyUnicode, nsMemory::Free)
-#if PY_MAJOR_VERSION <= 2
 GET_ALLOCATED_SIZE(char *, GetAsStringWithSize, PyString_FromStringAndSize, nsMemory::Free)
-#else
-GET_ALLOCATED_SIZE(char *, GetAsStringWithSize, PyUnicode_FromStringAndSize, nsMemory::Free)
-#endif
 GET_ALLOCATED_SIZE(PRUnichar *, GetAsWStringWithSize, PyObject_FromNSString, nsMemory::Free)
 
@@ -178,5 +166,5 @@
 }
 
-struct PyMethodDef
+struct PyMethodDef 
 PyMethods_IVariant[] =
 {
Index: /trunk/src/libs/xpcom18a4/python/src/PyXPCOM.h
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/PyXPCOM.h	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/PyXPCOM.h	(revision 59795)
@@ -133,22 +133,4 @@
 # endif
 
-# if PY_MAJOR_VERSION >= 3
-#  define PyInt_FromLong(l) PyLong_FromLong(l)
-#  define PyInt_Check(o) PyLong_Check(o)
-#  define PyInt_AsLong(o) PyLong_AsLong(o)
-#  define PyNumber_Int(o) PyNumber_Long(o)
-#  ifndef PyUnicode_AsUTF8
-#   define PyUnicode_AsUTF8(o) _PyUnicode_AsString(o)
-#  endif
-#  ifndef PyUnicode_AsUTF8AndSize
-#   define PyUnicode_AsUTF8AndSize(o,s) _PyUnicode_AsStringAndSize(o,s)
-#  endif
-typedef struct PyMethodChain
-{
-    PyMethodDef *methods;
-    struct PyMethodChain *link;
-} PyMethodChain;
-# endif
-
 #endif /* VBOX_PYXPCOM */
 
@@ -286,5 +268,4 @@
 	static int Py_setattr(PyObject *op, char *name, PyObject *v);
 	static int Py_cmp(PyObject *ob1, PyObject *ob2);
-	static PyObject *Py_richcmp(PyObject *ob1, PyObject *ob2, int op);
 	static long Py_hash(PyObject *self);
 };
@@ -438,8 +419,5 @@
 	/* Python support */
 	static PyObject *PyTypeMethod_getattr(PyObject *self, char *name);
-#if PY_MAJOR_VERSION <= 2
 	static int PyTypeMethod_compare(PyObject *self, PyObject *ob);
-#endif
-	static PyObject *PyTypeMethod_richcompare(PyObject *self, PyObject *ob, int op);
 	static PyObject *PyTypeMethod_repr(PyObject *self);
 	static long PyTypeMethod_hash(PyObject *self);
Index: /trunk/src/libs/xpcom18a4/python/src/Pyxpt_info.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/Pyxpt_info.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/Pyxpt_info.cpp	(revision 59795)
@@ -55,5 +55,5 @@
 	}
     // build an object using the same format as a TypeDescriptor.
-	return Py_BuildValue("bzzz",
+	return Py_BuildValue("bzzz", 
 		d->flags,
 		NULL, NULL, NULL);
@@ -66,5 +66,5 @@
 		return Py_None;
 	}
-	return Py_BuildValue("bbbh",
+	return Py_BuildValue("bbbh", 
 		d->prefix.flags,
 		d->argnum,
@@ -150,14 +150,10 @@
 			break;
 		case TD_CHAR:
-#if PY_MAJOR_VERSION <= 2
 			v = PyString_FromStringAndSize(&c->value.ch, 1);
-#else
-			v = PyUnicode_FromStringAndSize(&c->value.ch, 1);
-#endif
 			break;
 		case TD_WCHAR:
 			v = PyObject_FromNSString((PRUnichar *)&c->value.wch, 1);
 			break;
-	//    TD_VOID              = 13,
+	//    TD_VOID              = 13,  
 		case TD_PNSIID:
 			v = Py_nsIID::PyObjectFromIID(*c->value.iid);
@@ -165,9 +161,5 @@
 	//    TD_DOMSTRING         = 15,
 		case TD_PSTRING:
-#if PY_MAJOR_VERSION <= 2
 			v = PyString_FromString(c->value.str);
-#else
-			v = PyUnicode_FromString(c->value.str);
-#endif
 			break;
 		case TD_PWSTRING:
@@ -183,9 +175,5 @@
 	//    TD_ASTRING           = 25
 		default:
-#if PY_MAJOR_VERSION <= 2
 			v = PyString_FromString("Unknown type code!!");
-#else
-			v = PyUnicode_FromString("Unknown type code!!");
-#endif
 			break;
 
Index: /trunk/src/libs/xpcom18a4/python/src/TypeObject.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/TypeObject.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/TypeObject.cpp	(revision 59795)
@@ -53,5 +53,6 @@
 
 static PyTypeObject PyInterfaceType_Type = {
-	PyVarObject_HEAD_INIT(&PyType_Type, 0)
+	PyObject_HEAD_INIT(&PyType_Type)
+	0,			/* Number of items for varobject */
 	"interface-type",			/* Name of this type */
 	sizeof(PyTypeObject),	/* Basic object size */
@@ -79,9 +80,5 @@
 PyXPCOM_TypeObject::IsType(PyTypeObject *t)
 {
-#if PY_MAJOR_VERSION <= 2
 	return t->ob_type == &PyInterfaceType_Type;
-#else
-	return Py_TYPE(t) == &PyInterfaceType_Type;
-#endif
 }
 
@@ -125,34 +122,4 @@
 }
 
-/*static*/PyObject *
-PyXPCOM_TypeObject::Py_richcmp(PyObject *self, PyObject *other, int op)
-{
-    PyObject *result = NULL;
-    int rc = Py_cmp(self, other);
-    switch (op)
-    {
-        case Py_LT:
-            result = rc < 0 ? Py_True : Py_False;
-            break;
-        case Py_LE:
-            result = rc <= 0 ? Py_True : Py_False;
-            break;
-        case Py_EQ:
-            result = rc == 0 ? Py_True : Py_False;
-            break;
-        case Py_NE:
-            result = rc != 0 ? Py_True : Py_False;
-            break;
-        case Py_GT:
-            result = rc > 0 ? Py_True : Py_False;
-            break;
-        case Py_GE:
-            result = rc >= 0 ? Py_True : Py_False;
-            break;
-    }
-    Py_XINCREF(result);
-    return result;
-}
-
 // @pymethod int|Py_nsISupports|__hash__|Implement a hash-code for the XPCOM object using XPCOM identity rules.
 /*static*/long PyXPCOM_TypeObject::Py_hash(PyObject *self)
@@ -185,5 +152,5 @@
 	char buf[512];
 #ifdef VBOX
-	snprintf(buf, sizeof(buf), "<XPCOM object (%s) at %p/%p>",
+	snprintf(buf, sizeof(buf), "<XPCOM object (%s) at 0x%p/0x%p>",
 	        iid_repr, (void *)self, (void *)pis->m_obj.get());
 #else
@@ -192,9 +159,5 @@
 #endif
 	nsMemory::Free(iid_repr);
-#if PY_MAJOR_VERSION <= 2
 	return PyString_FromString(buf);
-#else
-	return PyUnicode_FromString(buf);
-#endif
 }
 
@@ -210,5 +173,5 @@
 	if (NS_SUCCEEDED(rv))
 		rv = ss->ToString(&val);
-	} // end-scope
+	} // end-scope 
 	Py_END_ALLOW_THREADS;
 	PyObject *ret;
@@ -216,9 +179,5 @@
 		ret = Py_repr(self);
 	else
-#if PY_MAJOR_VERSION <= 2
 		ret = PyString_FromString(val);
-#else
-		ret = PyUnicode_FromString(val);
-#endif
 	if (val) nsMemory::Free(val);
 	return ret;
@@ -234,7 +193,8 @@
 {
 	static const PyTypeObject type_template = {
-		PyVarObject_HEAD_INIT(&PyInterfaceType_Type, 0)
+		PyObject_HEAD_INIT(&PyInterfaceType_Type)
+		0,                                           /*ob_size*/
 		"XPCOMTypeTemplate",                         /*tp_name*/
-		sizeof(Py_nsISupports),                      /*tp_basicsize*/
+		sizeof(Py_nsISupports),                 /*tp_basicsize*/
 		0,                                           /*tp_itemsize*/
 		Py_dealloc,                                  /* tp_dealloc */
@@ -242,11 +202,7 @@
 		Py_getattr,                                  /* tp_getattr */
 		Py_setattr,                                  /* tp_setattr */
-#if PY_MAJOR_VERSION <= 2
 		Py_cmp,                                      /* tp_compare */
-#else
-		0,                                           /* reserved */
-#endif
 		Py_repr,                                     /* tp_repr */
-		0,                                           /* tp_as_number*/
+    		0,                                           /* tp_as_number*/
 		0,                                           /* tp_as_sequence */
 		0,                                           /* tp_as_mapping */
@@ -255,5 +211,5 @@
 		Py_str,                                      /* tp_str */
 		0,                                           /* tp_getattro */
-		0,                                           /* tp_setattro */
+		0,                                           /*tp_setattro */
 		0,                                           /* tp_as_buffer */
 		0,                                           /* tp_flags */
@@ -261,5 +217,5 @@
 		0,                                           /* tp_traverse */
 		0,                                           /* tp_clear */
-		Py_richcmp,                                  /* tp_richcompare */
+		0,                                           /* tp_richcompare */
 		0,                                           /* tp_weaklistoffset */
 		0,                                           /* tp_iter */
Index: /trunk/src/libs/xpcom18a4/python/src/VariantUtils.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/VariantUtils.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/VariantUtils.cpp	(revision 59795)
@@ -84,5 +84,4 @@
 	PRUint32 size;
 	PyObject *s;
-	void *src;
 	PRUnichar *dest;
 
@@ -90,19 +89,5 @@
 	if (!s)
 		return -1;
-	// Drop the UTF-16 byte order mark at the beginning of
-	// the string.  (See the docs on PyUnicode_AsUTF16String.)
-	// Some Mozilla libraries don't like the mark.
-#if PY_MAJOR_VERSION <= 2
 	size = (PyString_GET_SIZE(s) - 2) / sizeof(PRUnichar);
-	src = PyString_AS_STRING(s) + 2;
-#else
-    if (!PyBytes_Check(obj))
-    {
-        PyErr_SetString(PyExc_TypeError, "internal error in PyXPCOM, parameter must be a bytes object");
-        return -1;
-    }
-    size = (PyBytes_GET_SIZE(obj) - 2) / sizeof(PRUnichar);
-    src = PyBytes_AS_STRING(obj) + 2;
-#endif
 	dest = (PRUnichar *)nsMemory::Alloc(sizeof(PRUnichar) * (size + 1));
 	if (!dest) {
@@ -111,5 +96,8 @@
 		return -1;
 	}
-	memcpy(dest, src, sizeof(PRUnichar) * size);
+	// Drop the UTF-16 byte order mark at the beginning of
+	// the string.  (See the docs on PyUnicode_AsUTF16String.)
+	// Some Mozilla libraries don't like the mark.
+	memcpy(dest, PyString_AS_STRING(s) + 2, sizeof(PRUnichar) * size);
 	Py_DECREF(s);
 	dest[size] = 0;
@@ -128,21 +116,13 @@
 	} else {
 		if (bAssumeUTF8) {
-			const nsPromiseFlatCString& temp = PromiseFlatCString(s);
-			ret = PyUnicode_DecodeUTF8(temp.get(), temp.Length(), NULL);
+                        const nsPromiseFlatCString& temp = PromiseFlatCString(s);
+                        ret = PyUnicode_DecodeUTF8(temp.get(), temp.Length(), NULL);
 		} else {
-#if PY_MAJOR_VERSION <= 2
 			ret = PyString_FromStringAndSize(NULL, s.Length());
-#else
-			ret = PyUnicode_FromStringAndSize(NULL, s.Length());
-#endif
 			if (!ret)
 				return NULL;
 			// Need "CopyAsciiTo"!?
 			nsACString::const_iterator fromBegin, fromEnd;
-#if PY_MAJOR_VERSION <= 2
-			char* dest = (char *)PyString_AS_STRING(ret);
-#else
-			char* dest = (char *)PyUnicode_AsUTF8(ret);
-#endif
+			char* dest = PyString_AS_STRING(ret);
 			copy_string(s.BeginReading(fromBegin), s.EndReading(fromEnd), dest);
 		}
@@ -179,5 +159,4 @@
 	PyObject *val_use = NULL;
 	PRBool ok = PR_TRUE;
-#if PY_MAJOR_VERSION <= 2
 	if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 		PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -186,12 +165,4 @@
 	if (ok && (val_use = PyUnicode_FromObject(val))==NULL)
 		ok = PR_FALSE;
-#else
-    if (!PyUnicode_Check(val)) {
-        PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-        ok = PR_FALSE;
-    }
-    val_use = val;
-    Py_INCREF(val_use);
-#endif
 	if (ok) {
 		if (PyUnicode_GET_SIZE(val_use) == 0) {
@@ -382,28 +353,16 @@
 	// If it is NOT a string, we just fall through and allow the standard
 	// sequence unpack code process it (just slower!)
-#if PY_MAJOR_VERSION <= 2
 	if ( array_type == nsXPTType::T_U8 &&
 		(PyString_Check(sequence_ob) || PyUnicode_Check(sequence_ob))) {
-#else
-	if ( array_type == nsXPTType::T_U8 && PyUnicode_Check(sequence_ob)) {
-#endif
 
 		PRBool release_seq;
 		if (PyUnicode_Check(sequence_ob)) {
 			release_seq = PR_TRUE;
-#if PY_MAJOR_VERSION <= 2
 			sequence_ob = PyObject_Str(sequence_ob);
-#else
-			sequence_ob = PyUnicode_AsUTF8String(sequence_ob);
-#endif
 		} else
 			release_seq = PR_FALSE;
 		if (!sequence_ob) // presumably a memory error, or Unicode encoding error.
 			return PR_FALSE;
-#if PY_MAJOR_VERSION <= 2
 		memcpy(pthis, PyString_AS_STRING(sequence_ob), sequence_size);
-#else
-		memcpy(pthis, PyUnicode_AsUTF8(sequence_ob), sequence_size);
-#endif
 		if (release_seq)
                 {
@@ -464,5 +423,4 @@
 				break;
 			  case nsXPTType::T_CHAR:
-#if PY_MAJOR_VERSION <= 2
 				if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 					PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -474,25 +432,11 @@
 				NS_ABORT_IF_FALSE(PyString_Check(val_use), "PyObject_Str didnt return a string object!");
 				FILL_SIMPLE_POINTER( char, *PyString_AS_STRING(val_use) );
-#else
-				if (!PyUnicode_Check(val)) {
-					PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-					BREAK_FALSE;
-				}
-				FILL_SIMPLE_POINTER( char, *PyUnicode_AsUTF8(val) );
-#endif
 				break;
 
 			  case nsXPTType::T_WCHAR:
-#if PY_MAJOR_VERSION <= 2
 				if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 					PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
 					BREAK_FALSE;
 				}
-#else
-				if (!PyUnicode_Check(val)) {
-					PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-					BREAK_FALSE;
-				}
-#endif
 				if ((val_use = PyUnicode_FromObject(val)) == NULL)
 					BREAK_FALSE;
@@ -530,5 +474,4 @@
 				if (val == Py_None)
 					break; // Remains NULL.
-#if PY_MAJOR_VERSION <= 2
 				if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 					PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -542,15 +485,4 @@
 				const char *sz = PyString_AS_STRING(val_use);
 				int nch = PyString_GET_SIZE(val_use);
-#else
-				if (!PyUnicode_Check(val)) {
-					PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-					BREAK_FALSE;
-				}
-				if ((val_use = PyUnicode_AsUTF8String(val))==NULL)
-					BREAK_FALSE;
-
-				const char *sz = PyBytes_AS_STRING(val_use);
-				int nch = PyBytes_GET_SIZE(val_use);
-#endif
 
 				*pp = (char *)nsMemory::Alloc(nch+1);
@@ -570,5 +502,4 @@
 				if (val == Py_None)
 					break; // Remains NULL.
-#if PY_MAJOR_VERSION <= 2
 				if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 					PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -578,12 +509,4 @@
 					BREAK_FALSE;
 				NS_ABORT_IF_FALSE(PyUnicode_Check(val_use), "PyUnicode_FromObject didnt return a Unicode object!");
-#else
-				if (!PyUnicode_Check(val)) {
-					PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-					BREAK_FALSE;
-				}
-				val_use = val;
-                Py_INCREF(val_use);
-#endif
 				if (PyUnicode_AsPRUnichar(val_use, pp, NULL) < 0)
 					BREAK_FALSE;
@@ -626,9 +549,5 @@
 	}
 	if (array_type == nsXPTType::T_U8)
-#if PY_MAJOR_VERSION <= 2
 		return PyString_FromStringAndSize( (char *)array_ptr, sequence_size );
-#else
-		return PyUnicode_FromStringAndSize( (char *)array_ptr, sequence_size );
-#endif
 
 	PRUint32 array_element_size = GetArrayElementSize(array_type);
@@ -680,9 +599,5 @@
 					val = Py_None;
 				} else
-#if PY_MAJOR_VERSION <= 2
 					val = PyString_FromString(*pp);
-#else
-					val = PyUnicode_FromString(*pp);
-#endif
 				break;
 				}
@@ -717,9 +632,5 @@
 				sprintf(buf, "Unknown XPCOM array type flags (0x%x)", array_type);
 				PyXPCOM_LogWarning("%s - returning a string object with this message!\n", buf);
-#if PY_MAJOR_VERSION <= 2
 				val = PyString_FromString(buf);
-#else
-				val = PyUnicode_FromString(buf);
-#endif
 				break;
 				}
@@ -759,8 +670,6 @@
 	if (PyFloat_Check(ob))
 		return nsIDataType::VTYPE_DOUBLE;
-#if PY_MAJOR_VERSION <= 2
 	if (PyString_Check(ob))
 		return nsIDataType::VTYPE_STRING_SIZE_IS;
-#endif
 	if (PyUnicode_Check(ob))
 		return nsIDataType::VTYPE_WSTRING_SIZE_IS;
@@ -817,12 +726,5 @@
 			break;
 		case nsIDataType::VTYPE_STRING_SIZE_IS:
-#if PY_MAJOR_VERSION <= 2
 			nr = v->SetAsStringWithSize(PyString_Size(ob), PyString_AsString(ob));
-#else
-            Py_ssize_t cb;
-            const char *psz;
-            psz = PyUnicode_AsUTF8AndSize(ob, &cb);
-			nr = v->SetAsStringWithSize(cb, psz);
-#endif
 			break;
 		case nsIDataType::VTYPE_WSTRING_SIZE_IS:
@@ -1394,5 +1296,4 @@
 			break;
 		  case nsXPTType::T_CHAR:{
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -1409,36 +1310,17 @@
 
 			ns_v.val.c = *PyString_AS_STRING(val_use);
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-			if (PyUnicode_GET_SIZE(val) != 1) {
-				PyErr_SetString(PyExc_ValueError, "Must specify a one character string for a character");
-				BREAK_FALSE;
-			}
-
-			ns_v.val.c = *PyUnicode_AS_UNICODE(val_use);
-#endif
 			break;
 			}
 
 		  case nsXPTType::T_WCHAR: {
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
 				BREAK_FALSE;
 			}
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-#endif
 			if ((val_use = PyUnicode_FromObject(val))==NULL)
 				BREAK_FALSE;
-			// Sanity check should PyUnicode_FromObject() ever loosen its semantics wrt Unicode!
+			// Sanity check should PyObject_Str() ever loosen its semantics wrt Unicode!
 			NS_ABORT_IF_FALSE(PyUnicode_Check(val_use), "PyUnicode_FromObject didnt return a unicode object!");
-			if (PyUnicode_GET_SIZE(val_use) != 1) {
+			if (PyUnicode_GetSize(val_use) != 1) {
 				PyErr_SetString(PyExc_ValueError, "Must specify a one character string for a character");
 				BREAK_FALSE;
@@ -1478,39 +1360,22 @@
 				ns_v.val.p = new nsCString();
 			} else {
-#if PY_MAJOR_VERSION <= 2
+				// strings are assumed to already be UTF8 encoded.
 				if (PyString_Check(val)) {
-                    // strings are assumed to already be UTF8 encoded.
 					val_use = val;
 					Py_INCREF(val);
-				}
-                else
-#endif
-                if (PyUnicode_Check(val)) {
-                    // Unicode objects are encoded by us.
+				// Unicode objects are encoded by us.
+				} else if (PyUnicode_Check(val)) {
 					if (bIsUTF8)
 						val_use = PyUnicode_AsUTF8String(val);
 					else
-#if PY_MAJOR_VERSION <= 2
 						val_use = PyObject_Str(val);
-#else
-						val_use = PyUnicode_AsUTF8String(val);
-#endif
 				} else {
-#if PY_MAJOR_VERSION <= 2
 					PyErr_SetString(PyExc_TypeError, "UTF8 parameters must be string or Unicode objects");
-#else
-					PyErr_SetString(PyExc_TypeError, "UTF8 parameters must be unicode objects");
-#endif
 					BREAK_FALSE;
 				}
 				if (!val_use)
 					BREAK_FALSE;
-#if PY_MAJOR_VERSION <= 2
 				ns_v.val.p = new nsCString(PyString_AS_STRING(val_use),
 				                           PyString_GET_SIZE(val_use));
-#else
-				ns_v.val.p = new nsCString(PyBytes_AS_STRING(val_use),
-				                           PyBytes_GET_SIZE(val_use));
-#endif
 			}
 
@@ -1528,9 +1393,8 @@
 				break;
 			}
-#if PY_MAJOR_VERSION <= 2
 			// If an "in" char *, and we have a PyString, then pass the
 			// pointer (hoping everyone else plays by the rules too.
 			if (!XPT_PD_IS_OUT(td.param_flags) && PyString_Check(val)) {
-				ns_v.val.p = (void *)PyString_AS_STRING(val);
+				ns_v.val.p = PyString_AS_STRING(val);
 				break;
 			}
@@ -1548,17 +1412,4 @@
 			MAKE_VALUE_BUFFER(cb_this_buffer_pointer);
 			memcpy(this_buffer_pointer, PyString_AS_STRING(val_use), cb_this_buffer_pointer);
-#else
-
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-			if ((val_use = PyUnicode_AsUTF8String(val))==NULL)
-				BREAK_FALSE;
-
-			cb_this_buffer_pointer = PyBytes_GET_SIZE(val_use)+1;
-			MAKE_VALUE_BUFFER(cb_this_buffer_pointer);
-			memcpy(this_buffer_pointer, PyBytes_AS_STRING(val_use), cb_this_buffer_pointer);
-#endif
 			ns_v.val.p = this_buffer_pointer;
 			break;
@@ -1570,5 +1421,4 @@
 				break;
 			}
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -1578,12 +1428,4 @@
 				BREAK_FALSE;
 			NS_ABORT_IF_FALSE(PyUnicode_Check(val_use), "PyUnicode_FromObject didnt return a Unicode object!");
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-            val_use = val;
-            Py_INCREF(val_use);
-#endif
 			PRUnichar *sv;
 			PRUint32 nch;
@@ -1642,5 +1484,4 @@
 				break;
 			}
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -1655,16 +1496,4 @@
 			MAKE_VALUE_BUFFER(cb_this_buffer_pointer);
 			memcpy(this_buffer_pointer, PyString_AS_STRING(val_use), cb_this_buffer_pointer);
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-			if ((val_use = PyUnicode_AsUTF8String(val))==NULL)
-				BREAK_FALSE;
-
-			cb_this_buffer_pointer = PyBytes_GET_SIZE(val_use);
-			MAKE_VALUE_BUFFER(cb_this_buffer_pointer);
-			memcpy(this_buffer_pointer, PyBytes_AS_STRING(val_use), cb_this_buffer_pointer);
-#endif
 			ns_v.val.p = this_buffer_pointer;
 			rc = SetSizeIs(value_index, PR_TRUE, cb_this_buffer_pointer);
@@ -1677,5 +1506,4 @@
 				break;
 			}
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -1686,12 +1514,4 @@
 			// Sanity check should PyObject_Str() ever loosen its semantics wrt Unicode!
 			NS_ABORT_IF_FALSE(PyUnicode_Check(val_use), "PyObject_Unicode didnt return a unicode object!");
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-            val_use = val;
-            Py_INCREF(val_use);
-#endif
 			PRUnichar *sv;
 			PRUint32 nch;
@@ -1899,9 +1719,5 @@
 		break;
 	  case nsXPTType::T_CHAR:
-#if PY_MAJOR_VERSION <= 2
 		ret = PyString_FromStringAndSize( ((char *)ns_v.ptr), 1 );
-#else
-		ret = PyUnicode_FromStringAndSize( ((char *)ns_v.ptr), 1 );
-#endif
 		break;
 
@@ -1931,9 +1747,5 @@
 			Py_INCREF(Py_None);
 		} else
-#if PY_MAJOR_VERSION <= 2
 			ret = PyString_FromString( *((char **)ns_v.ptr) );
-#else
-			ret = PyUnicode_FromString( *((char **)ns_v.ptr) );
-#endif
 		break;
 
@@ -2016,9 +1828,5 @@
 		} else {
 			PRUint32 string_size = GetSizeIs(index, PR_TRUE);
-#if PY_MAJOR_VERSION <= 2
 			ret = PyString_FromStringAndSize( *((char **)ns_v.ptr), string_size );
-#else
-			ret = PyUnicode_FromStringAndSize( *((char **)ns_v.ptr), string_size );
-#endif
 		}
 		break;
@@ -2275,9 +2083,5 @@
 	  case nsXPTType::T_CHAR: {
 		char temp = DEREF_IN_OR_OUT(ns_v.val.c, char);
-#if PY_MAJOR_VERSION <= 2
 		ret = PyString_FromStringAndSize(&temp, 1);
-#else
-		ret = PyUnicode_FromStringAndSize(&temp, 1);
-#endif
 		break;
 		}
@@ -2312,9 +2116,5 @@
 			Py_INCREF(Py_None);
 		} else
-#if PY_MAJOR_VERSION <= 2
 			ret = PyString_FromString(t);
-#else
-			ret = PyUnicode_FromString(t);
-#endif
 		break;
 		}
@@ -2378,9 +2178,5 @@
 			Py_INCREF(Py_None);
 		} else
-#if PY_MAJOR_VERSION <= 2
 			ret = PyString_FromStringAndSize(t, string_size);
-#else
-			ret = PyUnicode_FromStringAndSize(t, string_size);
-#endif
 		break;
 		}
@@ -2403,9 +2199,5 @@
 		sprintf(buf, "Unknown XPCOM type flags (0x%x)", td.type_flags);
 		PyXPCOM_LogWarning("%s - returning a string object with this message!\n", buf);
-#if PY_MAJOR_VERSION <= 2
 		ret = PyString_FromString(buf);
-#else
-		ret = PyUnicode_FromString(buf);
-#endif
 		break;
 		}
@@ -2548,5 +2340,4 @@
 		break;
 	  case nsXPTType::T_CHAR:
-#if PY_MAJOR_VERSION <= 2
 		if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 			PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -2558,25 +2349,11 @@
 		NS_ABORT_IF_FALSE(PyString_Check(val_use), "PyObject_Str didnt return a string object!");
 		FILL_SIMPLE_POINTER( char, *PyString_AS_STRING(val_use) );
-#else
-		if (!PyUnicode_Check(val)) {
-			PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-			BREAK_FALSE;
-		}
-		FILL_SIMPLE_POINTER( char, *PyUnicode_AS_UNICODE(val) );
-#endif
 		break;
 
 	  case nsXPTType::T_WCHAR:
-#if PY_MAJOR_VERSION <= 2
 		if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 			PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
 			BREAK_FALSE;
 		}
-#else
-		if (!PyUnicode_Check(val)) {
-			PyErr_SetString(PyExc_TypeError, "This parameter must be a Unicode object");
-			BREAK_FALSE;
-		}
-#endif
 		if ((val_use = PyUnicode_FromObject(val))==NULL)
 			BREAK_FALSE;
@@ -2618,5 +2395,4 @@
 			NS_ABORT_IF_FALSE(0, "dont handle None here yet");
 		} else {
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -2626,14 +2402,5 @@
 			NS_ABORT_IF_FALSE(PyString_Check(val_use), "PyObject_Str didnt return a string object!");
 			const char *sz = PyString_AS_STRING(val_use);
-			ws->Assign(sz, PyString_GET_SIZE(val_use));
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-			val_use = PyUnicode_AsUTF8String(val);
-			const char *sz = PyBytes_AS_STRING(val_use);
-			ws->Assign(sz, PyBytes_GET_SIZE(val_use));
-#endif
+			ws->Assign(sz, PyString_Size(val_use));
 		}
 		break;
@@ -2645,30 +2412,16 @@
 			NS_ABORT_IF_FALSE(0, "dont handle None here yet");
 		} else {
-#if PY_MAJOR_VERSION <= 2
 			if (PyString_Check(val)) {
 				val_use = val;
 				Py_INCREF(val);
-			}
-            else
-#endif
-            if (PyUnicode_Check(val)) {
+			} else if (PyUnicode_Check(val)) {
 				val_use = PyUnicode_AsUTF8String(val);
 			} else {
-#if PY_MAJOR_VERSION <= 2
 				PyErr_SetString(PyExc_TypeError, "UTF8 parameters must be string or Unicode objects");
-#else
-				PyErr_SetString(PyExc_TypeError, "UTF8 parameters must be unicode objects");
-#endif
-				BREAK_FALSE;
-			}
-#if PY_MAJOR_VERSION <= 2
+				BREAK_FALSE;
+			}
 			NS_ABORT_IF_FALSE(PyString_Check(val_use), "must have a string object!");
 			const char *sz = PyString_AS_STRING(val_use);
-			ws->Assign(sz, PyString_GET_SIZE(val_use));
-#else
-			NS_ABORT_IF_FALSE(PyBytes_Check(val_use), "must have a bytes object!");
-			const char *sz = PyBytes_AS_STRING(val_use);
-			ws->Assign(sz, PyBytes_GET_SIZE(val_use));
-#endif
+			ws->Assign(sz, PyString_Size(val_use));
 		}
 		break;
@@ -2684,5 +2437,4 @@
 		if (val == Py_None)
 			break; // Remains NULL.
-#if PY_MAJOR_VERSION <= 2
 		if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 			PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -2696,15 +2448,4 @@
 		const char *sz = PyString_AS_STRING(val_use);
 		int nch = PyString_GET_SIZE(val_use);
-#else
-		if (!PyUnicode_Check(val)) {
-			PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-			BREAK_FALSE;
-		}
-		if ((val_use = PyUnicode_AsUTF8String(val))==NULL)
-			BREAK_FALSE;
-
-		const char *sz = PyBytes_AS_STRING(val_use);
-		int nch = PyBytes_GET_SIZE(val_use);
-#endif
 
 		*pp = (char *)nsMemory::Alloc(nch+1);
@@ -2724,5 +2465,4 @@
 		if (val == Py_None)
 			break; // Remains NULL.
-#if PY_MAJOR_VERSION <= 2
 		if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 			PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -2731,12 +2471,4 @@
 		val_use = PyUnicode_FromObject(val);
 		NS_ABORT_IF_FALSE(PyUnicode_Check(val_use), "PyUnicode_FromObject didnt return a Unicode object!");
-#else
-		if (!PyUnicode_Check(val)) {
-			PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-			BREAK_FALSE;
-		}
-        val_use = val;
-        Py_INCREF(val_use);
-#endif
 		if (PyUnicode_AsPRUnichar(val_use, pp, NULL) < 0)
 			BREAK_FALSE;
@@ -2793,5 +2525,4 @@
 		PRUint32 nch = 0;
 		if (val != Py_None) {
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -2805,15 +2536,4 @@
 			sz = PyString_AS_STRING(val_use);
 			nch = PyString_GET_SIZE(val_use);
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-			if ((val_use = PyUnicode_AsUTF8String(val))==NULL)
-				BREAK_FALSE;
-
-			sz = PyBytes_AS_STRING(val_use);
-			nch = PyBytes_GET_SIZE(val_use);
-#endif
 		}
 		PRBool bBackFill = PR_FALSE;
@@ -2862,5 +2582,4 @@
 
 		if (val != Py_None) {
-#if PY_MAJOR_VERSION <= 2
 			if (!PyString_Check(val) && !PyUnicode_Check(val)) {
 				PyErr_SetString(PyExc_TypeError, "This parameter must be a string or Unicode object");
@@ -2869,12 +2588,4 @@
 			val_use = PyUnicode_FromObject(val);
 			NS_ABORT_IF_FALSE(PyUnicode_Check(val_use), "PyUnicode_FromObject didnt return a Unicode object!");
-#else
-			if (!PyUnicode_Check(val)) {
-				PyErr_SetString(PyExc_TypeError, "This parameter must be a unicode object");
-				BREAK_FALSE;
-			}
-            val_use = val;
-            Py_INCREF(val_use);
-#endif
 			if (PyUnicode_AsPRUnichar(val_use, &sz, &nch) < 0)
 				BREAK_FALSE;
@@ -3039,9 +2750,5 @@
 		// But the retval is often the last param described in the info.
 		if (!PySequence_Check(user_result) ||
-#if PY_MAJOR_VERSION <= 2
 		     PyString_Check(user_result) ||
-#else
-		     PyBytes_Check(user_result) ||
-#endif
 		     PyUnicode_Check(user_result)) {
 			PyErr_SetString(PyExc_TypeError, "This function has multiple results, but a sequence was not given to fill them");
Index: /trunk/src/libs/xpcom18a4/python/src/dllmain.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/dllmain.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/dllmain.cpp	(revision 59795)
@@ -196,5 +196,5 @@
 	CEnterLeaveXPCOMFramework _celf;
 	PRInt32 cnt = PR_AtomicIncrement(&g_cLockCount);
-	if (cnt==1) { // First call
+	if (cnt==1) { // First call 
 		if (!Py_IsInitialized()) {
 			Py_Initialize();
@@ -204,9 +204,5 @@
 			if (PySys_GetObject((char*)"argv")==NULL) {
 				PyObject *path = PyList_New(0);
-#if PY_MAJOR_VERSION <= 2
 				PyObject *str = PyString_FromString("");
-#else
-				PyObject *str = PyUnicode_FromString("");
-#endif
 				PyList_Append(path, str);
 				PySys_SetObject((char*)"argv", path);
@@ -250,5 +246,5 @@
 	PR_DestroyLock(g_lockMain);
 #ifndef PYXPCOM_USE_PYGILSTATE
-	// I can't locate a way to kill this -
+	// I can't locate a way to kill this - 
 	// should I pass a dtor to PR_NewThreadPrivateIndex??
 	// TlsFree(tlsIndex);
@@ -334,5 +330,5 @@
 		bHaveInitXPCOM = PR_TRUE;
 		// Register our custom interfaces.
-
+	
 		Py_nsISupports::InitType();
 		Py_nsIComponentManager::InitType();
@@ -346,5 +342,5 @@
 		// for backward compatibility:
 		Py_nsIComponentManagerObsolete::InitType();
-
+		
 	}
 	return rc;
Index: /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp	(revision 59795)
@@ -84,57 +84,33 @@
 # endif
 # ifdef VBOX_PYXPCOM_VERSIONED
-#  if   PY_VERSION_HEX >= 0x03080000 && PY_VERSION_HEX < 0x03090000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_8")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_8)
-
-#  elif PY_VERSION_HEX >= 0x03070000 && PY_VERSION_HEX < 0x03080000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_7")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_7)
-
-#  elif PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x03070000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_6")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_6)
-
-#  elif PY_VERSION_HEX >= 0x03050000 && PY_VERSION_HEX < 0x03060000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_5")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_5)
-
-#  elif PY_VERSION_HEX >= 0x03040000 && PY_VERSION_HEX < 0x03050000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_4")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_4)
-
-#  elif PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x03040000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_3")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_3)
-
-#  elif PY_VERSION_HEX >= 0x03020000 && PY_VERSION_HEX < 0x03030000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_2")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_2)
-
-#  elif PY_VERSION_HEX >= 0x03010000 && PY_VERSION_HEX < 0x03020000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_1")
-#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_1)
-
-#  elif PY_VERSION_HEX >= 0x02080000 && PY_VERSION_HEX < 0x02090000
+#  if   PY_VERSION_HEX >= 0x02080000
 #   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_8")
 #   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_8)
 
-#  elif PY_VERSION_HEX >= 0x02070000 && PY_VERSION_HEX < 0x02080000
+#  elif PY_VERSION_HEX >= 0x02070000
 #   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_7")
 #   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_7)
 
-#  elif PY_VERSION_HEX >= 0x02060000 && PY_VERSION_HEX < 0x02070000
+#  elif PY_VERSION_HEX >= 0x02060000
 #   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_6")
 #   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_6)
+
+#  elif PY_VERSION_HEX >= 0x02050000
+#   define MODULE_NAME 	  MANGLE_MODULE_NAME("VBoxPython2_5")
+#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_5)
+
+#  elif PY_VERSION_HEX >= 0x02040000
+#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_4")
+#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_4)
+
+#  elif PY_VERSION_HEX >= 0x02030000
+#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_3")
+#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_3)
 #  else
-#   error "Fix module versioning. This Python version is not recognized."
+#   error "Fix module versioning."
 #  endif
 # else
 #  define MODULE_NAME 	  MANGLE_MODULE_NAME("VBoxPython")
-#  if PY_MAJOR_VERSION <= 2
-#   define initVBoxPython  MANGLE_MODULE_INIT(initVBoxPython)
-#  else
-#   define initVBoxPython  MANGLE_MODULE_INIT(PyInit_VBoxPython)
-#  endif
+#  define initVBoxPython  MANGLE_MODULE_INIT(initVBoxPython)
 # endif
 #else
@@ -145,5 +121,4 @@
 // interface support!
 
-#ifndef VBOX
 /* deprecated, included for backward compatibility */
 static PyObject *
@@ -168,5 +143,4 @@
 	return Py_nsISupports::PyObjectFromInterface(ocm, NS_GET_IID(nsIComponentManagerObsolete), PR_FALSE);
 }
-#endif
 
 static PyObject *
@@ -221,5 +195,4 @@
 }
 
-#ifndef VBOX
 /* deprecated, included for backward compatibility */
 static PyObject *
@@ -231,5 +204,4 @@
 	return PyXPCOMMethod_GetComponentManager(self, args);
 }
-#endif
 
 static PyObject *
@@ -528,9 +500,5 @@
 	if (!PyArg_ParseTuple(args, "i", &bufSize))
 		return NULL;
-#if PY_MAJOR_VERSION <= 2
 	return PyBuffer_New(bufSize);
-#else
-    return PyBytes_FromStringAndSize(NULL, bufSize);
-#endif
 }
 
@@ -703,14 +671,10 @@
 	{"GetComponentManager", PyXPCOMMethod_GetComponentManager, 1},
 	{"GetComponentRegistrar", PyXPCOMMethod_GetComponentRegistrar, 1},
-#ifndef VBOX
 	{"NS_GetGlobalComponentManager", PyXPCOMMethod_NS_GetGlobalComponentManager, 1}, // deprecated
-#endif
 	{"XPTI_GetInterfaceInfoManager", PyXPCOMMethod_XPTI_GetInterfaceInfoManager, 1},
 	{"XPTC_InvokeByIndex", PyXPCOMMethod_XPTC_InvokeByIndex, 1},
 	{"GetServiceManager", PyXPCOMMethod_GetServiceManager, 1},
-#ifndef VBOX
 	{"GetGlobalServiceManager", PyXPCOMMethod_GetGlobalServiceManager, 1}, // deprecated
 	{"IID", PyXPCOMMethod_IID, 1}, // IID is wrong - deprecated - not just IID, but CID, etc.
-#endif
 	{"ID", PyXPCOMMethod_IID, 1}, // This is the official name.
 	{"NS_ShutdownXPCOM", PyXPCOMMethod_NS_ShutdownXPCOM, 1},
@@ -727,9 +691,9 @@
 	{"GetVariantValue", PyXPCOMMethod_GetVariantValue, 1},
 #ifdef VBOX
-    {"WaitForEvents", PyXPCOMMethod_WaitForEvents, 1},
-    {"InterruptWait", PyXPCOMMethod_InterruptWait, 1},
-    {"DeinitCOM",     PyXPCOMMethod_DeinitCOM, 1},
-    {"AttachThread",  PyXPCOMMethod_AttachThread, 1},
-    {"DetachThread",  PyXPCOMMethod_DetachThread, 1},
+        {"WaitForEvents", PyXPCOMMethod_WaitForEvents, 1},
+        {"InterruptWait", PyXPCOMMethod_InterruptWait, 1},
+        {"DeinitCOM",     PyXPCOMMethod_DeinitCOM, 1},
+        {"AttachThread",  PyXPCOMMethod_AttachThread, 1},
+        {"DetachThread",  PyXPCOMMethod_DetachThread, 1},
 #endif
 #ifdef VBOX_DEBUG_LIFETIMES
@@ -741,16 +705,4 @@
 };
 
-#if PY_MAJOR_VERSION >= 3
-static struct PyModuleDef xpcom_module =
-{
-    PyModuleDef_HEAD_INIT,
-    MODULE_NAME,    /* name of module */
-    NULL,           /* module documentation */
-    -1,             /* size of per-interpreter state or -1 if using globals */
-    xpcom_methods
-};
-#endif
-
-
 #define REGISTER_IID(t) { \
 	PyObject *iid_ob = Py_nsIID::PyObjectFromIID(NS_GET_IID(t)); \
@@ -769,10 +721,6 @@
 // The module init code.
 //
-#if PY_MAJOR_VERSION <= 2
 extern "C" NS_EXPORT
 void
-#else
-PyObject *
-#endif
 init_xpcom() {
 	PyObject *oModule;
@@ -780,9 +728,5 @@
 	// ensure the framework has valid state to work with.
 	if (!PyXPCOM_Globals_Ensure())
-#if PY_MAJOR_VERSION <= 2
 		return;
-#else
-		return NULL;
-#endif
 
 	// Must force Python to start using thread locks
@@ -790,9 +734,5 @@
 
 	// Create the module and add the functions
-#if PY_MAJOR_VERSION <= 2
 	oModule = Py_InitModule(MODULE_NAME, xpcom_methods);
-#else
-	oModule = PyModule_Create(&xpcom_module);
-#endif
 
 	PyObject *dict = PyModule_GetDict(oModule);
@@ -801,9 +741,5 @@
 	{
 		PyErr_SetString(PyExc_MemoryError, "can't define error");
-#if PY_MAJOR_VERSION <= 2
 		return;
-#else
-		return NULL;
-#endif
 	}
 	PyDict_SetItemString(dict, "IIDType", (PyObject *)&Py_nsIID::type);
@@ -848,7 +784,4 @@
     PyDict_SetItemString(dict, "NS_DEBUG", ob);
     Py_DECREF(ob);
-#if PY_MAJOR_VERSION >= 3
-    return oModule;
-#endif
 }
 
@@ -862,15 +795,6 @@
 #include <iprt/stream.h>
 
-#if PY_MAJOR_VERSION <= 2
 extern "C" NS_EXPORT
 void
-#else
-/** @todo r=klaus this is hacky, but as Python3 doesn't deal with ELF
- * visibility, assuming that all globals are visible (which is ugly and not
- * true in our case). */
-#undef PyMODINIT_FUNC
-#define PyMODINIT_FUNC extern "C" NS_EXPORT PyObject*
-PyMODINIT_FUNC
-#endif
 initVBoxPython() { /* NOTE! This name is redefined at the top of the file! */
   static bool s_vboxInited = false;
@@ -895,13 +819,6 @@
     rc = com::Initialize();
 
-#if PY_MAJOR_VERSION <= 2
     init_xpcom();
-#else
-    return init_xpcom();
-#endif
   }
-#if PY_MAJOR_VERSION >= 3
-  return NULL;
-#endif
 }
 
Index: /trunk/src/libs/xpcom18a4/python/test/test_test_component.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/test/test_test_component.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/test/test_test_component.py	(revision 59795)
@@ -253,5 +253,5 @@
     test_attribute(c, "iid_value", component_iid, new_iid)
     test_attribute(c, "iid_value", component_iid, str(new_iid), new_iid)
-    test_attribute(c, "iid_value", component_iid, xpcom._xpcom.ID(new_iid))
+    test_attribute(c, "iid_value", component_iid, xpcom._xpcom.IID(new_iid))
 
     test_attribute_failure(c, "no_attribute", "boo", AttributeError)
Index: /trunk/src/libs/xpcom18a4/python/vboxxpcom.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/vboxxpcom.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/vboxxpcom.py	(revision 59795)
@@ -1,4 +1,4 @@
 """
-Copyright (C) 2008-2016 Oracle Corporation
+Copyright (C) 2008-2012 Oracle Corporation
 
 This file is part of VirtualBox Open Source Edition (OSE), as
@@ -47,6 +47,6 @@
         _oVBoxPythonMod =  __import__(m)
         break
-    except Exception as x:
-        print('m=%s x=%s' % (m, x))
+    except Exception, x:
+        print 'm=%s x=%s' % (m, x);
     #except:
     #    pass
Index: /trunk/src/libs/xpcom18a4/python/xpt.py
===================================================================
--- /trunk/src/libs/xpcom18a4/python/xpt.py	(revision 59794)
+++ /trunk/src/libs/xpcom18a4/python/xpt.py	(revision 59795)
@@ -72,5 +72,5 @@
 import xpcom._xpcom
 
-from .xpcom_consts import *
+from xpcom_consts import *
 
 class Interface:
@@ -100,10 +100,10 @@
             if xpcom.verbose:
                 # The user may be confused as to why this is happening!
-                print("The parent interface of IID '%s' can not be located - assuming nsISupports")
+                print "The parent interface of IID '%s' can not be located - assuming nsISupports"
             return Interface(xpcom._xpcom.IID_nsISupports)
 
     def Describe_Python(self):
         method_reprs = []
-        methods = [m for m in self.methods if not m.IsNotXPCOM()]
+        methods = filter(lambda m: not m.IsNotXPCOM(), self.methods)
         for m in methods:
             method_reprs.append(m.Describe_Python())
@@ -130,5 +130,5 @@
         s = s + '         Scriptable: ' + word + '\n'
         s = s + '      Methods:\n'
-        methods = [m for m in self.methods if not m.IsNotXPCOM()]
+        methods = filter(lambda m: not m.IsNotXPCOM(), self.methods)
         if len(methods):
             for m in methods:
@@ -153,5 +153,5 @@
         except xpcom.Exception:
             if xpcom.verbose:
-                print("** GetMethodCount failed?? - assuming no methods")
+                print "** GetMethodCount failed?? - assuming no methods"
             self.items = []
     def __len__(self):
@@ -252,5 +252,5 @@
 
         def desc(a): return a.Describe()
-        method_desc = string.join(list(map(desc, self.params)), ', ')
+        method_desc = string.join(map(desc, self.params), ', ')
         result_type = TypeDescriber(self.result_desc[0], None)
         return_desc = result_type.Describe()
@@ -329,5 +329,5 @@
         except xpcom.Exception:
             if xpcom.verbose:
-                print("** GetConstantCount failed?? - assuming no constants")
+                print "** GetConstantCount failed?? - assuming no constants"
             self.items = []
     def __len__(self):
@@ -452,11 +452,11 @@
         describer_name = describer_name + "_" + mode.capitalize()
     describer = getattr(interface, describer_name)
-    print(describer())
+    print describer()
 
 if __name__=='__main__':
     if len(sys.argv) == 1:
-        print("Usage: xpt.py [-xptinfo] interface_name, ...")
-        print("  -info: Dump in a style similar to the xptdump tool")
-        print("Dumping nsISupports and nsIInterfaceInfo")
+        print "Usage: xpt.py [-xptinfo] interface_name, ..."
+        print "  -info: Dump in a style similar to the xptdump tool"
+        print "Dumping nsISupports and nsIInterfaceInfo"
         sys.argv.append('nsIInterfaceInfo')
         sys.argv.append('-xptinfo')
