No bug: Fix ply being dumb. r=ted
authorKyle Huey <khuey@kylehuey.com>
Tue, 13 Mar 2012 10:22:14 -0700
changeset 88949 466c118c3e4417504b74f2199b758d1e43170f0f
parent 88948 cf4978c2e32c340987a9258fe064e9a191d8a639
child 88950 b6627f28b7ec17e1b46a594df0f780d3a40847e4
push id22237
push userkhuey@mozilla.com
push dateTue, 13 Mar 2012 17:22:30 +0000
treeherdermozilla-central@466c118c3e44 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
No bug: Fix ply being dumb. r=ted
xpcom/idl-parser/header.py
--- a/xpcom/idl-parser/header.py
+++ b/xpcom/idl-parser/header.py
@@ -35,17 +35,17 @@
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 """Print a C++ header file for the IDL files specified on the command line"""
 
-import sys, os.path, re, xpidl, itertools
+import sys, os.path, re, xpidl, itertools, glob
 
 printdoccomments = False
 
 if printdoccomments:
     def printComments(fd, clist, indent):
         for c in clist:
             fd.write("%s%s\n" % (indent, c))
 else:
@@ -494,23 +494,31 @@ if __name__ == '__main__':
     options, args = o.parse_args()
     file = args[0] if args else None
 
     if options.cachedir is not None:
         if not os.path.isdir(options.cachedir):
             os.mkdir(options.cachedir)
         sys.path.append(options.cachedir)
 
-    # Instantiate the parser.
-    p = xpidl.IDLParser(outputdir=options.cachedir)
-
     # The only thing special about a regen is that there are no input files.
     if options.regen:
         if options.cachedir is None:
             print >>sys.stderr, "--regen useless without --cachedir"
+        # Delete the lex/yacc files.  Ply is too stupid to regenerate them
+        # properly
+        deadfiles = os.path.join(options.cachedir, "*.py*")
+        for filename in glob.glob(deadfiles):
+            print filename
+            os.remove(filename)
+
+    # Instantiate the parser.
+    p = xpidl.IDLParser(outputdir=options.cachedir)
+
+    if options.regen:
         sys.exit(0)
 
     if options.depfile is not None and options.outfile is None:
         print >>sys.stderr, "-d requires -o"
         sys.exit(1)
 
     if options.outfile is not None:
         outfd = open(options.outfile, 'w')