def ComputeApplicationUniquifier(hash_obj):
  def ProcessDirectory(path, relative_path, depth=1):
    if depth > _MAX_DEPTH:
      return
    try:
      names = os.listdir(path)
    except BaseException:
      return
    modules = set()
    for name in sorted(names):
      current_path = os.path.join(path, name)
      if not os.path.isdir(current_path):
        file_name, ext = os.path.splitext(name)
        if ext not in ('.py', '.pyc', '.pyo'):
          continue
        if file_name in modules:
          continue
        modules.add(file_name)
        ProcessApplicationFile(current_path, os.path.join(relative_path, name))
      elif IsPackage(current_path):
        ProcessDirectory(current_path,
                         os.path.join(relative_path, name),
                         depth + 1)
  def IsPackage(path):
    init_base_path = os.path.join(path, '__init__.py')
    return (os.path.isfile(init_base_path) or
            os.path.isfile(init_base_path + 'c') or
            os.path.isfile(init_base_path + 'o'))
  def ProcessApplicationFile(path, relative_path):
    hash_obj.update(relative_path.encode())
    hash_obj.update(':'.encode())
    try:
      hash_obj.update(str(os.stat(path).st_size).encode())
    except BaseException:
      pass
    hash_obj.update('\n'.encode())
  ProcessDirectory(sys.path[0], '')