1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3# Copyright 2016 The Chromium Authors. All rights reserved. 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6 7import argparse 8import os 9import subprocess 10import sys 11 12if __name__ == '__main__': 13 parser = argparse.ArgumentParser( 14 description='A script to execute a command via xcrun.') 15 parser.add_argument('--stamp', action='store', type=str, 16 help='Write a stamp file to this path on success.') 17 parser.add_argument('--developer_dir', required=False, 18 help='Path to Xcode.') 19 args, unknown_args = parser.parse_known_args() 20 21 if args.developer_dir: 22 os.environ['DEVELOPER_DIR'] = args.developer_dir 23 24 rv = subprocess.check_call(['xcrun'] + unknown_args) 25 if rv == 0 and args.stamp: 26 if os.path.exists(args.stamp): 27 os.unlink(args.stamp) 28 with open(args.stamp, 'w+') as fp: 29 30 sys.exit(rv) 31