def main(args):
    # Prune all evidence of VPython/VirtualEnv out of the environment. This means
    # that we 'unwrap' vpython VirtualEnv path/env manipulation. Invocations of
    # `python` from GN should never inherit the gn.py's own VirtualEnv. This also
    # helps to ensure that generated ninja files do not reference python.exe from
    # the VirtualEnv generated from depot_tools' own .vpython file (or lack
    # thereof), but instead reference the default python from the PATH.
    PruneVirtualEnv()

    # Try in primary solution location first, with the gn binary having been
    # downloaded by cipd in the projects DEPS.
    gn_path = os.path.join(gclient_utils.GetPrimarySolutionPath(),
                           'third_party', 'gn',
                           'gn' + gclient_utils.GetExeSuffix())
    if os.path.exists(gn_path):
        return subprocess.call([gn_path] + args[1:])

    # Otherwise try the old .sha1 and download_from_google_storage locations
    # inside of buildtools.
    bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
    if not bin_path:
        print >> sys.stderr, (
            'gn.py: Could not find checkout in any parent of '
            'the current path.\nThis must be run inside a '
            'checkout.')
        return 1
    gn_path = os.path.join(bin_path, 'gn' + gclient_utils.GetExeSuffix())
    if not os.path.exists(gn_path):
        print >> sys.stderr, 'gn.py: Could not find gn executable at: %s' % gn_path
        return 2
    else:
        return subprocess.call([gn_path] + args[1:])
def FindClangFormatToolInChromiumTree():
  """Return a path to the clang-format executable, or die trying."""
  tool_path = os.path.join(_FindChromiumSourceRoot(), 'third_party',
                           'clang_format', 'bin',
                           gclient_utils.GetMacWinOrLinux(),
                           'clang-format' + gclient_utils.GetExeSuffix())
  if not os.path.exists(tool_path):
    # TODO(nick): After March 2014, eliminate the following advisory.
    error_text = '''\n  GIT CL FORMAT - WINTER WEATHER ADVISORY

    clang-format binaries now come with every Chrome checkout!

    Unfortunately, your depot_tools scripts tried to find clang-format binaries
    in your Chrome checkout, but failed. This is expected if you haven't synced
    since the binaries were added.

    'git cl format' will probably not work until you sync your Chrome tree.
    Sorry about that.

    Contact [email protected] if you have any additional questions.\n\n'''

    error_text += 'File does not exist: %s' % tool_path

    raise NotFoundError(error_text)
  return tool_path
예제 #3
0
def FindClangFormatToolInChromiumTree():
    """Return a path to the clang-format executable, or die trying."""
    tool_path = os.path.join(_FindChromiumSourceRoot(), 'third_party',
                             'clang_format', 'bin',
                             gclient_utils.GetMacWinOrLinux(),
                             'clang-format' + gclient_utils.GetExeSuffix())
    if not os.path.exists(tool_path):
        raise NotFoundError('File does not exist: %s' % tool_path)
    return tool_path
예제 #4
0
파일: gn.py 프로젝트: mYoda/CustomBrs
def main(args):
    bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
    if not bin_path:
        print >> sys.stderr, (
            'gn.py: Could not find checkout in any parent of '
            'the current path.\nThis must be run inside a '
            'checkout.')
        sys.exit(1)
    gn_path = os.path.join(bin_path, 'gn' + gclient_utils.GetExeSuffix())
    return subprocess.call([gn_path] + sys.argv[1:])
예제 #5
0
def FindClangFormatToolInChromiumTree():
  """Return a path to the clang-format executable, or die trying."""
  bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
  if not bin_path:
    raise NotFoundError(
        'Could not find checkout in any parent of the current path.')

  tool_path = os.path.join(bin_path,
                           'clang-format' + gclient_utils.GetExeSuffix())
  if not os.path.exists(tool_path):
    raise NotFoundError('File does not exist: %s' % tool_path)
  return tool_path
예제 #6
0
파일: gn.py 프로젝트: fanjunwei/depot_tools
def main(args):
  bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
  if not bin_path:
    print >> sys.stderr, ('gn.py: Could not find checkout in any parent of '
                          'the current path.\nThis must be run inside a '
                          'checkout.')
    return 1
  gn_path = os.path.join(bin_path, 'gn' + gclient_utils.GetExeSuffix())
  if not os.path.exists(gn_path):
    print >> sys.stderr, 'gn.py: Could not find gn executable at: %s' % gn_path
    return 2
  else:
    return subprocess.call([gn_path] + args[1:])
예제 #7
0
def RunGN(sourceroot):
    # The binaries in platform-specific subdirectories in src/tools/gn/bin.
    gnpath = os.path.join(sourceroot, 'tools', 'gn', 'bin',
                          gclient_utils.GetMacWinOrLinux(),
                          'gn' + gclient_utils.GetExeSuffix())
    return subprocess.call([gnpath] + sys.argv[1:])