2 # Copyright (c) 2011 Code Aurora Forum. All rights reserved.
3 # Copyright (c) 2010 Google Inc. All rights reserved.
4 # Copyright (c) 2009 Apple Inc. All rights reserved.
5 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above
14 # copyright notice, this list of conditions and the following disclaimer
15 # in the documentation and/or other materials provided with the
17 # * Neither the name of Google Inc. nor the names of its
18 # contributors may be used to endorse or promote products derived from
19 # this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 # A tool for automating dealing with bugzilla, posting patches, committing patches, etc.
41 # By default, sys.stdout assumes ascii encoding. Since our messages can
42 # contain unicode strings (as with some peoples' names) we need to apply
43 # the utf-8 codec to prevent throwing and exception.
44 # Not having this was the cause of https://bugs.webkit.org/show_bug.cgi?id=63452.
45 sys.stdout = codecs.lookup('utf-8')[-1](sys.stdout)
47 from webkitpy.common.system.logutils import configure_logging
48 import webkitpy.python24.versioning as versioning
50 _log = logging.getLogger("webkit-patch")
53 # This is a hack to let us enable DEBUG logging as early as possible.
54 # Note this can't be ternary as versioning.check_version()
55 # hasn't run yet and this python might be older than 2.5.
56 if set(["-v", "--verbose"]).intersection(set(sys.argv)):
57 logging_level = logging.DEBUG
59 logging_level = logging.INFO
60 configure_logging(logging_level=logging_level)
62 versioning.check_version()
64 # Import webkit-patch code only after version-checking so that
65 # script doesn't error out before having a chance to report the
67 from webkitpy.tool.main import WebKitPatch
69 WebKitPatch(os.path.abspath(__file__)).main()
72 if __name__ == "__main__":
75 except KeyboardInterrupt:
76 sys.exit(signal.SIGINT + 128)