Index: /trunk/src/libs/xpcom18a4/Makefile.kmk
===================================================================
--- /trunk/src/libs/xpcom18a4/Makefile.kmk	(revision 12378)
+++ /trunk/src/libs/xpcom18a4/Makefile.kmk	(revision 12379)
@@ -1392,4 +1392,5 @@
 VBoxPython2_5_TEMPLATE = XPCOMOSX105
 VBoxPython2_5_NAME.darwin = VBoxPython2_5
+VBoxPython2_5_DEFS = VBOX_PYXPCOM_VERSIONED $(VBoxPython_DEFS)
 VBoxPython2_5_INCS = \
 	python/src \
Index: /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp	(revision 12378)
+++ /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp	(revision 12379)
@@ -72,5 +72,23 @@
 
 #ifdef VBOX_PYXPCOM
-#define MODULE_NAME "VBoxPython"
+# ifdef VBOX_PYXPCOM_VERSIONED
+#  if PY_VERSION_HEX >= 0x02080000
+#   define MODULE_NAME "VBoxPython2_8"
+#  elif PY_VERSION_HEX >= 0x02070000
+#   define MODULE_NAME "VBoxPython2_7"
+#  elif PY_VERSION_HEX >= 0x02060000
+#   define MODULE_NAME "VBoxPython2_6"
+#  elif PY_VERSION_HEX >= 0x02050000
+#   define MODULE_NAME "VBoxPython2_5"
+#  elif PY_VERSION_HEX >= 0x02040000
+#   define MODULE_NAME "VBoxPython2_4"
+#  elif PY_VERSION_HEX >= 0x02030000
+#   define MODULE_NAME "VBoxPython2_3"
+#  else
+#   error "Fix module versioning.
+#  endif
+# else
+#  define MODULE_NAME "VBoxPython"
+# endif
 #else
 #define MODULE_NAME "_xpcom"
@@ -163,5 +181,5 @@
 	return PyXPCOMMethod_GetComponentManager(self, args);
 }
-		
+
 static PyObject *
 PyXPCOMMethod_XPTI_GetInterfaceInfoManager(PyObject *self, PyObject *args)
@@ -208,7 +226,7 @@
 	// will return the "original" gateway when QI'd for nsISupports)
 	if (!Py_nsISupports::InterfaceFromPyObject(
-			obIS, 
-			Py_nsIID_NULL, 
-			getter_AddRefs(pis), 
+			obIS,
+			Py_nsIID_NULL,
+			getter_AddRefs(pis),
 			PR_FALSE))
 		return NULL;
@@ -266,7 +284,7 @@
 	nsIInternalPython *iob = NULL;
 	PyObject *ret = NULL;
-	if (!Py_nsISupports::InterfaceFromPyObject(ob, 
-				NS_GET_IID(nsISupports), 
-				&uob, 
+	if (!Py_nsISupports::InterfaceFromPyObject(ob,
+				NS_GET_IID(nsISupports),
+				&uob,
 				PR_FALSE))
 		goto done;
@@ -356,5 +374,5 @@
 	nsCOMPtr<nsISupports> presult;
 	Py_BEGIN_ALLOW_THREADS;
-	nsCOMPtr<nsIProxyObjectManager> proxyMgr = 
+	nsCOMPtr<nsIProxyObjectManager> proxyMgr =
 	         do_GetService(kProxyObjectManagerCID, &rv_proxy);
 
@@ -404,7 +422,7 @@
 
 	nsCOMPtr<nsIVariant> var;
-	if (!Py_nsISupports::InterfaceFromPyObject(ob, 
-				NS_GET_IID(nsISupports), 
-				getter_AddRefs(var), 
+	if (!Py_nsISupports::InterfaceFromPyObject(ob,
+				NS_GET_IID(nsISupports),
+				getter_AddRefs(var),
 				PR_FALSE))
 		return PyErr_Format(PyExc_ValueError,
@@ -482,5 +500,5 @@
 	{"GetServiceManager", PyXPCOMMethod_GetServiceManager, 1},
 	{"GetGlobalServiceManager", PyXPCOMMethod_GetGlobalServiceManager, 1}, // deprecated
-	{"IID", PyXPCOMMethod_IID, 1}, // IID is wrong - deprecated - not just IID, but CID, etc. 
+	{"IID", PyXPCOMMethod_IID, 1}, // IID is wrong - deprecated - not just IID, but CID, etc.
 	{"ID", PyXPCOMMethod_IID, 1}, // This is the official name.
 	{"NS_ShutdownXPCOM", PyXPCOMMethod_NS_ShutdownXPCOM, 1},
@@ -517,5 +535,5 @@
 //
 extern "C" NS_EXPORT
-void 
+void
 init_xpcom() {
 	PyObject *oModule;
@@ -591,6 +609,26 @@
 
 extern "C" NS_EXPORT
-void 
+void
+# ifdef VBOX_PYXPCOM_VERSIONED
+#  if PY_VERSION_HEX >= 0x02080000
+initVBoxPython2_8() {
+#  elif PY_VERSION_HEX >= 0x02070000
+initVBoxPython2_7() {
+#  elif PY_VERSION_HEX >= 0x02060000
+initVBoxPython2_6() {
+#  elif PY_VERSION_HEX >= 0x02050000
+initVBoxPython2_5() {
+#  elif PY_VERSION_HEX >= 0x02040000
+#   error "you must test VBOX_PYXPCOM_VERSIONED on 2.4"
 initVBoxPython() {
+#  elif PY_VERSION_HEX >= 0x02030000
+#   error "you must test VBOX_PYXPCOM_VERSIONED on 2.3"
+initVBoxPython() {
+#  else
+#   error "Fix module versioning.
+#  endif
+# else
+initVBoxPython() {
+# endif
   static bool s_vboxInited = false;
   if (!s_vboxInited) {
@@ -610,5 +648,5 @@
       rc = RTR3Init();
     }
-#endif 
+#endif
 
     rc = com::Initialize();
