Index: Source/bindings/scripts/blink_idl_lexer.py |
diff --git a/Source/bindings/scripts/blink_idl_lexer.py b/Source/bindings/scripts/blink_idl_lexer.py |
index 6bf439641fd3a7e4dfbca8e8024c09e5e95311ed..ba68c6c7dce1f27fee35f768d536401abfe5520b 100644 |
--- a/Source/bindings/scripts/blink_idl_lexer.py |
+++ b/Source/bindings/scripts/blink_idl_lexer.py |
@@ -69,6 +69,7 @@ tools_dir = os.path.join(third_party, os.pardir, 'tools') |
sys.path.append(tools_dir) |
from idl_parser.idl_lexer import IDLLexer |
+LEXTAB = 'lextab' |
REMOVE_TOKENS = ['COMMENT'] |
@@ -100,20 +101,15 @@ class BlinkIDLLexer(IDLLexer): |
sys.path.append(outputdir) |
if rewrite_tables: |
- tablefile = os.path.join(outputdir, 'lextab.py') |
- |
- def unlink(filename): |
+ tablefile_root = os.path.join(outputdir, LEXTAB) |
+ # Also remove the .pyc/.pyo files, or they'll be used even if |
+ # the .py file doesn't exist. |
+ for ext in ('.py', '.pyc', '.pyo'): |
try: |
- os.unlink(filename) |
+ os.unlink(tablefile_root + ext) |
except OSError: |
pass |
- unlink(tablefile) |
- # Also remove the .pyc/.pyo files, or they'll be used even if |
- # the .py file doesn't exist. |
- unlink(tablefile + 'c') |
- unlink(tablefile + 'o') |
- |
IDLLexer.__init__(self) |
# Overrides to parent class |
self._RemoveTokens(REMOVE_TOKENS) |
@@ -124,7 +120,7 @@ class BlinkIDLLexer(IDLLexer): |
self._lexobj = lex.lex(object=self, |
debug=debug, |
optimize=optimize, |
- lextab='lextab', |
+ lextab=LEXTAB, |
outputdir=outputdir) |