Back to index

lightning-sunbird  0.9+nobinonly
Functions
xpcom.register Namespace Reference

Functions

def addSelf

Function Documentation

def xpcom.register.addSelf (   fname)

Definition at line 40 of file register.py.

00040 
00041 def addSelf(fname):
00042     #XXX the path hardcoding and env var reliance limits the usefulness
00043     #XXX I don't even know if this is used, or usable, at all anymore.
00044     try:
00045         mozSrc = os.environ['MOZ_SRC']
00046     except KeyError:
00047         print "register.py: need MOZ_SRC to be set"
00048         sys.exit(-1)
00049     try:
00050         komododist = os.environ['KOMODO']
00051     except KeyError:
00052         print "Set KOMODO"
00053         sys.exit(-1)
00054 
00055     bindir = os.path.join(mozSrc, "dist", "WIN32_D.OBJ", "bin")
00056     idldir = os.path.join(mozSrc, "dist", "idl")
00057     idl2dir = os.path.join(komododist, "SciMoz")
00058     componentdir = os.path.normpath(os.path.join(bindir, 'components'))
00059 
00060     base, ext = os.path.splitext(fname)
00061     idlfile = base+'.idl'
00062     pyfile = base+'.py'
00063     xptfile = base+'.xpt'
00064     if os.path.exists(idlfile):
00065         # IDL file of same name exists, assume it needs to be updated
00066         print r'%(bindir)s\xpidl -I %(idldir)s -I %(idl2dir)s -m typelib %(idlfile)s' % vars()
00067         os.system(r'%(bindir)s\xpidl -I %(idldir)s -I %(idl2dir)s -m typelib %(idlfile)s' % vars())
00068     print r'cp %(xptfile)s %(componentdir)s' % vars()
00069     os.system(r'cp %(xptfile)s %(componentdir)s' % vars())
00070     print 'cp %(pyfile)s %(componentdir)s' % vars()
00071     os.system('cp %(pyfile)s %(componentdir)s' % vars())
00072