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:])
Пример #2
0
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:])
Пример #3
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
Пример #4
0
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:])