First checkin of the Python XPCOM bindings.

This commit is contained in:
markh@activestate.com
2001-02-19 05:24:45 +00:00
parent a75c1ed1a1
commit 189159a116
74 changed files with 13656 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
# Copyright (c) 2000-2001 ActiveState Tool Corporation.
# See the file LICENSE.txt for licensing information.
# regxpcom.py - basically the standard regxpcom.cpp ported to Python.
from xpcom import components, _xpcom
import sys
import os
def ProcessArgs(args):
unregister = 0
for arg in args:
if arg == "-u":
unregister = 1
else:
spec = components.classes['@mozilla.org/file/local;1'].createInstance()
spec = spec.QueryInterface(components.interfaces.nsILocalFile)
spec.initWithPath(os.path.abspath(arg))
if unregister:
components.manager.autoUnregisterComponent( components.manager.NS_Startup, spec)
print "Successfully unregistered", spec.path
else:
components.manager.autoRegisterComponent( components.manager.NS_Startup, spec)
print "Successfully registered", spec.path
unregister = 0
import xpcom
if len(sys.argv) < 2:
components.manager.autoRegister( components.manager.NS_Startup, None)
else:
ProcessArgs(sys.argv[1:])
_xpcom.NS_ShutdownXPCOM()