label_to_package_name.py 文件源码

python
阅读 100 收藏 0 点赞 0 评论 0

项目:build 作者: fuchsia-mirror 项目源码 文件源码
def convert(label):
  if not label.startswith("//"):
      sys.stderr.write("expected label to start with //, got %s\n" % label)
      return 1
  base = _remove_sdk_dir(label[2:])
  separator_index = string.rfind(base, ":")
  if separator_index < 0:
      sys.stderr.write("could not find target name in label %s\n" % label)
      return 1
  path = base[:separator_index].split("/")
  name = base[separator_index+1:]
  if path[-1] == name:
      return ".".join(path)
  else:
      return "%s._%s" % (".".join(path), name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号