skia2/gn/compile_ib_files.py
Eric Boren a726978ae7 Revert "[python3] More Recipes -> Python 3 fixes"
This reverts commit 12e786730f.

Reason for revert: missing CIPD package on armv6l

Original change's description:
> [python3] More Recipes -> Python 3 fixes
>
> - Set environment variables to force usage of Python 3 in more places
> - Fix more compatibility issues
> - Mark recipes as only supporting Python 3
> - Includes a roll of the infra code
>
> Change-Id: I24e3827a6402c454bdc9467d28864d360632f9e6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470303
> Reviewed-by: Ravi Mistry <rmistry@google.com>
> Commit-Queue: Eric Boren <borenet@google.com>

Change-Id: If7b6fcb7838ac053af2c5eb45a7a1ac4aed340a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472736
Auto-Submit: Eric Boren <borenet@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-11-17 14:57:10 +00:00

61 lines
1.7 KiB
Python

# 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 re
import subprocess
import sys
def main():
parser = argparse.ArgumentParser(
description='A script to compile xib and storyboard.',
fromfile_prefix_chars='@')
parser.add_argument('-o', '--output', required=True,
help='Path to output bundle.')
parser.add_argument('-i', '--input', required=True,
help='Path to input xib or storyboard.')
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
ibtool_args = [
'xcrun', 'ibtool',
'--errors', '--warnings', '--notices',
'--output-format', 'human-readable-text'
]
ibtool_args += unknown_args
ibtool_args += [
'--compile',
os.path.abspath(args.output),
os.path.abspath(args.input)
]
ibtool_section_re = re.compile(r'/\*.*\*/')
ibtool_re = re.compile(r'.*note:.*is clipping its content')
try:
stdout = subprocess.check_output(ibtool_args)
except subprocess.CalledProcessError as e:
print(e.output)
raise
current_section_header = None
for line in stdout.splitlines():
if ibtool_section_re.match(line):
current_section_header = line
elif not ibtool_re.match(line):
if current_section_header:
print(current_section_header)
current_section_header = None
print(line)
return 0
if __name__ == '__main__':
sys.exit(main())