merge_manifest.py 文件源码

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

项目:nojs 作者: chrisdickinson 项目源码 文件源码
def _PatchedManifest(manifest_path):
  """Patches an Android manifest to always include the 'tools' namespace
  declaration, as it is not propagated by the manifest merger from the SDK.

  See https://issuetracker.google.com/issues/63411481
  """
  doc = minidom.parse(manifest_path)
  manifests = doc.getElementsByTagName('manifest')
  assert len(manifests) == 1
  manifest = manifests[0]

  manifest.setAttribute('xmlns:%s' % TOOLS_NAMESPACE_PREFIX, TOOLS_NAMESPACE)

  tmp_prefix = os.path.basename(manifest_path)
  with tempfile.NamedTemporaryFile(prefix=tmp_prefix) as patched_manifest:
    doc.writexml(patched_manifest)
    patched_manifest.flush()
    yield patched_manifest.name
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号