tools/linux/dump-static-initializers.py
def QualifyFilenameAsProto(filename):
  """Attempt to qualify a bare |filename| with a src-relative path, assuming it
  is a protoc-generated file.  If a single match is found, it is returned.
  Otherwise the original filename is returned."""
  if not IS_GIT_WORKSPACE:
    return filename
  match = protobuf_filename_re.match(filename)
  if not match:
    return filename
  basename = match.groups(0)
  cmd = ['git', 'ls-files', '--', '*/%s.proto' % basename]
  gitlsfiles = subprocess.Popen(cmd,
                                stdout=subprocess.PIPE,
                                universal_newlines=True)
  candidate = filename
  for line in gitlsfiles.stdout:
    if candidate != filename:
      return filename # Multiple hits, can't help.
    candidate = line.strip()
  return candidate
Attempt to qualify a bare |filename| with a src-relative path, assuming it
  is a protoc-generated file.  If a single match is found, it is returned.
  Otherwise the original filename is returned.
Attempt to qualify a bare |filename| with a src-relative path, assuming it
is a protoc-generated file.  If a single match is found, it is returned.
Otherwise the original filename is returned.
Attempt to qualify a bare |filename| with a src - relative path assuming it is a protoc - generated file . If a single match is found it is returned . Otherwise the original filename is returned .
def QualifyFilenameAsProto(filename):
  if not IS_GIT_WORKSPACE:
    return filename
  match = protobuf_filename_re.match(filename)
  if not match:
    return filename
  basename = match.groups(0)
  cmd = ['git', 'ls-files', '--', '*/%s.proto' % basename]
  gitlsfiles = subprocess.Popen(cmd,
                                stdout=subprocess.PIPE,
                                universal_newlines=True)
  candidate = filename
  for line in gitlsfiles.stdout:
    if candidate != filename:
      return filename 
    candidate = line.strip()
  return candidate
def QualifyFilenameAsProto ( filename ) : if not IS_GIT_WORKSPACE : return filename match = protobuf_filename_re . match ( filename ) if not match : return filename basename = match . groups ( 0 ) cmd = [ 'git' , 'ls-files' , '--' , '*/%s.proto' % basename ] gitlsfiles = subprocess . Popen ( cmd , stdout = subprocess . PIPE , universal_newlines = True ) candidate = filename for line in gitlsfiles . stdout : if candidate != filename : return filename candidate = line . strip ( ) return candidate
Attempt to qualify a bare |filename| with a src-relative path, assuming it
is a protoc-generated file.
Attempt to qualify a bare |filename| with a src - relative path assuming it is a protoc - generated file .
"""Attempt to qualify a bare |filename| with a src-relative path, assuming it
  is a protoc-generated file.  If a single match is found, it is returned.
  Otherwise the original filename is returned.""" # Multiple hits, can't help.
filename