Markdown Format | JSON API | MCP Server Tool
Help on module apt_pkg: NAME apt_pkg - Classes and functions wrapping the apt-pkg library. DESCRIPTION The apt_pkg module provides several classes and functions for accessing the functionality provided by the apt-pkg library. Typical uses might include reading APT index files and configuration files and installing or removing packages. CLASSES _PackageManager(builtins.object) PackageManager builtins.SystemError(builtins.Exception) Error builtins.ValueError(builtins.Exception) CacheMismatchError builtins.object Acquire AcquireItem AcquireFile AcquireItemDesc AcquireWorker ActionGroup Cache Cdrom Configuration DepCache Dependency DependencyList Description FileLock Group GroupList HashString HashStringList Hashes IndexFile MetaIndex OrderList Package PackageFile PackageList PackageRecords Policy ProblemResolver SourceList SourceRecordFiles SourceRecords SystemLock Tag TagRemove TagRename TagRewrite TagFile TagSection Version class Acquire(builtins.object) | Acquire([progress: apt.progress.base.AcquireProgress]) | | Coordinate the retrieval of files via network or local file system | (using 'copy:/path/to/file' style URIs). The optional argument | 'progress' takes an apt.progress.base.AcquireProgress object | which may report progress information. | | Methods defined here: | | get_lock(...) | get_lock(log: str) | | Acquires a log for the given directory, using a file 'lock' in it. | | run(...) | run() -> int | | Run the fetcher and return one of RESULT_CANCELLED, | RESULT_CONTINUE, RESULT_FAILED. | | RESULT_CONTINUE means that all items which where queued prior to | calling run() have been fetched successfully or failed transiently. | | RESULT_CANCELLED means canceled by the progress class. | | RESULT_FAILED means a generic failure. | | shutdown(...) | shutdown() | | Shut the fetcher down, removing all items from it. Future access to | queued AcquireItem objects will cause a segfault. The partial result | is kept on the disk and not removed and APT might reuse it. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | fetch_needed | The total amount of data to be fetched (number of bytes). | | items | A list of all items as apt_pkg.AcquireItem objects, including already | fetched ones and to be fetched ones. | | partial_present | The amount of data which is already available (number of bytes). | | total_needed | The amount of data that needs to fetched plus the amount of data | which has already been fetched (number of bytes). | | workers | A list of all active workers as apt_pkg.AcquireWorker objects. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | RESULT_CANCELLED = 2 | | RESULT_CONTINUE = 0 | | RESULT_FAILED = 1 class AcquireFile(AcquireItem) | AcquireFile(owner, uri[, hash: Union[apt_pkg.HashStringList, str], size, descr, short_descr, destdir,destfile]) | | Represent a file to be fetched. The parameter 'owner' points to | an apt_pkg.Acquire object and the parameter 'uri' to the source | location. Normally, the file will be stored in the current directory | using the file name given in the URI. This directory can be changed | by passing the name of a directory to the 'destdir' parameter. It is | also possible to set a path to a file using the 'destfile' parameter, | but both cannot be specified together. | | The parameters 'short_descr' and 'descr' can be used to specify | a short description and a longer description for the item. This | information is used by progress classes to refer to the item and | should be short, for example, package name as 'short_descr' and | and something like 'http://localhost sid/main python-apt 0.7.94.2' | as 'descr'. | The parameters 'hash' and 'size' are used to verify the resulting | file. The parameter 'size' is also to calculate the total amount | of data to be fetched and is useful for resuming a interrupted | download. | | All parameters can be given by name (i.e. as keyword arguments). | | Method resolution order: | AcquireFile | AcquireItem | builtins.object | | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from AcquireItem: | | __repr__(self, /) | Return repr(self). | | ---------------------------------------------------------------------- | Data descriptors inherited from AcquireItem: | | active_subprocess | The name of the active subprocess (for instance, 'gzip', 'rred' or 'gpgv'). | | complete | A boolean value determining whether the item has been fetched | completely | | desc_uri | A string describing the URI from which the item is acquired. | | destfile | The path to the file where the item will be stored. | | error_text | If an error occurred, a string describing the error; empty string | otherwise. | | filesize | The size of the file (number of bytes). If unknown, it is set to 0. | | id | The ID of the item. An integer which can be set by progress classes. | | is_trusted | Whether the item is trusted or not. Only True for packages | which come from a repository signed with one of the keys in | APT's keyring. | | local | Whether we are fetching a local item (copy:/) or not. | | mode | Old name for active_subprocess | | partialsize | The amount of data which has already been fetched (number of bytes). | | status | An integer representing the item's status which can be compared | against one of the STAT_* constants defined in this class. | | ---------------------------------------------------------------------- | Data and other attributes inherited from AcquireItem: | | STAT_AUTH_ERROR = 4 | | STAT_DONE = 2 | | STAT_ERROR = 3 | | STAT_FETCHING = 1 | | STAT_IDLE = 0 | | STAT_TRANSIENT_NETWORK_ERROR = 5 class AcquireItem(builtins.object) | Represent a single item to be fetched by an Acquire object. | | It is not possible to construct instances of this class directly. | Prospective users should construct instances of a subclass such as | AcquireFile instead. It is not possible to create subclasses on the | Python level, only on the C++ level. | | Methods defined here: | | __repr__(self, /) | Return repr(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | active_subprocess | The name of the active subprocess (for instance, 'gzip', 'rred' or 'gpgv'). | | complete | A boolean value determining whether the item has been fetched | completely | | desc_uri | A string describing the URI from which the item is acquired. | | destfile | The path to the file where the item will be stored. | | error_text | If an error occurred, a string describing the error; empty string | otherwise. | | filesize | The size of the file (number of bytes). If unknown, it is set to 0. | | id | The ID of the item. An integer which can be set by progress classes. | | is_trusted | Whether the item is trusted or not. Only True for packages | which come from a repository signed with one of the keys in | APT's keyring. | | local | Whether we are fetching a local item (copy:/) or not. | | mode | Old name for active_subprocess | | partialsize | The amount of data which has already been fetched (number of bytes). | | status | An integer representing the item's status which can be compared | against one of the STAT_* constants defined in this class. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | STAT_AUTH_ERROR = 4 | | STAT_DONE = 2 | | STAT_ERROR = 3 | | STAT_FETCHING = 1 | | STAT_IDLE = 0 | | STAT_TRANSIENT_NETWORK_ERROR = 5 class AcquireItemDesc(builtins.object) | Provide the description of an item and the URI the item is | fetched from. Progress classes make use of such objects to | retrieve description and other information about an item. | | Data descriptors defined here: | | description | A string describing the item. | | owner | The owner of the item, an apt_pkg.AcquireItem object. | | shortdesc | A short string describing the item (e.g. package name). | | uri | The URI from which this item would be downloaded. class AcquireWorker(builtins.object) | Represent a sub-process responsible for fetching files from | remote locations. This sub-process uses 'methods' located in | the directory specified by the configuration option | Dir::Bin::Methods. | | Data descriptors defined here: | | current_item | The item currently being fetched, as an apt_pkg.AcquireItemDesc object. | | current_size | The amount of data fetched so far for the current item. | | resumepoint | The amount of data which was already available when the download was | started. | | status | The status of the worker, as a string. | | total_size | The total size of the item. class ActionGroup(builtins.object) | ActionGroup(depcache) | | Create a new ActionGroup() object. The parameter *depcache* refers to an | apt_pkg.DepCache() object. | | ActionGroups disable certain cleanup actions, so modifying many packages | is much faster. | | ActionGroup() can also be used with the 'with' statement, but be aware | that the ActionGroup() is active as soon as it is created, and not just | when entering the context. This means you can write:: | | with apt_pkg.ActionGroup(depcache): | depcache.markInstall(pkg) | | Once the block of the with statement is left, the action group is | automatically released from the cache. | | Methods defined here: | | __enter__(...) | __enter__() -> ActionGroup | | A dummy action which just returns the object itself, so it can | be used as a context manager. | | __exit__(...) | __exit__(*excinfo) -> bool | | Same as release(), but for use as a context manager. | | release(...) | release() | | End the scope of this action group. If this is the only action | group bound to the cache, this will cause any deferred cleanup | actions to be performed. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class Cache(builtins.object) | Cache([progress]) -> Cache() object. | | The APT cache file contains a hash table mapping names of binary | packages to their metadata. A Cache object is the in-core | representation of the same. It provides access to APT’s idea of the | list of available packages. | The optional parameter *progress* can be used to specify an | apt.progress.base.OpProgress() object (or similar) which reports | progress information while the cache is being opened. If this | parameter is not supplied, the progress will be reported in simple, | human-readable text to standard output. If it is None, no output | will be made. | | The cache can be used like a mapping from package names to Package | objects (although only getting items is supported). Instead of a name, | a tuple of a name and an architecture may be used. | | Methods defined here: | | __contains__(self, key, /) | Return key in self. | | __getitem__(self, key, /) | Return self[key]. | | __len__(self, /) | Return len(self). | | update(...) | update(progress, sources: SourceList, pulse_interval: int) -> bool | | Update the index files used by the cache. A call to this method | does not affect the current Cache object; instead, a new one | should be created in order to use the changed index files. | | The parameter 'progress' can be used to specify an | apt.progress.base.AcquireProgress() object , which will report | progress information while the index files are being fetched. | The parameter 'sources', if provided, is an apt_pkg.SourcesList | object listing the remote repositories to be used. | The 'pulse_interval' parameter indicates how long (in microseconds) | to wait between calls to the pulse() method of the 'progress' object. | The default is 500000 microseconds. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | depends_count | The number of apt_pkg.Dependency objects stored in the cache. | | file_list | A list of apt_pkg.PackageFile objects stored in the cache. | | group_count | The number of apt_pkg.Group objects stored in the cache. | | groups | A list of Group objects in the cache | | is_multi_arch | Whether the cache supports multi-arch. | | package_count | The number of apt_pkg.Package objects stored in the cache. | | package_file_count | The number of apt_pkg.PackageFile objects stored in the cache. | | packages | A list of apt_pkg.Package objects stored in the cache. | | policy | The PkgPolicy for the cache | | provides_count | Number of Provides relations described in the cache. | | ver_file_count | The number of (Version, PackageFile) relations. | | version_count | The number of apt_pkg.Version objects stored in the cache. class CacheMismatchError(builtins.ValueError) | Raised when passing an object from a different cache to | :class:`apt_pkg.DepCache` methods | | .. versionadded:: 1.6.1 | | Method resolution order: | CacheMismatchError | builtins.ValueError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.ValueError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.ValueError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class Cdrom(builtins.object) | Cdrom() | | Cdrom objects can be used to identify Debian installation media and to | add them to /etc/apt/sources.list. | | Methods defined here: | | add(...) | add(progress: apt_pkg.CdromProgress) -> bool | | Add the given CD-ROM to the sources.list. Return True on success; | raise an error on failure or return False. | | ident(...) | ident(progress: apt_pkg.CdromProgress) -> str | | Try to identify the CD-ROM and if successful return the hexadecimal | CDROM-ID (and a integer version suffix separated by -) as a | string. Otherwise, return None or raise an error. | | The ID is created by hashing all file and directory names on the | CD-ROM and appending the version. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class Configuration(builtins.object) | Configuration() | | Represent the configuration of APT by mapping option keys to | values and storing configuration parsed from files like | /etc/apt/apt.conf. The most important Configuration object | is apt_pkg.config which points to the global configuration | object. Other top-level Configuration objects can be created | by calling the constructor, but there is usually no reason to. | | Methods defined here: | | __contains__(self, key, /) | Return key in self. | | __delitem__(self, key, /) | Delete self[key]. | | __getitem__(self, key, /) | Return self[key]. | | __setitem__(self, key, value, /) | Set self[key] to value. | | clear(...) | clear(key: str) | | Remove the specified option and all sub-options. | | dump(...) | dump() -> str | | Return a string dump this Configuration object. | | exists(...) | exists(key: str) -> bool | | Check whether the given key exists. | | find(...) | find(key: str[, default: str = '']) -> str | | Find the value for the given key and return it. If the | given key does not exist, return default instead. | | find_b(...) | find_i(key: str[, default: bool = False]) -> bool | | Same as find, but for boolean values; returns False on unknown values. | | find_dir(...) | find_dir(key: str[, default: str = '']) -> str | | Same as find_file(), but for directories. The difference is | that this function adds a trailing slash to the result. | | find_file(...) | find_file(key: str[, default: str = '']) -> str | | Same as find(), but for filenames. In the APT configuration, there | is a special section Dir:: for storing filenames. find_file() locates | the given key and then goes up and prepends the directory names to the | return value. For example, for: | | apt_pkg.config['Dir'] = 'a' | apt_pkg.config['Dir::D'] = 'b' | apt_pkg.config['Dir::D::F'] = 'c' | | find_file('Dir::D::F') returns 'a/b/c'. There is also a special | configuration setting RootDir which will always be prepended to the | result (the default being ''). Thus, if RootDir is 'x', the example | would return 'x/a/b/c'. | | find_i(...) | find_i(key: str[, default: int = 0]) -> int | | Same as find, but for integer values. | | get(...) | find(key: str[, default: str = '']) -> str | | Find the value for the given key and return it. If the | given key does not exist, return default instead. | | keys(...) | keys([root: str]) -> list | | Return a list of all keys in the configuration object. If 'root' | is given, limit the list to those below the root. | | list(...) | list([root: str]) -> list | | Return a list of all items at the given root, using their full | name. For example, in a configuration object where the options A, | B, and B::C are set, the following expressions evaluate to True: | | conf.list() == ['A', 'B'] | conf.list('A') == [''] | conf.list('B') == ['B::C'] | | my_tag(...) | my_tag() -> str | | Return the tag of the root of this Configuration object. For the | default object, this is an empty string. For a subtree('APT') of | such an object, it would be 'APT' (given as an example). | | set(...) | set(key: str, value: str) | | Set the given key to the given value. To set int or bool values, | encode them using str(value) and then use find_i()/find_b() | to retrieve their value again. | | subtree(...) | subtree(key: str) -> apt_pkg.Configuration | | Return a new apt_pkg.Configuration object with the given option | as its root. Example: | | apttree = config.subtree('APT') | apttree['Install-Suggests'] = config['APT::Install-Suggests'] | | value_list(...) | value_list([root: str]) -> list | | Same as list(), but instead of returning the keys, return the values. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class DepCache(builtins.object) | DepCache(cache: apt_pkg.Cache) | | A DepCache() holds extra information on the state of the packages. | | The parameter 'cache' refers to an apt_pkg.Cache() object. | | Methods defined here: | | commit(...) | commit(acquire_progress, install_progress) | | Commit all the marked changes. This method takes two arguments, | 'acquire_progress' takes an apt.progress.base.AcquireProgress | object and 'install_progress' an apt.progress.base.InstallProgress | object. | | fix_broken(...) | fix_broken() -> bool | | Fix broken packages. | | get_candidate_ver(...) | get_candidate_ver(pkg: apt_pkg.Package) -> apt_pkg.Version | | Return the candidate version for the package, normally the version | with the highest pin (changeable using set_candidate_ver). | | init(...) | init(progress: apt.progress.base.OpProgress) | | Initialize the depcache (done automatically when constructing | the object). | | is_auto_installed(...) | is_auto_installed(pkg: apt_pkg.Package) -> bool | | Check whether the package is marked as automatically installed. | | is_garbage(...) | is_garbage(pkg: apt_pkg.Package) -> bool | | Check whether the package is garbage, i.e. whether it is automatically | installed and the reverse dependencies are not installed anymore. | | is_inst_broken(...) | is_inst_broken(pkg: apt_pkg.Package) -> bool | | Check whether the package is broken, ignoring marked changes. | | is_now_broken(...) | is_now_broken(pkg: apt_pkg.Package) -> bool | | Check whether the package is broken, taking marked changes into account. | | is_upgradable(...) | is_upgradable(pkg: apt_pkg.Package) -> bool | | Check whether the package is upgradable. | | mark_auto(...) | mark_auto(pkg: apt_pkg.Package, auto: bool) | | Mark package as automatically installed (if auto=True), | or as not automatically installed (if auto=False). | | mark_delete(...) | mark_delete(pkg: apt_pkg.Package[, purge: bool = False]) | | Mark package for deletion, and if 'purge' is True also for purging. | | mark_install(...) | mark_install(pkg: apt_pkg.Package[, auto_inst=True, from_user=True]) | | Mark the package for installation. The parameter 'auto_inst' controls | whether the dependencies of the package are marked for installation | as well. The parameter 'from_user' controls whether the package is | registered as NOT automatically installed. | | mark_keep(...) | mark_keep(pkg: apt_pkg.Package) | | Mark package to be kept. | | marked_delete(...) | marked_delete(pkg: apt_pkg.Package) -> bool | | Check whether the package is marked for removal. | | marked_downgrade(...) | marked_downgrade(pkg: apt_pkg.Package) -> bool | | Check whether the package is marked for downgrade. | | marked_install(...) | marked_install(pkg: apt_pkg.Package) -> bool | | Check whether the package is marked for installation. | | marked_keep(...) | marked_keep(pkg: apt_pkg.Package) -> bool | | Check whether the package should be kept. | | marked_reinstall(...) | marked_reinstall(pkg: apt_pkg.Package) -> bool | | Check whether the package is marked for re-installation. | | marked_upgrade(...) | marked_upgrade(pkg: apt_pkg.Package) -> bool | | Check whether the package is marked for upgrade. | | minimize_upgrade(...) | minimize_upgrade() -> bool | | Go over the entire set of packages and try to keep each package | marked for upgrade. If a conflict is generated then the package | is restored. | | read_pinfile(...) | read_pinfile([file: str]) | | Read the pin policy | | set_candidate_release(...) | set_candidate_release(pkg: apt_pkg.Package, ver: apt_pkg.Version, rel: string) -> bool | | Sets not only the candidate version 'ver' for package 'pkg', but walks also down the dependency tree and checks if it is required to set the candidate of the dependency to a version from the given release string 'rel', too. | | set_candidate_ver(...) | set_candidate_ver(pkg: apt_pkg.Package, ver: apt_pkg.Version) -> bool | | Set the candidate version of 'pkg' to 'ver'. | | set_reinstall(...) | set_reinstall(pkg: apt_pkg.Package, reinstall: bool) | | Set whether the package should be reinstalled (reinstall = True or False). | | upgrade(...) | upgrade([dist_upgrade: bool = True]) -> bool | | Mark the packages for upgrade under the same conditions apt-get | upgrade does. If 'dist_upgrade' is True, also allow packages to | be upgraded if they require installation/removal of other packages; | just like apt-get dist-upgrade. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | broken_count | The number of packages with broken dependencies in the cache. | | deb_size | The size of the packages which are needed for the changes to be | applied. | | del_count | The number of packages marked for removal. | | inst_count | The number of packages marked for installation. | | keep_count | The number of packages marked for keep. | | policy | The apt_pkg.Policy object used by this cache. | | usr_size | The amount of space required for installing/removing the packages, | i.e. the Installed-Size of all packages marked for installation | minus the Installed-Size of all packages for removal. class Dependency(builtins.object) | Represent a dependency from one package version to a package, | and (optionally) a version relation (e.g. >= 1). Dependency | objects also provide useful functions like all_targets() | for selecting packages to satisfy the dependency. | | Methods defined here: | | __repr__(self, /) | Return repr(self). | | all_targets(...) | all_targets() -> list | | A list of all possible apt_pkg.Version objects which satisfy this | dependency. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | comp_type | The type of comparison in mathematical notation, as a string, namely one of: | '<', '<=', '=', '!=', '>=', '>', ''. | The empty string will be returned in case of an unversioned dependency. | | comp_type_deb | The type of comparison in Debian notation, as a string, namely one of: | '<<', '<=', '=', '!=', '>=', '>>', ''. | The empty string will be returned in case of an unversioned dependency. | For details see the Debian Policy Manual on the syntax of relationship fields: | https://www.debian.org/doc/debian-policy/ch-relationships.html#s-depsyntax | | dep_type | The type of the dependency; may be translated | | dep_type_enum | Same as dep_type, but with a numeric value instead of a string. Can | be compared against the TYPE_ constants defined in this class. | | dep_type_untranslated | Same as dep_type, but guaranteed to be untranslated. | | id | The numeric ID of this dependency object. | | parent_pkg | The apt_pkg.Package object of the package which depends. | | parent_ver | The apt_pkg.Version object of the package which depends. | | target_pkg | The apt_pkg.Package object of the package depended upon | | target_ver | The version of the package depended upon as a string | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TYPE_CONFLICTS = 5 | | TYPE_DEPENDS = 1 | | TYPE_DPKG_BREAKS = 8 | | TYPE_ENHANCES = 9 | | TYPE_OBSOLETES = 7 | | TYPE_PREDEPENDS = 2 | | TYPE_RECOMMENDS = 4 | | TYPE_REPLACES = 6 | | TYPE_SUGGESTS = 3 class DependencyList(builtins.object) | A simple list-like type for representing multiple dependency | objects in an efficient manner; without having to generate | all Dependency objects in advance. | | Methods defined here: | | __getitem__(self, key, /) | Return self[key]. | | __len__(self, /) | Return len(self). class Description(builtins.object) | Represent a package description and some attributes. Needed for | things like translated descriptions. | | Methods defined here: | | __repr__(self, /) | Return repr(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | file_list | A list of all apt_pkg.PackageFile objects related to this description. | | language_code | The language code of the description. Empty string for untranslated | descriptions. | | md5 | The MD5 hash of the description. class Error(builtins.SystemError) | Exception class for most python-apt exceptions. | | This class replaces the use of :class:`SystemError` in previous versions | of python-apt. It inherits from :class:`SystemError`, so make sure to | catch this class first. | | .. versionadded:: 1.1 | | Method resolution order: | Error | builtins.SystemError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.SystemError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.SystemError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class FileLock(builtins.object) | SystemLock(filename: str) | | Context manager for locking using a file. The lock is established | as soon as the method __enter__() is called. It is released when | __exit__() is called. | | This should be used via the 'with' statement, for example: | | with apt_pkg.FileLock(filename): | ... | | Once the block is left, the lock is released automatically. The object | can be used multiple times: | | lock = apt_pkg.FileLock(filename) | with lock: | ... | with lock: | ... | | Methods defined here: | | __enter__(...) | Lock the system. | | __exit__(...) | Unlock the system. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class Group(builtins.object) | Group(cache, name) | | Group of packages with the same name. | | Provides access to all packages sharing a name. Can be used this | like a list, or by using the special find_*() methods. If you use | it as a sequence, make sure to access it linearly, as this uses a | linked list internally. | | Methods defined here: | | __getitem__(self, key, /) | Return self[key]. | | find_package(...) | find_package(architecture: str) -> Package | | Return a package for the given architecture, or None if none exists | | find_preferred_package(...) | find_preferred_package(prefer_non_virtual: bool = True) -> Package | | Return a package for the best architecture, either the native one | or the first found one. If none exists, return None. If non_virtual | is True, prefer non-virtual packages over virtual ones. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class GroupList(builtins.object) | A GroupList is an internally used structure to represent | the 'groups' attribute of apt_pkg.Cache objects in a more | efficient manner by creating Group objects only when they | are accessed. | | Methods defined here: | | __getitem__(self, key, /) | Return self[key]. | | __len__(self, /) | Return len(self). class HashString(builtins.object) | HashString(type, hash) OR HashString('type:hash') | | Create a new HashString object. The first form allows you to specify | a type and a hash, and the second form a single string where type and | hash are separated by a colon, e.g.:: | | HashString('MD5Sum', '6cc1b6e6655e3555ac47e5b5fe26d04e') | | Valid options for 'type' are: MD5Sum, SHA1, SHA256. | | Methods defined here: | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __gt__(self, value, /) | Return self>value. | | __le__(self, value, /) | Return self<=value. | | __lt__(self, value, /) | Return self<value. | | __ne__(self, value, /) | Return self!=value. | | __repr__(self, /) | Return repr(self). | | __str__(self, /) | Return str(self). | | verify_file(...) | verify_file(filename: str) -> bool | | Verify that the file indicated by filename matches the hash. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | hashtype | The type of the hash, as a string (possible: MD5Sum,SHA1,SHA256). | | hashvalue | The value of the hash, as a hexadecimal string | | .. versionadded:: 1.9.0 | | usable | True if the hashstring is a trusted hash type. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None class HashStringList(builtins.object) | HashStringList() | | Manage a list of HashStrings. | | The list knows which hash is the best and provides convenience | methods for file verification. | | .. versionadded:: 1.1 | | Methods defined here: | | __getitem__(self, key, /) | Return self[key]. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __len__(self, /) | Return len(self). | | append(...) | append(object: HashString) | | Append the given HashString to this list. | | find(...) | find(type: str = "") -> HashString | | Find a hash of the given type, or the best one, if the argument | is empty or not specified. | | verify_file(...) | verify_file(filename: str) -> bool | | Verify that the file with the given name matches all hashes in | the list. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | file_size | If a file size is part of the list, return it, otherwise 0. | | usable | True if at least one safe/trusted hash is in the list. class Hashes(builtins.object) | Hashes([object: (bytes, file)]) | | Calculate hashes for the given object. It can be used to create all | supported hashes for a file. | | The parameter *object* can be a bytestring, an object providing the | fileno() method, or an integer describing a file descriptor. | | Methods defined here: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | hashes | A :class:`HashStringList` of all hashes. | | .. versionadded:: 1.1 class IndexFile(builtins.object) | Represent an index file, i.e. package indexes, translation indexes, | and source indexes. | | Methods defined here: | | __repr__(self, /) | Return repr(self). | | archive_uri(...) | archive_uri(path: str) -> str | | Return the URI to the given path in the archive. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | describe | A string describing the index file. | | exists | A boolean value determining whether the index file exists. | | has_packages | A boolean value determining whether the index file has packages. | | is_trusted | A boolean value determining whether the file can be trusted; e.g. | because it is from a source with a GPG signed Release file. | | label | The label of the index file. | | size | The size of the files, measured in bytes. class MetaIndex(builtins.object) | Provide information on meta-indexes (i.e. Release files), such as | whether they are trusted or their URI. | | Methods defined here: | | __repr__(self, /) | Return repr(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | dist | The distribution, as a string. | | index_files | A list of all IndexFile objects associated with this meta index. | | is_trusted | A boolean value determining whether the file can be trusted. | | uri | The uri the meta index is located at. class OrderList(builtins.object) | OrderList(depcache: DepCache) | | Sequence type for packages with special ordering methods. | | Methods defined here: | | __getitem__(self, key, /) | Return self[key]. | | __len__(self, /) | Return len(self). | | append(...) | append(pkg: Package) | | Append a package to the end of the list. | | flag(...) | flag(pkg: Package, flag: int[, unset_flags: int]) | | Flag the package, set flags in 'flag' and remove flags in | 'unset_flags'. | | is_flag(...) | is_flag(pkg: Package, flag: int) | | Check if the flag(s) are set. | | is_missing(...) | is_now(pkg: Package) | | Check if the package is marked for install. | | is_now(...) | is_now(pkg: Package) | | Check if the package is flagged for any state but removal. | | order_configure(...) | order_configure() | | Order the packages for configuration (see Debian Policy). | | order_critical(...) | order_critical() | | Order by PreDepends only (critical unpack order). | | order_unpack(...) | order_unpack() | | Order the packages for unpacking (see Debian Policy). | | score(...) | score(pkg: Package) -> int | | Return the score of the package. | | wipe_flags(...) | wipe_flags(flags: int) | | Remove the flags in 'flags' from all packages in this list | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | FLAG_ADDED = 1 | | FLAG_ADD_PENDIG = 2 | | FLAG_AFTER = 256 | | FLAG_CONFIGURED = 32 | | FLAG_IMMEDIATE = 4 | | FLAG_IN_LIST = 128 | | FLAG_LOOP = 8 | | FLAG_REMOVED = 64 | | FLAG_STATES_MASK = 112 | | FLAG_UNPACKED = 16 class Package(builtins.object) | Represent a package. A package is uniquely identified by its name | and each package can have zero or more versions which can be | accessed via the version_list property. Packages can be installed | and removed by apt_pkg.DepCache. | | Methods defined here: | | __repr__(self, /) | Return repr(self). | | get_fullname(...) | get_fullname([pretty: bool = False]) -> str | | Get the full name of the package, including the architecture. If | 'pretty' is True, the architecture is omitted for native packages, | that is, and amd64 apt package on an amd64 system would give 'apt'. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | architecture | The architecture of the package. | | current_state | The current state, which can be compared against the constants | CURSTATE_CONFIG_FILES, CURSTATE_HALF_CONFIGURED, | CURSTATE_HALF_INSTALLED, CURSTATE_INSTALLED, CURSTATE_NOT_INSTALLED, | CURSTATE_UNPACKED of the apt_pkg module. | | current_ver | The version of the package currently installed or None. | | essential | Boolean value determining whether the package is essential. | | has_provides | Whether the package is provided by at least one other package. | | has_versions | Whether the package has at least one version in the cache. | | id | The numeric ID of the package | | important | Boolean value determining whether the package has the 'important' | flag set ('Important: yes' in the Packages file). No longer used. | | inst_state | The state of the install, which be compared against the constants | INSTSTATE_HOLD, INSTSTATE_HOLD_REINSTREQ, INSTSTATE_OK, | INSTSTATE_REINSTREQ of the apt_pkg module. | | name | The name of the package. | | provides_list | A list of all packages providing this package. The list contains | tuples in the format (providesname, providesver, version) | where 'version' is an apt_pkg.Version object. | | rev_depends_list | An apt_pkg.DependencyList object of all reverse dependencies. | | selected_state | The state of the selection, which can be compared against the constants | SELSTATE_DEINSTALL, SELSTATE_HOLD, SELSTATE_INSTALL, SELSTATE_PURGE, | SELSTATE_UNKNOWN of the apt_pkg module. | | version_list | A list of all apt_pkg.Version objects for this package. class PackageFile(builtins.object) | A package file is an index file stored in the cache with some | additional pieces of information. | | Methods defined here: | | __repr__(self, /) | Return repr(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | architecture | The architecture of the package file. Unused, empty string nowadays. | | archive | The archive of the package file (i.e. 'Suite' in the Release file). | | codename | The codename of this package file (e.g. squeeze-updates). | | component | The component of this package file (e.g. 'main'). | | filename | The path to the file. | | id | The numeric ID of this PackageFile object. | | index_type | A string describing the type of index. Known values are | 'Debian Package Index', 'Debian Translation Index', and | 'Debian dpkg status file'. | | label | The label set in the release file (e.g. 'Debian'). | | not_automatic | Whether the NotAutomatic flag is set in the Release file. | | not_source | Whether this package file lacks an active (sources.list) source;packages listed in such a file cannot be downloaded. | | origin | The origin set in the release file. | | site | The hostname of the location this file comes from. | | size | The size of the file. | | version | The version set in the release file (e.g. '5.0.X' for lenny, where X | is a point release). class PackageList(builtins.object) | A PackageList is an internally used structure to represent | the 'packages' attribute of apt_pkg.Cache objects in a more | efficient manner by creating Package objects only when they | are accessed. | | Methods defined here: | | __getitem__(self, key, /) | Return self[key]. | | __len__(self, /) | Return len(self). class PackageManager(_PackageManager) | PackageManager(depcache: apt_pkg.DepCache) | | PackageManager objects allow the fetching of packages marked for | installation and the installation of those packages. The parameter | 'depcache' specifies an apt_pkg.DepCache object where information | about the package selections is retrieved from. | | Methods in this class can be overridden in sub classes | to implement behavior different from APT's dpkg implementation. | | Method resolution order: | PackageManager | _PackageManager | builtins.object | | Methods defined here: | | configure(...) | configure(pkg: Package) -> bool | | Add a configure action. Can be overridden in subclasses. | | New in version 0.8.0. | | go(...) | go(status_fd: int) -> bool | | Start dpkg. Can be overridden in subclasses. | | New in version 0.8.0. | | install(...) | install(pkg: Package, filename: str) -> bool | | Add a install action. Can be overridden in subclasses. | | New in version 0.8.0. | | remove(...) | remove(pkg: Package, purge: bool) -> bool | | Add a removal action. Can be overridden in subclasses. | | New in version 0.8.0. | | reset(...) | reset() | | Reset the package manager for a new round. | Can be overridden in subclasses. | | New in version 0.8.0. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from _PackageManager: | | do_install(...) | do_install(status_fd: int) -> int | | Install the packages and return one of the class constants | RESULT_COMPLETED, RESULT_FAILED, RESULT_INCOMPLETE. The argument | status_fd can be used to specify a file descriptor that APT will | write status information on (see README.progress-reporting in the | apt source code for information on what will be written there). | | fix_missing(...) | fix_missing() -> bool | | Fix the installation if a package could not be downloaded. | | get_archives(...) | get_archives(fetcher: Acquire, list: SourceList, recs: PackageRecords) -> bool | | Download the packages marked for installation via the Acquire object | 'fetcher', using the information found in 'list' and 'recs'. | | ---------------------------------------------------------------------- | Data and other attributes inherited from _PackageManager: | | RESULT_COMPLETED = 0 | | RESULT_FAILED = 1 | | RESULT_INCOMPLETE = 2 class PackageRecords(builtins.object) | PackageRecords(cache: apt_pkg.Cache) | | Package Records contain information about packages. Those objects | can be used to retrieve information such as maintainer or filename | of a package. They can also be used to retrieve the raw records | of the packages (i.e. those stanzas stored in Packages files). | | Methods defined here: | | __contains__(self, key, /) | Return key in self. | | __getitem__(self, key, /) | Return self[key]. | | lookup(...) | lookup((packagefile: apt_pkg.PackageFile, index: int)) -> bool | | Changes to a new package | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | filename | The filename of the package, as stored in the 'Filename' field. | | hashes | The hashes of the packages, as a HashStringList | | homepage | The homepage of the package, as stored in the 'Homepage' field. | | long_desc | The long description of the packages; i.e. all lines in the | 'Description' field except for the first one. | | maintainer | The maintainer of the package, as stored in the 'Maintainer' field. | | md5_hash | The MD5 hash value of the package, as stored in the 'MD5Sum' field. | | name | The name of the package, as stored in the 'Package' field. | | record | The raw record, suitable for parsing by apt_pkg.TagSection. | | sha1_hash | The SHA1 hash value, as stored in the 'SHA1' field. | | sha256_hash | The SHA256 hash value, as stored in the 'SHA256' field. | | short_desc | The short description of the package, i.e. the first line of the | 'Description' field. | | source_pkg | The name of the source package, if different from the name of the | binary package. This information is retrieved from the 'Source' field. | | source_ver | The version of the source package, if it differs from the version | of the binary package. Just like 'source_pkg', this information | is retrieved from the 'Source' field. class Policy(builtins.object) | Policy(cache) | | Representation of the policy of the Cache object given by cache. This | provides a superset of policy-related functionality compared to the | DepCache class. The DepCache can be used for most purposes, but there | may be some cases where a special policy class is needed. | | Methods defined here: | | create_pin(...) | create_pin(type: str, pkg: str, data: str, priority: int) | | Create a pin for the policy. The parameter 'type' refers to one of the | strings 'Version', 'Release', or 'Origin'. The argument 'pkg' is the | name of the package. The parameter 'data' refers to the value | (e.g. 'unstable' for type='Release') and the other possible options. | The parameter 'priority' gives the priority of the pin. | | get_candidate_ver(...) | get_match(package: apt_pkg.Package) -> Optional[apt_pkg.Version] | | Get the best package for the job. | | get_priority(...) | get_priority(package: Union[apt_pkg.Package, apt_pkg.Version, apt_pkg.PackageFile]) -> int | | Return the priority of the package. | | init_defaults(...) | init_defaults() | | Initialize defaults. Needed after calling :meth:`create_pin()` | with an empty `pkg` argument | | read_pindir(...) | read_pindir(dirname: str) -> bool | | Read the pin files in the given dir (e.g. '/etc/apt/preferences.d') | and add them to the policy. | | read_pinfile(...) | read_pinfile(filename: str) -> bool | | Read the pin file given by filename (e.g. '/etc/apt/preferences') | and add it to the policy. | | set_priority(...) | set_priority(which: Union[apt_pkg.Version, apt_pkg.PackageFile], priority: int) -> None | | Override priority for the given package/file. Behavior is undefined ifa preferences file is read after that, or :meth:`init_defaults` is called. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class ProblemResolver(builtins.object) | ProblemResolver(depcache: apt_pkg.DepCache) | | ProblemResolver objects take care of resolving problems | with dependencies. They mark packages for installation/ | removal and try to satisfy all dependencies. | | Methods defined here: | | clear(...) | clear(pkg: apt_pkg.Package) | | Revert the actions done by protect()/remove() on the package. | | protect(...) | protect(pkg: apt_pkg.Package) | | Mark the package as protected in the resolver, meaning that its | state will not be changed. | | remove(...) | remove(pkg: apt_pkg.Package) | | Mark the package for removal in the resolver. | | resolve(...) | resolve([fix_broken: bool = True]) -> bool | | Try to intelligently resolve problems by installing and removing | packages. If 'fix_broken' is True, apt will try to repair broken | dependencies of installed packages. | | resolve_by_keep(...) | resolve_by_keep() -> bool | | Try to resolve problems only by using keep. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class SourceList(builtins.object) | SourceList() | | Represent the list of sources stored in /etc/apt/sources.list and | similar files. | | Methods defined here: | | find_index(...) | find_index(pkgfile: apt_pkg.PackageFile) -> apt_pkg.IndexFile | | Return the index file for the given package file, or None if none | could be found. | | get_indexes(...) | get_indexes(acquire: apt_pkg.Acquire[, all: bool=False]) -> bool | | Add all indexes (i.e. stuff like Release files, Packages files) | to the Acquire object 'acquire'. If 'all' is True, all indexes | will be added, otherwise only changed indexes will be added. | | read_main_list(...) | read_main_list() -> bool | | Read /etc/apt/sources.list and similar files to populate the list | of indexes. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | list | A list of MetaIndex() objects. class SourceRecordFiles(builtins.object) | SourceRecordFile() | | Provide an easy way to look up the src records of a source package. | | Methods defined here: | | __getitem__(self, key, /) | Return self[key]. | | __len__(self, /) | Return len(self). | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | hashes | The hashes of the source package file. | | path | The remote path of the source package file. | | size | The size of the source package file. | | type | The type of the source package file. class SourceRecords(builtins.object) | SourceRecords() | | Provide an easy way to look up the records of source packages and | provide easy attributes for some widely used fields of the record. | | Methods defined here: | | lookup(...) | lookup(name: str) -> bool | | Look up the source package with the given name. Each call moves | the position of the records parser forward. If there are no | more records, return None. If the lookup failed this way, | access to any of the attributes will result in an AttributeError. | | restart(...) | restart() | | Restart the lookup process. This moves the parser to the first | package and lookups can now be made just like on a new object. | | step(...) | step() -> bool | | Go to the source package. Each call moves | the position of the records parser forward. If there are no | more records, return None. If the lookup failed this way, | access to any of the attributes will result in an AttributeError. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | binaries | A list of the names of the binaries produced by this source package. | | build_depends | A dictionary describing the build-time dependencies of the package; | the format is the same as used for apt_pkg.Version.depends_list_str. | | files | A list of :class:`SourceRecordFiles` objects. | | index | The index file associated with this record as a list of | apt_pkg.IndexFile objects. | | maintainer | The maintainer of the package. | | package | The name of the source package. | | record | The raw record, suitable for parsing using apt_pkg.TagSection. | | section | The section of the source package. | | version | The version of the source package. class SystemLock(builtins.object) | SystemLock() | | Context manager for locking the package system. The lock is established | as soon as the method __enter__() is called. It is released when | __exit__() is called. | | This should be used via the 'with' statement, for example: | | with apt_pkg.SystemLock(): | ... | | Once the block is left, the lock is released automatically. The object | can be used multiple times: | | lock = apt_pkg.SystemLock() | with lock: | ... | with lock: | ... | | Methods defined here: | | __enter__(...) | Lock the system. | | __exit__(...) | Unlock the system. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class Tag(builtins.object) | Tag | | Identify actions to be executed on a task | | This is used in conjunction with :meth:`TagSection.write` to rewrite | a tag section into a new one. | | This class is abstract, use one of the subclasses: | :class:`TagRewrite`, :class:`TagRemove`, :class:`TagRename` | | .. versionadded:: 1.1 | | Data descriptors defined here: | | action | The action to perform. | | data | The data to write instead (for REWRITE), or the new tag name (RENAME) | | name | The name of the tag to perform the action on. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | REMOVE = 0 | | RENAME = 1 | | REWRITE = 2 class TagFile(builtins.object) | TagFile(file, [bytes: bool = False]) | | TagFile() objects provide access to debian control files, which consist | of multiple RFC822-style sections. | | To provide access to those sections, TagFile objects provide an iterator | which yields TagSection objects for each section. | | TagFile objects also provide another API which uses a shared TagSection | object in the 'section' member. The functions step() and jump() can be | used to navigate within the file; offset() returns the current | position. | | It is important to not mix the use of both APIs, because this can have | unwanted effects. | | The parameter 'file' refers to an object providing a fileno() method or | a file descriptor (an integer). | | By default, text read from files is treated as strings (binary data in | Python 2, Unicode strings in Python 3). Use bytes=True to cause all | header values read from this TagFile to be bytes even in Python 3. | Header names are always treated as Unicode. | | Methods defined here: | | __enter__(...) | Context manager entry, return self. | | __exit__(...) | Context manager exit, calls close. | | __iter__(self, /) | Implement iter(self). | | __next__(self, /) | Implement next(self). | | close(...) | close() | | Close the file. | | jump(...) | jump(offset: int) -> bool | | Jump to the given offset; return True on success. Note that jumping to | an offset is not very reliable, and the 'section' attribute may point | to an unexpected section. | | offset(...) | offset() -> int | | Return the current offset. | | step(...) | step() -> bool | | Step forward in the file | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | section | The current section, as a TagSection object. class TagRemove(Tag) | TagRemove(name: str) | | Remove the tag *name* from the tag section | | .. versionadded:: 1.1 | | Method resolution order: | TagRemove | Tag | builtins.object | | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from Tag: | | action | The action to perform. | | data | The data to write instead (for REWRITE), or the new tag name (RENAME) | | name | The name of the tag to perform the action on. | | ---------------------------------------------------------------------- | Data and other attributes inherited from Tag: | | REMOVE = 0 | | RENAME = 1 | | REWRITE = 2 class TagRename(Tag) | TagRename(old_name: str, new_name: str) | | Rename the tag *old_name* to *new_name* | | .. versionadded:: 1.1 | | Method resolution order: | TagRename | Tag | builtins.object | | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from Tag: | | action | The action to perform. | | data | The data to write instead (for REWRITE), or the new tag name (RENAME) | | name | The name of the tag to perform the action on. | | ---------------------------------------------------------------------- | Data and other attributes inherited from Tag: | | REMOVE = 0 | | RENAME = 1 | | REWRITE = 2 class TagRewrite(Tag) | TagRewrite(name: str, data: str) | | Change the value of the tag to the string passed in *data* | | .. versionadded:: 1.1 | | Method resolution order: | TagRewrite | Tag | builtins.object | | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from Tag: | | action | The action to perform. | | data | The data to write instead (for REWRITE), or the new tag name (RENAME) | | name | The name of the tag to perform the action on. | | ---------------------------------------------------------------------- | Data and other attributes inherited from Tag: | | REMOVE = 0 | | RENAME = 1 | | REWRITE = 2 class TagSection(builtins.object) | TagSection(text: str, [bytes: bool = False]) | | Provide methods to access RFC822-style header sections, like those | found in debian/control or Packages files. | | TagSection() behave like read-only dictionaries and also provide access | to the functions provided by the C++ class (e.g. find). | | By default, text read from files is treated as strings (binary data in | Python 2, Unicode strings in Python 3). Use bytes=True to cause all | header values read from this TagSection to be bytes even in Python 3. | Header names are always treated as Unicode. | | Methods defined here: | | __contains__(self, key, /) | Return key in self. | | __getitem__(self, key, /) | Return self[key]. | | __len__(self, /) | Return len(self). | | __str__(self, /) | Return str(self). | | bytes(...) | bytes() -> int | | Return the number of bytes this section is large. | | find(...) | find(name: str[, default = None]) -> str | | Find the key given by 'name' and return the value. If the key can | not be found, return 'default'. | | find_flag(...) | find_flag(name: str) -> int | | Return 1 if the key's value is 'yes' or a similar value describing | a boolean true. If the field does not exist, or does not have such a | value, return 0. | | find_raw(...) | find_raw(name: str[, default = None] -> str | | Same as find(), but returns the complete 'key: value' field; instead of | just the value. | | get(...) | find(name: str[, default = None]) -> str | | Find the key given by 'name' and return the value. If the key can | not be found, return 'default'. | | keys(...) | keys() -> list | | Return a list of all keys. | | write(...) | write(file: int, order: List[str], rewrite: List[Tag]) -> None | | Rewrites the section into the given file descriptor, which should be | a file descriptor or an object providing a fileno() method. | | .. versionadded:: 1.9.0 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. class Version(builtins.object) | Version Object | | Methods defined here: | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __gt__(self, value, /) | Return self>value. | | __le__(self, value, /) | Return self<=value. | | __lt__(self, value, /) | Return self<value. | | __ne__(self, value, /) | Return self!=value. | | __repr__(self, /) | Return repr(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | arch | The architecture of this specific version of the package. | | depends_list | A dictionary mapping dependency types to lists (A) of lists (B) of | apt_pkg.Dependency objects. The lists (B) represent or dependencies | like 'a || b'. | | depends_list_str | Same as depends_list, except that the apt_pkg.Dependency objects | are 3-tuples of the form (name, version, operator); where operator | is one of '<', '<=', '=', '>=', '>'. | | downloadable | Whether the version can be downloaded. | | file_list | A list of tuples (packagefile: apt_pkg.PackageFile, index: int) for the | PackageFile objects related to this package. The index can be used | to retrieve the record of this package version. | | hash | The numeric hash of the version used in the internal storage. | | id | The numeric ID of the package. | | installed_size | The installed size of this package version. | | multi_arch | Multi-arch state of this package, as an integer. See | the various MULTI_ARCH_* members. | | parent_pkg | The parent package of this version. | | priority | The priority of the package as an integer, which can be compared to | the constants PRI_EXTRA, PRI_IMPORTANT, PRI_OPTIONAL, PRI_REQUIRED, | PRI_STANDARD of the apt_pkg module. | | priority_str | The priority of the package, as a string. | | provides_list | A list of all packages provided by this version. The list contains | tuples in the format (providesname, providesver, version) | where 'version' is an apt_pkg.Version object. | | section | The section of this package version. | | size | The size of the package file. | | translated_description | An apt_pkg.Description object for the translated description if | available or the untranslated fallback. | | ver_str | The version string. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | MULTI_ARCH_ALL = 1 | | MULTI_ARCH_ALLOWED = 8 | | MULTI_ARCH_ALL_ALLOWED = 9 | | MULTI_ARCH_ALL_FOREIGN = 3 | | MULTI_ARCH_FOREIGN = 2 | | MULTI_ARCH_NO = 0 | | MULTI_ARCH_NONE = 0 | | MULTI_ARCH_SAME = 4 | | __hash__ = None FUNCTIONS base64_encode(...) base64_encode(value: bytes) -> str Encode the given bytestring into Base64. The input may not contain a null byte character (use the base64 module for this). check_dep(...) check_dep(pkg_ver: str, dep_op: str, dep_ver: str) -> bool Check that the given requirement is fulfilled; i.e. that the version string given by 'pkg_ver' matches the version string 'dep_ver' under the condition specified by the operator 'dep_op' (<,<=,=,>=,>). Return True if 'pkg_ver' matches 'dep_ver' under the condition 'dep_op'; for example, this returns True: apt_pkg.check_dep('1', '<=', '2') check_domain_list(...) check_domain_list(host: str, domains: str) -> bool Check if the host given by 'host' belongs to one of the domains specified in the comma separated string 'domains'. An example would be: check_domain_list('alioth.debian.org','debian.net,debian.org') which would return True because alioth belongs to debian.org. dequote_string(...) dequote_string(string: str) -> str Dequote the given string by replacing all HTTP encoded values such as '%20' with their decoded value (in this case, ' '). get_architectures(...) get_architectures() -> list Return the list of supported architectures on this system. On a multiarch system this can be more than one. The main architectures is the first item in the list. get_lock(...) get_lock(file: str, errors: bool) -> int Create an empty file of the given name and lock it. If the locking succeeds, return the file descriptor of the lock file. Afterwards, locking the file from another process will fail and thus cause get_lock() to return -1 or raise an Error (if 'errors' is True). From Python 2.6 on, it is recommended to use the context manager provided by apt_pkg.FileLock instead using the with-statement. gettext(...) gettext(msg: str[, domain: str = 'python-apt']) -> str Translate the given string. This is much faster than Python's version and only does translations after setlocale() has been called. init(...) init() Shorthand for doing init_config() and init_system(). When working with command line arguments, first call init_config() then parse the command line and finally call init_system(). init_config(...) init_config() Load the default configuration and the config file. init_system(...) init_system() Construct the apt_pkg system. md5sum(...) md5sum(object) -> str Return the md5sum of the object. 'object' may either be a string, in which case the md5sum of the string is returned, or a file() object (or file descriptor), in which case the md5sum of its contents is returned. open_maybe_clear_signed_file(...) open_maybe_clear_signed_file(file: str) -> int Open a file and ignore a PGP clear signature. Return a open file descriptor or a error. parse_commandline(...) parse_commandLine(config: Configuration, options: list, argv: list) -> list Parse the command line in 'argv' into the configuration space. The list 'options' contains a list of 3-tuples or 4-tuples in the form: (short_option: str, long_option: str, variable: str[, type: str]) The element 'short_option' is one character, the 'long_option' element is the name of the long option, the element 'variable' the name of the configuration option the result will be stored in and type is one of 'HasArg', 'IntLevel', 'Boolean', 'InvBoolean', 'ConfigFile', 'ArbItem'. The default type is 'Boolean'. Read the online documentation in python-apt-doc and its tutorial on writing an apt-cdrom clone for more details. parse_depends(...) parse_depends(s: str[, strip_multi_arch : bool = True[, architecture : string]]) -> list Parse the dependencies given by 's' and return a list of lists. Each of these lists represents one or more options for an 'or' dependency in the form of '(pkg, ver, comptype)' tuples. The tuple element 'pkg' is the name of the package; the element 'ver' is the version, or '' if no version was requested. The element 'ver' is a comparison operator ('<', '<=', '=', '>=', or '>'). If 'strip_multi_arch' is True, :any (and potentially other special values) will be stripped from the full package nameThe 'architecture' parameter may be used to specify a non-native architecture for the dependency parsing. parse_src_depends(...) parse_src_depends(s: str[, strip_multi_arch : bool = True[, architecture : string]]) -> list Parse the dependencies given by 's' and return a list of lists. Each of these lists represents one or more options for an 'or' dependency in the form of '(pkg, ver, comptype)' tuples. The tuple element 'pkg' is the name of the package; the element 'ver' is the version, or '' if no version was requested. The element 'ver' is a comparison operator ('<', '<=', '=', '>=', or '>'). Dependencies may be restricted to certain architectures and the result only contains those dependencies for the architecture set in the configuration variable APT::Architecture If 'strip_multi_arch' is True, :any (and potentially other special values) will be stripped from the full package nameThe 'architecture' parameter may be used to specify a non-native architecture for the dependency parsing. pkgsystem_is_locked(...) pkgsystem_is_locked() -> bool Check if the system is locked. Can be used to check whether the inner lock needs to be released or not in generic code. .. versionadded:: 1.7 pkgsystem_lock(...) pkgsystem_lock() -> bool Acquire the global lock for the package system by using /var/lib/dpkg/lock-frontend and /var/lib/dpkg/lock to do the locking. From Python 2.6 on, the apt_pkg.SystemLock context manager is available and should be used instead. pkgsystem_lock_inner(...) pkgsystem_lock_inner() -> bool Reacquire the dpkg 'lock' lock file. Must be called only after :meth:`pkgsystem_unlock_inner` and only around invocations of dpkg. .. versionadded:: 1.7 pkgsystem_unlock(...) pkgsystem_unlock() -> bool Release the global lock for the package system. pkgsystem_unlock_inner(...) pkgsystem_unlock_inner() -> bool Release the dpkg lock file 'lock'. To be called before manually invoking dpkg. .. versionadded:: 1.7 quote_string(...) quote_string(string: str, repl: str) -> str Escape the string 'string', replacing any character not allowed in a URLor specified by 'repl' with its ASCII value preceded by a percent sign(so for example ' ' becomes '%20'). read_config_dir(...) read_config_dir(configuration: apt_pkg.Configuration, dirname: str) Read all configuration files in the dir given by 'dirname' in the correct order. read_config_file(...) read_config_file(configuration: apt_pkg.Configuration, filename: str) Read the configuration file 'filename' and set the appropriate options in the configuration object. read_config_file_isc(...) read_config_file(configuration: apt_pkg.Configuration, filename: str) Read the configuration file 'filename' and set the appropriate options in the configuration object. sha1sum(...) sha1sum(object) -> str Return the sha1sum of the object. 'object' may either be a string, in which case the sha1sum of the string is returned, or a file() object (or file descriptor), in which case the sha1sum of its contents is returned. sha256sum(...) sha256sum(object) -> str Return the sha256sum of the object. 'object' may either be a string, in which case the sha256sum of the string is returned, or a file() object (or file descriptor), in which case the sha256sum of its contents is returned. sha512sum(...) sha512sum(object) -> str Return the sha512sum of the object. 'object' may either be a string, in which case the sha512sum of the string is returned, or a file() object (or file descriptor), in which case the sha512sum of its contents is returned. size_to_str(...) size_to_str(bytes: int) -> str Return a string describing the size in a human-readable manner using SI prefix and base-10 units, e.g. '1k' for 1000, '1M' for 1000000, etc. str_to_time(...) str_to_time(rfc_time: str) -> int Convert the given RFC 1123 formatted string to a Unix timestamp. string_to_bool(...) string_to_bool(string: str) -> int Return 1 if the string is a value such as 'yes', 'true', '1'; 0 if the string is a value such as 'no', 'false', '0'; -1 if the string is not recognized. time_rfc1123(...) time_rfc1123(unixtime: int) -> str Format the given Unix time according to the requirements of RFC 1123. time_to_str(...) time_to_str(seconds: int) -> str Return a string describing the number of seconds in a human readable manner using days, hours, minutes and seconds. upstream_version(...) upstream_version(ver: str) -> str Return the upstream version for the package version given by 'ver'. uri_to_filename(...) uri_to_filename(uri: str) -> str Return a filename based on the given URI after replacing some parts not suited for filenames (e.g. '/'). version_compare(...) version_compare(a: str, b: str) -> int Compare the given versions; return a strictly negative value if 'a' is smaller than 'b', 0 if they are equal, and a strictly positive value if 'a' is larger than 'b'. DATA CURSTATE_CONFIG_FILES = 5 CURSTATE_HALF_CONFIGURED = 2 CURSTATE_HALF_INSTALLED = 4 CURSTATE_INSTALLED = 6 CURSTATE_NOT_INSTALLED = 0 CURSTATE_UNPACKED = 1 DATE = 'Dec 5 2025' INSTSTATE_HOLD = 2 INSTSTATE_HOLD_REINSTREQ = 3 INSTSTATE_OK = 0 INSTSTATE_REINSTREQ = 1 LIB_VERSION = '6.0.0' PRI_EXTRA = 5 PRI_IMPORTANT = 2 PRI_OPTIONAL = 4 PRI_REQUIRED = 1 PRI_STANDARD = 3 REWRITE_PACKAGE_ORDER = ['Package', 'Package-Type', 'Architecture', 'S... REWRITE_SOURCE_ORDER = ['Package', 'Source', 'Format', 'Binary', 'Arch... SELSTATE_DEINSTALL = 3 SELSTATE_HOLD = 2 SELSTATE_INSTALL = 1 SELSTATE_PURGE = 4 SELSTATE_UNKNOWN = 0 TIME = '17:18:12' VERSION = '2.4.14' config = <apt_pkg.Configuration object> FILE /usr/lib/python3/dist-packages/apt_pkg.cpython-310-x86_64-linux-gnu.so
Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 05:14 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)