def parse_status_file(location, distro='debian'): """ Yield Debian Package objects from a dpkg `status` file or None. """ if not os.path.exists(location): raise FileNotFoundError( '[Errno 2] No such file or directory: {}'.format(repr(location))) if not is_debian_status_file(location): return for debian_pkg_data in debcon.get_paragraphs_data_from_file(location): yield build_package(debian_pkg_data, distro)
def from_file(cls, location): paragraphs = iter(debcon.get_paragraphs_data_from_file(location)) return cls._from_paragraph_data(paragraphs)