Update Manager API: python-apt Backend module

python-apt backend

Interface implementations

These classes implement the backend interface.

class UpdateManager.Backend.PythonApt.PythonAptBackend(application)

python-apt backend implementation.

abort_operation()

Aborts a fetch operation.

acquire_lock()

Tries to acquire package manager lock.

Returns:True of lock has been acquired, False otherwise.
commit(selected_updates, commit_progress_handler, fork_func=<built-in function fork>)

Downloads and installs the updates selected.

Parameters:
  • selected_updates – List of PackageInfo objects
  • commit_progress_handlerUpdateManager.Backend.CommitHandlerBase object
  • fork_func – Function used for forking. Defaults to os.fork.
download_package_lists(list_progress_handler)

Reloads the package list(s).

get_available_updates(dist_upgrade=True)

Returns a list containing UpdateManager.Backend.PackageInfoBase objects of available updates.

Parameters:dist_upgrade – Defines whether to do a dist upgrade or not.
is_locked(by_us=False)

Checks if the package manager lock is held.

Parameters:by_us – Defines whether to check if anyone holds the lock or if we hold the lock ourselves (default: False).
Returns:Boolean indicating whether the lock is being held.
release_lock()

Releases package manager lock.

Returns:True if lock has been released, False otherwise.
reload_cache(cache_progress_handler)

Reloads the package cache.

class UpdateManager.Backend.PythonApt.PackageInfoStore(cache, *args, **kwargs)

Implementation of UpdateManager.Backend.PackageInfoStoreBase.

class UpdateManager.Backend.PythonApt.PackageDependency(cache, *args, **kwargs)

Implementation of UpdateManager.Backend.PackageDependencyBase.

class UpdateManager.Backend.PythonApt.PackageInfo(package_obj, app)

Implementation of UpdateManager.Backend.PackageInfoBase.

candidate_origin_is_trusted()

Returns true if the origin is trusted

get_candidate_archive_name()

Returns the archive name

get_candidate_component_name()

Returns the component name

get_candidate_origin_label()

Returns the origin label

get_candidate_origin_name()

Returns the origin name

get_candidate_uri()

Returns the candidate uri

get_candidate_version()

Returns the candidate version

get_conflicts()

Returns list of conflicting packages

get_dependencies()

Returns the list of dependencies

get_description()

Returns the package description

get_download_size()

Returns the download size in bytes

get_installed_version()

Returns the installed version

get_package_name()

Returns the package name

get_reverse_dependencies()

Returns list of reverse dependencies (packages that depend on this package).

get_source_package_name()

Returns the source package name

get_strict_dependencies()

Returns the list of strict dependencies (packages with an exact version this candidate depends on).

get_strict_reverse_dependencies()

Returns list of strict reverse dependencies (packages that depend on the candidate version of this package).

get_summary()

Returns the package summary (short description)

get_uninstalled_dependencies()

Returns a list of dependencies that are not installed.

get_update_category()

Returns the update category

is_broken()

Returns whether the package is broken or not

is_installed()

Returns whether the package is installed or not

Helper classes

These classes are pure helper classes and are unlikely to be useful outside this module.

class UpdateManager.Backend.PythonApt.CacheProgressHelper(handler)

Cache open progress helper.

STEPS = 5
update(percent=None)

Handles an update of the cache opening progress.

Parameters:percent – Percentage done
class UpdateManager.Backend.PythonApt.ListProgressHelper(handler)
abort()

Handles an abort notification from the UI

done(item)

Handle a completed item.

Parameters:item – An apt_pkg.AcquireItemDesc object describing the item.
fail(item)

Handle a failed item.

Parameters:item – An apt_pkg.AcquireItemDesc object describing the item.
fetch(item)

Handle the start of fetching an item.

Parameters:item – An apt_pkg.AcquireItemDesc object describing the item.
ims_hit(item)

Handle an already up-to-data item.

Parameters:item – An apt_pkg.AcquireItemDesc object describing the item.
pulse(owner)

Handles a pulse from python-apt

Parameters:items – Current items
class UpdateManager.Backend.PythonApt.DownloadProgressHelper(handler)

Download progress helper

abort()

Handles an abort notification from the UI

done(item)

Handle a completed item.

Parameters:item – An apt_pkg.AcquireItemDesc object describing the item.
fail(item)

Handle a failed item.

Parameters:item – An apt_pkg.AcquireItemDesc object describing the item.
fetch(item)

Handle a completed item.

Parameters:item – An apt_pkg.AcquireItemDesc object describing the item.
pulse(owner)

Handles a pulse from python-apt

Parameters:items – Current items
stop()

Stop handler. Sends out notifications when downloading has stopped (but was not aborted).

class UpdateManager.Backend.PythonApt.InstallProgressHelper(commit_handler, fork_func)

Install progress helper

conffile(current, new)

Config file question handling

Parameters:
  • current – Current config file name
  • new – New config file name
error(pkg, errormsg)

Error handling

Parameters:
  • pkg – Package name
  • errormsg – Error message
fork()

Fork handling.

This method uses the internal _fork_func variable to fork.

status_change(pkg, percent, status)

Status change handling

Parameters:
  • pkg – Package name
  • percent – Overall percentage done
  • status – Status string

Helper functions

UpdateManager.Backend.PythonApt._translate_relation(rel_string)

Helper function that translates a given relation string to a relation constant (UpdateManager.Backend.DEP_RELATION).

Constants

UpdateManager.Backend.PythonApt.FETCH_STATUS = <UpdateManager.Util.enum.Enum object at 0xa8f7b0c>

Enum:

DONE = 0

QUEUED = 1

FAILED = 2

HIT = 3

IGNORED = 4