Bug 458936: Work around some bizarre pymake bug.
authorKyle Huey <khuey@kylehuey.com>
Wed, 10 Aug 2011 08:02:40 -0400
changeset 74186 4b6602f8fa7bb9c2c874a01080239bf1bd7a0327
parent 74185 a858541b486f828904567f7822c175048ef9f07e
child 74187 ed019d1cd8ec87d6e20a81d64968a2d80bd86d13
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs458936
milestone8.0a1
Bug 458936: Work around some bizarre pymake bug.
xpcom/idl-parser/typelib.py
--- a/xpcom/idl-parser/typelib.py
+++ b/xpcom/idl-parser/typelib.py
@@ -265,17 +265,17 @@ def write_typelib(idl, fd, filename):
     ifaces = []
     for p in idl.productions:
         if p.kind == 'interface':
             ifaces.append(build_interface(p, ifaces))
 
     typelib = xpt.Typelib(interfaces=ifaces)
     typelib.writefd(fd)
 
-def main(*args):
+if __name__ == '__main__':
     from optparse import OptionParser
     o = OptionParser()
     o.add_option('-I', action='append', dest='incdirs', default=['.'],
                  help="Directory to search for imported files")
     o.add_option('--cachedir', dest='cachedir', default=None,
                  help="Directory in which to cache lex/parse tables.")
     o.add_option('-o', dest='outfile', default=None,
                  help="Output file")
@@ -307,11 +307,8 @@ def main(*args):
     if closeoutfd:
         outfd.close()
 
     if options.depfile is not None:
         depfd = open(options.depfile, 'w')
         deps = [dep.replace('\\', '/') for dep in idl.deps]
 
         print >>depfd, "%s: %s" % (options.outfile, " ".join(deps))
-
-if __name__ == '__main__':
-    main()