#!/usr/bin/env python3 # Copyright 2014 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
import argparse import doctest import itertools import os import plistlib import re import subprocess import sys
# This script prints information about the build system, the operating # system and the iOS or Mac SDK (depending on the platform "iphonesimulator", # "iphoneos" or "macosx" generally).
def SplitVersion(version): """Splits the Xcode version to 3 values.
def FillXcodeVersion(settings, developer_dir): """Fills the Xcode version and build number into |settings|.""" if developer_dir:
xcode_version_plist_path = os.path.join(developer_dir, 'Contents/version.plist') with open(xcode_version_plist_path, 'rb') as f:
version_plist = plistlib.load(f)
settings['xcode_version'] = FormatVersion(
version_plist['CFBundleShortVersionString'])
settings['xcode_version_int'] = int(settings['xcode_version'], 10)
settings['xcode_build'] = version_plist['ProductBuildVersion'] return
# Update the symlink only if it is different from the current destination. if os.path.islink(dst):
current_src = os.readlink(dst) if current_src == src: return updated_value
os.unlink(dst)
sys.stderr.write('existing symlink %s points %s; want %s. Removed.' %
(dst, current_src, src))
os.symlink(src, dst) return updated_value
def main():
doctest.testmod()
parser = argparse.ArgumentParser()
parser.add_argument('--developer_dir')
parser.add_argument('--get_sdk_info',
action='store_true',
default=False,
help='Returns SDK info in addition to xcode info.')
parser.add_argument('--get_machine_info',
action='store_true',
default=False,
help='Returns machine info in addition to xcode info.')
parser.add_argument('--create_symlink_at',
help='Create symlink of SDK at given location and ' 'returns the symlinked paths as SDK info instead ' 'of the original location.')
parser.add_argument('--root_build_dir',
default='.',
help='Value of gn $root_build_dir')
parser.add_argument('platform',
choices=[ 'appletvos', 'appletvsimulator', 'iphoneos', 'iphonesimulator', 'macosx', 'watchos', 'watchsimulator',
])
args = parser.parse_args() if args.developer_dir:
os.environ['DEVELOPER_DIR'] = args.developer_dir
settings = {} if args.get_machine_info:
FillMachineOSBuild(settings)
FillXcodeVersion(settings, args.developer_dir) if args.get_sdk_info:
FillSDKPathAndVersion(settings, args.platform, settings['xcode_version'])
for key in sorted(settings):
value = settings[key] if args.create_symlink_at and'_path'in key:
value = CreateXcodeSymlinkAt(value, args.create_symlink_at,
args.root_build_dir) if isinstance(value, str):
value = '"%s"' % value
print('%s=%s' % (key, value))
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.