def get_rpm_tags(location, include_desc=False): """ Return an RPMtags object for the file at location or None. Include the long RPM description value if `include_desc` is True. """ with open(location, 'rb') as rpmf: rpm = RPM(rpmf) tags = {k: v for k, v in rpm.to_dict().items() if k in RPM_TAGS} if not include_desc: tags['description'] = None return RPMtags(**tags)
def get_rpm_tags(location, include_desc=False): """ Return an RPMtags object for the file at location or None. Include the long RPM description value if `include_desc` is True. """ T = typecode.contenttype.get_type(location) if 'rpm' not in T.filetype_file.lower(): return with open(location, 'rb') as rpmf: rpm = RPM(rpmf) tags = {k: v for k, v in rpm.to_dict().items() if k in RPM_TAGS} if not include_desc: tags['description'] = None return RPMtags(**tags)