From b5cbc600f6d835eb416338dc76023deda2935998 Mon Sep 17 00:00:00 2001 From: Bin Li Date: Mon, 21 Mar 2022 10:05:31 +0800 Subject: [PATCH] apt.cache has no attribute 'packages' --- data/list-oem-metapackages | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/list-oem-metapackages b/data/list-oem-metapackages index 07260f4..e01904b 100755 --- a/data/list-oem-metapackages +++ b/data/list-oem-metapackages @@ -18,8 +18,8 @@ STAMP_FILE = os.path.join( def any_oem_metapackages_installed(cache): installed_oem_packages = ( pkg - for pkg in cache - if fnmatch.fnmatch(pkg.name, "oem-*-meta") and pkg.is_installed + for pkg in cache.packages + if fnmatch.fnmatch(pkg.name, "oem-*-meta") and pkg.inst_state == apt_pkg.INSTSTATE_OK ) # Empty if there are no installed OEM packages @@ -43,7 +43,7 @@ if __name__ == "__main__": sys.exit(0) try: - cache = apt.Cache() + cache = apt_pkg.Cache() except apt_pkg.Error: # broken things in sources.list, or corrupted list files print( "ERROR: Can't look into APT cache. Check your sources.list file(s), run `apt update` and try again", -- 2.34.1