From 0b956b4541dc3f5b4d417ce00b16497b755e3d1a Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 16 Feb 2012 12:36:10 +0100 Subject: [PATCH] remove unused apt helper --- lib/apt_handler.py | 97 ---------------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 lib/apt_handler.py diff --git a/lib/apt_handler.py b/lib/apt_handler.py deleted file mode 100644 index a00d4e3..0000000 --- a/lib/apt_handler.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import apt -import difflib - -def get_apt_cache(): - cache = apt.cache.Cache() - cache.update() - return cache - -def guess_packages_by_name(name, cache=None, cache_update=False, - count=5, cutoff=0.6): - cache = cache or apt.cache.Cache() - if cache_update: - cache.update() - result = difflib.get_close_matches( - name, - cache.keys(), - count, - cutoff - ) - return map(lambda x: get_package_by_name(x, cache=cache), result) - -def get_package_by_name(name, cache=None, cache_update=False): - cache = cache or apt.cache.Cache() - if cache_update: - cache.update() - try: - return cache[name] - except KeyError: - return None - -def get_providing_packages_by_name(name, cache=None, cache_update=False): - cache = cache or apt.cache.Cache() - if cache_update: - cache.update() - return cache.get_providing_packages(name) - -def find_linux_headers_packages(cache=None, cache_update=False): - return filter(lambda x: x.name.startswith('linux-headers-2.6.') and - 'vserver' not in x.name and - 'xen' not in x.name and - 'openvz' not in x.name, - get_providing_packages_by_name( - 'linux-headers', - cache=cache, - cache_update=cache_update - ) - ) - -def find_linux_image_packages(cache=None, cache_update=False): - return filter(lambda x: x.name.startswith('linux-image-2.6.') and - 'vserver' not in x.name and - 'xen' not in x.name and - 'openvz' not in x.name, - get_providing_packages_by_name( - 'linux-image', - cache=cache, - cache_update=cache_update - - ) - ) - -def find_linux_source_packages(cache=None, cache_update=False): - return filter(lambda x: x.name.startswith('linux-source-2.6.') and - 'vserver' not in x.name and - 'xen' not in x.name and - 'openvz' not in x.name, - get_providing_packages_by_name( - 'linux-source', - cache=cache, - cache_update=cache_update - ) - ) - -def find_gcc_compiler_packages(cache=None, cache_update=False): - return filter(lambda x: x.name.startswith('gcc-') and - 'vserver' not in x.name and - 'xen' not in x.name and - 'openvz' not in x.name, - get_providing_packages_by_name( - 'c-compiler', - cache=cache, - cache_update=cache_update - ) - ) - -def find_iptables_packages(cache=None, cache_update=False): - return [get_package_by_name('iptables', cache=cache, - cache_update=cache_update)] - -def find_ebtables_packages(cache=None, cache_update=False): - return [get_package_by_name('ebtables', cache=cache, - cache_update=cache_update)] - - -- 2.39.5