Merge extensions/python/xpcom changes from DOM_AGNOSTIC2_BRANCH into the
trunk. git-svn-id: svn://10.0.0.236/trunk@187878 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -36,32 +36,33 @@
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# regxpcom.py - basically the standard regxpcom.cpp ported to Python.
|
||||
# In general, you should use regxpcom.exe instead of this.
|
||||
|
||||
from xpcom import components, _xpcom
|
||||
from xpcom.client import Component
|
||||
import sys
|
||||
import os
|
||||
|
||||
registrar = Component(_xpcom.GetComponentRegistrar(),
|
||||
components.interfaces.nsIComponentRegistrar)
|
||||
|
||||
def ProcessArgs(args):
|
||||
|
||||
unregister = 0
|
||||
for arg in args:
|
||||
spec = components.classes['@mozilla.org/file/local;1'].createInstance()
|
||||
spec = spec.QueryInterface(components.interfaces.nsILocalFile)
|
||||
spec.initWithPath(os.path.abspath(arg))
|
||||
if arg == "-u":
|
||||
unregister = 1
|
||||
registrar.autoUnregister(spec)
|
||||
print "Successfully unregistered", spec.path
|
||||
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
|
||||
registrar.autoRegister(spec)
|
||||
print "Successfully registered", spec.path
|
||||
|
||||
import xpcom
|
||||
if len(sys.argv) < 2:
|
||||
components.manager.autoRegister( components.manager.NS_Startup, None)
|
||||
registrar.autoRegister( None)
|
||||
else:
|
||||
ProcessArgs(sys.argv[1:])
|
||||
|
||||
_xpcom.NS_ShutdownXPCOM()
|
||||
#_xpcom.NS_ShutdownXPCOM()
|
||||
|
||||
Reference in New Issue
Block a user