summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/webrtc/build/config/mac/xcrun.py
blob: 1f8dc203b6da913790496b67a200b7b1d30732d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import argparse
import os
import subprocess
import sys

if __name__ == '__main__':
  parser = argparse.ArgumentParser(
      description='A script to execute a command via xcrun.')
  parser.add_argument('--stamp', action='store', type=str,
      help='Write a stamp file to this path on success.')
  parser.add_argument('--developer_dir', required=False,
                      help='Path to Xcode.')
  args, unknown_args = parser.parse_known_args()

  if args.developer_dir:
    os.environ['DEVELOPER_DIR'] = args.developer_dir

  rv = subprocess.check_call(['xcrun'] + unknown_args)
  if rv == 0 and args.stamp:
    if os.path.exists(args.stamp):
      os.unlink(args.stamp)
    open(args.stamp, 'w+').close()

  sys.exit(rv)