How to use the build.util.lastchange.VersionInfo function in build

To help you get started, we’ve selected a few build examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flutter / engine / build / util / lastchange.py View on Github external
if not line:
      continue
    key, val = line.split(': ', 1)
    attrs[key] = val

  try:
    match = svn_url_regex.search(attrs['URL'])
    if match:
      url = match.group(2)
    else:
      url = ''
    revision = attrs['Revision']
  except KeyError:
    return None

  return VersionInfo(url, revision)
github flutter / engine / build / util / lastchange.py View on Github external
if proc.returncode == 0 and output:
      hsh = output
  if not hsh:
    return None
  pos = ''
  proc = RunGitCommand(directory, ['cat-file', 'commit', 'HEAD'])
  if proc:
    output = proc.communicate()[0]
    if proc.returncode == 0 and output:
      for line in reversed(output.splitlines()):
        if line.startswith('Cr-Commit-Position:'):
          pos = line.rsplit()[-1].strip()
          break
  if not pos:
    return VersionInfo('git', hsh)
  return VersionInfo('git', '%s-%s' % (hsh, pos))
github flutter / engine / build / util / lastchange.py View on Github external
output = proc.communicate()[0].strip()
    if proc.returncode == 0 and output:
      hsh = output
  if not hsh:
    return None
  pos = ''
  proc = RunGitCommand(directory, ['cat-file', 'commit', 'HEAD'])
  if proc:
    output = proc.communicate()[0]
    if proc.returncode == 0 and output:
      for line in reversed(output.splitlines()):
        if line.startswith('Cr-Commit-Position:'):
          pos = line.rsplit()[-1].strip()
          break
  if not pos:
    return VersionInfo('git', hsh)
  return VersionInfo('git', '%s-%s' % (hsh, pos))
github flutter / engine / build / util / lastchange.py View on Github external
"""
  Returns the last change (in the form of a branch, revision tuple),
  from some appropriate revision control system.
  """
  svn_url_regex = re.compile(
      r'.*/(' + directory_regex_prior_to_src_url + r')(/.*)')

  version_info = (FetchSVNRevision(directory, svn_url_regex) or
                  FetchGitSVNRevision(directory, svn_url_regex, go_deeper) or
                  FetchGitRevision(directory))
  if not version_info:
    if default_lastchange and os.path.exists(default_lastchange):
      revision = open(default_lastchange, 'r').read().strip()
      version_info = VersionInfo(None, revision)
    else:
      version_info = VersionInfo(None, None)
  return version_info
github CyanogenMod / android_external_chromium / build / util / lastchange.py View on Github external
def FetchVersionInfo(default_lastchange, directory=None):
  """
  Returns the last change (in the form of a branch, revision tuple),
  from some appropriate revision control system.
  """
  version_info = FetchSVNRevision(directory) or FetchGitRevision(directory)
  if not version_info:
    if default_lastchange and os.path.exists(default_lastchange):
      revision = open(default_lastchange, 'r').read().strip()
      version_info = VersionInfo(None, None, revision)
    else:
      version_info = VersionInfo('unknown', '', '0')
  return version_info
github flutter / engine / build / util / lastchange.py View on Github external
directory_regex_prior_to_src_url='chrome|blink|svn',
                     go_deeper=False):
  """
  Returns the last change (in the form of a branch, revision tuple),
  from some appropriate revision control system.
  """
  svn_url_regex = re.compile(
      r'.*/(' + directory_regex_prior_to_src_url + r')(/.*)')

  version_info = (FetchSVNRevision(directory, svn_url_regex) or
                  FetchGitSVNRevision(directory, svn_url_regex, go_deeper) or
                  FetchGitRevision(directory))
  if not version_info:
    if default_lastchange and os.path.exists(default_lastchange):
      revision = open(default_lastchange, 'r').read().strip()
      version_info = VersionInfo(None, revision)
    else:
      version_info = VersionInfo(None, None)
  return version_info
github CyanogenMod / android_external_chromium / build / util / lastchange.py View on Github external
# mysterious loss of cwd while invoking cygwin's git.
  # We can't just pass shell=True to Popen, as under win32 this will
  # cause CMD to be used, while we explicitly want a cygwin shell.
  command = ['git', 'rev-parse', 'HEAD']
  if sys.platform in ('cygwin', 'win32'):
    command = ['sh', '-c', ' '.join(command)]
  try:
    proc = subprocess.Popen(command,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            cwd=directory)
  except OSError:
    return None
  output = proc.communicate()[0].strip()
  if proc.returncode == 0 and output:
    return VersionInfo('git', 'git', output[:7])
  return None
github CyanogenMod / android_external_chromium / build / util / lastchange.py View on Github external
def FetchVersionInfo(default_lastchange, directory=None):
  """
  Returns the last change (in the form of a branch, revision tuple),
  from some appropriate revision control system.
  """
  version_info = FetchSVNRevision(directory) or FetchGitRevision(directory)
  if not version_info:
    if default_lastchange and os.path.exists(default_lastchange):
      revision = open(default_lastchange, 'r').read().strip()
      version_info = VersionInfo(None, None, revision)
    else:
      version_info = VersionInfo('unknown', '', '0')
  return version_info