| # Copyright 2020 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. |
| Wrapper around xcrun adding support for --developer-dir parameter to set |
| the DEVELOPER_DIR environment variable, and for converting paths relative |
| to absolute (since this is required by most of the tool run via xcrun). |
| def xcrun(command, developer_dir): |
| environ = dict(os.environ) |
| environ['DEVELOPER_DIR'] = os.path.abspath(developer_dir) |
| processed_args = ['/usr/bin/xcrun'] |
| arg = os.path.abspath(arg) |
| processed_args.append(arg) |
| process = subprocess.Popen(processed_args, |
| stdout, stderr = process.communicate() |
| sys.exit(process.returncode) |
| parser = argparse.ArgumentParser(add_help=False) |
| help='path to developer dir to use for the invocation of xcrun') |
| parsed, remaining_args = parser.parse_known_args(args) |
| xcrun(remaining_args, parsed.developer_dir) |
| if __name__ == '__main__': |