Home | History | Annotate | Download | only in Scripts
      1 #!/usr/bin/env python
      2 #
      3 # Copyright (C) 2010 Apple Inc. All rights reserved.
      4 #
      5 # Redistribution and use in source and binary forms, with or without
      6 # modification, are permitted provided that the following conditions
      7 # are met:
      8 # 1.  Redistributions of source code must retain the above copyright
      9 #     notice, this list of conditions and the following disclaimer.
     10 # 2.  Redistributions in binary form must reproduce the above copyright
     11 #     notice, this list of conditions and the following disclaimer in the
     12 #     documentation and/or other materials provided with the distribution.
     13 #
     14 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
     15 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     16 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     17 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
     18 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     20 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     21 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     22 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     23 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24 
     25 from __future__ import with_statement
     26 import sys
     27 
     28 import webkit2.messages
     29 
     30 
     31 def main(argv=None):
     32     if not argv:
     33         argv = sys.argv
     34     input_path = argv[1]
     35     with open(input_path) as input_file:
     36         # Python 3, change to:  print(webkit2.messages.generate_message_handler(input_file), end='')
     37         sys.stdout.write(webkit2.messages.generate_message_handler(input_file))
     38     return 0
     39 
     40 if __name__ == '__main__':
     41     sys.exit(main(sys.argv))
     42