OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 return lambda x: RemoveCommentsAndTrailingWhitespace(Validate(x)) | 370 return lambda x: RemoveCommentsAndTrailingWhitespace(Validate(x)) |
371 | 371 |
372 class Sources: | 372 class Sources: |
373 def __init__(self): | 373 def __init__(self): |
374 self.names = [] | 374 self.names = [] |
375 self.modules = [] | 375 self.modules = [] |
376 self.is_debugger_id = [] | 376 self.is_debugger_id = [] |
377 | 377 |
378 | 378 |
379 def IsDebuggerFile(filename): | 379 def IsDebuggerFile(filename): |
380 return filename.endswith("-debugger.js") | 380 return "debug" in filename |
381 | 381 |
382 def IsMacroFile(filename): | 382 def IsMacroFile(filename): |
383 return filename.endswith("macros.py") | 383 return filename.endswith("macros.py") |
384 | 384 |
385 def IsMessageTemplateFile(filename): | 385 def IsMessageTemplateFile(filename): |
386 return filename.endswith("messages.h") | 386 return filename.endswith("messages.h") |
387 | 387 |
388 | 388 |
389 def PrepareSources(source_files, native_type, emit_js): | 389 def PrepareSources(source_files, native_type, emit_js): |
390 """Read, prepare and assemble the list of source files. | 390 """Read, prepare and assemble the list of source files. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 lines = filters(contents) | 440 lines = filters(contents) |
441 except Error as e: | 441 except Error as e: |
442 raise Error("In file %s:\n%s" % (source, str(e))) | 442 raise Error("In file %s:\n%s" % (source, str(e))) |
443 | 443 |
444 result.modules.append(lines) | 444 result.modules.append(lines) |
445 | 445 |
446 is_debugger = IsDebuggerFile(source) | 446 is_debugger = IsDebuggerFile(source) |
447 result.is_debugger_id.append(is_debugger) | 447 result.is_debugger_id.append(is_debugger) |
448 | 448 |
449 name = os.path.basename(source)[:-3] | 449 name = os.path.basename(source)[:-3] |
450 result.names.append(name if not is_debugger else name[:-9]) | 450 result.names.append(name) |
451 | 451 |
452 return result | 452 return result |
453 | 453 |
454 | 454 |
455 def BuildMetadata(sources, source_bytes, native_type): | 455 def BuildMetadata(sources, source_bytes, native_type): |
456 """Build the meta data required to generate a libaries file. | 456 """Build the meta data required to generate a libaries file. |
457 | 457 |
458 Args: | 458 Args: |
459 sources: A Sources instance with the prepared sources. | 459 sources: A Sources instance with the prepared sources. |
460 source_bytes: A list of source bytes. | 460 source_bytes: A list of source bytes. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 JS2C(args[2:], | 592 JS2C(args[2:], |
593 args[0], | 593 args[0], |
594 args[1], | 594 args[1], |
595 options.raw, | 595 options.raw, |
596 options.startup_blob, | 596 options.startup_blob, |
597 options.js) | 597 options.js) |
598 | 598 |
599 | 599 |
600 if __name__ == "__main__": | 600 if __name__ == "__main__": |
601 main() | 601 main() |
OLD | NEW |