def choose_name(fp, mfst):
"""Find the package name for this manifest. If it's defined in a set
action in the manifest, use that. Otherwise use the basename of the
path to the manifest as the name. If a proper package fmri is found,
then also return a PkgFmri object so that we can track which packages
are being processed.
'fp' is the path to the file for the manifest.
'mfst' is the Manifest object."""
if mfst is None:
return unquote(os.path.basename(fp)), None
name = mfst.get("pkg.fmri", mfst.get("fmri", None))
if name is not None:
try:
pfmri = fmri.PkgFmri(name)
except fmri.IllegalFmri:
pfmri = None
return name, pfmri
return unquote(os.path.basename(fp)), None
评论列表
文章目录