Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:19:54

0001 #!/usr/bin/env python
0002 #
0003 # Copyright 2009, Google Inc.
0004 # All rights reserved.
0005 #
0006 # Redistribution and use in source and binary forms, with or without
0007 # modification, are permitted provided that the following conditions are
0008 # met:
0009 #
0010 #     * Redistributions of source code must retain the above copyright
0011 # notice, this list of conditions and the following disclaimer.
0012 #     * Redistributions in binary form must reproduce the above
0013 # copyright notice, this list of conditions and the following disclaimer
0014 # in the documentation and/or other materials provided with the
0015 # distribution.
0016 #     * Neither the name of Google Inc. nor the names of its
0017 # contributors may be used to endorse or promote products derived from
0018 # this software without specific prior written permission.
0019 #
0020 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0021 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0022 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0023 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0024 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0025 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0026 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0027 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0028 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0029 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0030 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0031 
0032 """upload_gmock.py v0.1.0 -- uploads a Google Mock patch for review.
0033 
0034 This simple wrapper passes all command line flags and
0035 --cc=googlemock@googlegroups.com to upload.py.
0036 
0037 USAGE: upload_gmock.py [options for upload.py]
0038 """
0039 
0040 __author__ = 'wan@google.com (Zhanyong Wan)'
0041 
0042 import os
0043 import sys
0044 
0045 CC_FLAG = '--cc='
0046 GMOCK_GROUP = 'googlemock@googlegroups.com'
0047 
0048 
0049 def main():
0050   # Finds the path to upload.py, assuming it is in the same directory
0051   # as this file.
0052   my_dir = os.path.dirname(os.path.abspath(__file__))
0053   upload_py_path = os.path.join(my_dir, 'upload.py')
0054 
0055   # Adds Google Mock discussion group to the cc line if it's not there
0056   # already.
0057   upload_py_argv = [upload_py_path]
0058   found_cc_flag = False
0059   for arg in sys.argv[1:]:
0060     if arg.startswith(CC_FLAG):
0061       found_cc_flag = True
0062       cc_line = arg[len(CC_FLAG):]
0063       cc_list = [addr for addr in cc_line.split(',') if addr]
0064       if GMOCK_GROUP not in cc_list:
0065         cc_list.append(GMOCK_GROUP)
0066       upload_py_argv.append(CC_FLAG + ','.join(cc_list))
0067     else:
0068       upload_py_argv.append(arg)
0069 
0070   if not found_cc_flag:
0071     upload_py_argv.append(CC_FLAG + GMOCK_GROUP)
0072 
0073   # Invokes upload.py with the modified command line flags.
0074   os.execv(upload_py_path, upload_py_argv)
0075 
0076 
0077 if __name__ == '__main__':
0078   main()