Chromium Code Reviews| Index: third_party/crashpad/crashpad/util/mach/mig.py |
| diff --git a/third_party/crashpad/crashpad/util/mach/mig.py b/third_party/crashpad/crashpad/util/mach/mig.py |
| index eca2348aa877d1dc20028b47779b4c6ce157d4c4..b87ae429d6f9ca97ec95510e22ef165aa93d5fea 100755 |
| --- a/third_party/crashpad/crashpad/util/mach/mig.py |
| +++ b/third_party/crashpad/crashpad/util/mach/mig.py |
| @@ -15,6 +15,7 @@ |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| +import argparse |
| import os |
| import re |
| import subprocess |
| @@ -107,23 +108,32 @@ extern "C" { |
| file.close() |
| def main(args): |
| - if len(args) == 5: |
| - (defs_file, user_c, server_c, user_h, server_h) = args |
| - elif len(args) == 6: |
| - (defs_file, user_c, server_c, user_h, server_h, dev_dir) = args |
| - os.environ['DEVELOPER_DIR'] = dev_dir |
| - else: |
| - assert False, "Wrong number of arguments" |
| - subprocess.check_call(['mig', |
| - '-user', user_c, |
| - '-server', server_c, |
| - '-header', user_h, |
| - '-sheader', server_h, |
| - defs_file]) |
| - FixUserImplementation(user_c) |
| - server_declarations = FixServerImplementation(server_c) |
| - FixHeader(user_h) |
| - FixHeader(server_h, server_declarations) |
| + parser = argparse.ArgumentParser() |
| + parser.add_argument('--developer-dir', help='Path to Xcode') |
| + parser.add_argument('--sdk', help='Path to SDK') |
| + parser.add_argument('defs') |
| + parser.add_argument('user_c') |
| + parser.add_argument('server_c') |
| + parser.add_argument('user_h') |
| + parser.add_argument('server_h') |
| + parsed = parser.parse_args() |
|
Mark Mentovai
2017/02/10 02:11:39
OK.
Either put “args” here OR get rid of the “arg
erikchen
2017/02/10 03:24:18
Done
|
| + |
| + command = ['mig', |
| + '-user', parsed.user_c, |
| + '-server', parsed.server_c, |
| + '-header', parsed.user_h, |
| + '-sheader', parsed.server_h, |
| + ] |
| + if parsed.sdk is not None: |
| + command.extend(['-isysroot', parsed.sdk]) |
| + if parsed.developer_dir is not None: |
| + os.environ['DEVELOPER_DIR'] = parsed.developer_dir |
| + command.append(parsed.defs) |
| + subprocess.check_call(command) |
| + FixUserImplementation(parsed.user_c) |
| + server_declarations = FixServerImplementation(parsed.server_c) |
| + FixHeader(parsed.user_h) |
| + FixHeader(parsed.server_h, server_declarations) |
| if __name__ == '__main__': |
| sys.exit(main(sys.argv[1:])) |