# Copyright (c) 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
"""
TestMac.py: a collection of helper function shared between test on Mac OS X. """
from __future__ import print_function
import re import subprocess
__all__ = ['Xcode', 'CheckFileType']
def CheckFileType(test, file, archs): """Check that |file| contains exactly |archs| or fails |test|."""
proc = subprocess.Popen(['lipo', '-info', file], stdout=subprocess.PIPE)
o = proc.communicate()[0].decode('utf-8').strip() assertnot proc.returncode if len(archs) == 1:
pattern = re.compile('^Non-fat file: (.*) is architecture: (.*)$') else:
pattern = re.compile('^Architectures in the fat file: (.*) are: (.*)$')
match = pattern.match(o) if match isNone:
print('Ouput does not match expected pattern: %s' % (pattern.pattern))
test.fail_test() else:
found_file, found_archs = match.groups() if found_file != file or set(found_archs.split()) != set(archs):
print('Expected file %s with arch %s, got %s with arch %s' % (
file, ' '.join(archs), found_file, found_archs))
test.fail_test()
class XcodeInfo(object): """Simplify access to Xcode informations."""
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.