/usr/share/pyshared/aptdaemon/enums.py is in python-aptdaemon 0.43+bzr805-0ubuntu10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""enums - Enumerates for apt daemon dbus messages"""
# Copyright (C) 2008-2009 Sebastian Heinlein <devel@glatzor.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
__author__ = "Sebastian Heinlein <devel@glatzor.de>"
import gettext
def _(msg):
return gettext.dgettext("aptdaemon", msg)
__all__ = ("PKGS_INSTALL", "PKGS_REINSTALL", "PKGS_REMOVE", "PKGS_PURGE",
"PKGS_UPGRADE", "PKGS_DOWNGRADE", "PKGS_KEEP",
"EXIT_SUCCESS", "EXIT_CANCELLED", "EXIT_FAILED", "EXIT_UNFINISHED",
"ERROR_PACKAGE_DOWNLOAD_FAILED", "ERROR_REPO_DOWNLOAD_FAILED",
"ERROR_DEP_RESOLUTION_FAILED",
"ERROR_KEY_NOT_INSTALLED", "ERROR_KEY_NOT_REMOVED", "ERROR_NO_LOCK",
"ERROR_NO_CACHE", "ERROR_NO_PACKAGE", "ERROR_PACKAGE_UPTODATE",
"ERROR_PACKAGE_NOT_INSTALLED", "ERROR_PACKAGE_ALREADY_INSTALLED",
"ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE", "ERROR_DAEMON_DIED",
"ERROR_PACKAGE_MANAGER_FAILED", "ERROR_CACHE_BROKEN",
"ERROR_PACKAGE_UNAUTHENTICATED", "ERROR_INCOMPLETE_INSTALL",
"ERROR_UNREADABLE_PACKAGE_FILE", "ERROR_INVALID_PACKAGE_FILE",
"ERROR_SYSTEM_ALREADY_UPTODATE", "ERROR_NOT_SUPPORTED",
"ERROR_LICENSE_KEY_INSTALL_FAILED",
"ERROR_LICENSE_KEY_DOWNLOAD_FAILED",
"ERROR_UNKNOWN",
"STATUS_SETTING_UP", "STATUS_WAITING", "STATUS_WAITING_MEDIUM",
"STATUS_WAITING_CONFIG_FILE_PROMPT", "STATUS_WAITING_LOCK",
"STATUS_RUNNING", "STATUS_LOADING_CACHE", "STATUS_DOWNLOADING",
"STATUS_COMMITTING", "STATUS_CLEANING_UP", "STATUS_RESOLVING_DEP",
"STATUS_FINISHED", "STATUS_CANCELLING", "STATUS_QUERY",
"STATUS_DOWNLOADING_REPO",
"ROLE_UNSET", "ROLE_INSTALL_PACKAGES", "ROLE_INSTALL_FILE",
"ROLE_UPGRADE_PACKAGES", "ROLE_UPGRADE_SYSTEM", "ROLE_UPDATE_CACHE",
"ROLE_REMOVE_PACKAGES", "ROLE_COMMIT_PACKAGES",
"ROLE_ADD_VENDOR_KEY_FILE", "ROLE_ADD_VENDOR_KEY_FROM_KEYSERVER",
"ROLE_REMOVE_VENDOR_KEY", "ROLE_FIX_INCOMPLETE_INSTALL",
"ROLE_FIX_BROKEN_DEPENDS", "ROLE_ADD_REPOSITORY",
"ROLE_ENABLE_DISTRO_COMP", "ROLE_CLEAN", "ROLE_RECONFIGURE",
"ROLE_PK_QUERY", "ROLE_ADD_LICENSE_KEY",
"DOWNLOAD_DONE", "DOWNLOAD_AUTH_ERROR", "DOWNLOAD_ERROR",
"DOWNLOAD_FETCHING", "DOWNLOAD_IDLE", "DOWNLOAD_NETWORK_ERROR",
"PKG_INSTALLING", "PKG_CONFIGURING", "PKG_REMOVING",
"PKG_PURGING", "PKG_UPGRADING", "PKG_RUNNING_TRIGGER",
"PKG_DISAPPEARING", "PKG_PREPARING_REMOVE", "PKG_PREPARING_INSTALL",
"PKG_PREPARING_PURGE", "PKG_PREPARING_PURGE", "PKG_INSTALLED",
"PKG_REMOVED", "PKG_PURGED", "PKG_UNPACKING", "PKG_UNKNOWN",
"get_status_icon_name_from_enum", "get_role_icon_name_from_enum",
"get_status_animation_name_from_enum",
"get_package_status_from_enum",
"get_role_localised_past_from_enum", "get_exit_string_from_enum",
"get_role_localised_present_from_enum", "get_role_error_from_enum",
"get_error_description_from_enum", "get_error_string_from_enum",
"get_status_string_from_enum", "get_download_status_from_enum")
# PACKAGE GROUP INDEXES
#: Index of the list of to be installed packages in the :attr:`dependencies`
#: and :attr:`packages` property of :class:`~aptdaemon.client.AptTransaction`.
PKGS_INSTALL = 0
#: Index of the list of to be re-installed packages in the :attr:`dependencies`
#: and :attr:`packages` property of :class:`~aptdaemon.client.AptTransaction`.
PKGS_REINSTALL = 1
#: Index of the list of to be removed packages in the :attr:`dependencies`
#: and :attr:`packages` property of :class:`~aptdaemon.client.AptTransaction`.
PKGS_REMOVE = 2
#: Index of the list of to be purged packages in the :attr:`dependencies`
#: and :attr:`packages` property of :class:`~aptdaemon.client.AptTransaction`.
PKGS_PURGE = 3
#: Index of the list of to be upgraded packages in the :attr:`dependencies`
#: and :attr:`packages` property of :class:`~aptdaemon.client.AptTransaction`.
PKGS_UPGRADE = 4
#: Index of the list of to be downgraded packages in the :attr:`dependencies`
#: and :attr:`packages` property of :class:`~aptdaemon.client.AptTransaction`.
PKGS_DOWNGRADE = 5
#: Index of the list of to be keept packages in the :attr:`dependencies`
#: property of :class:`~aptdaemon.client.AptTransaction`.
PKGS_KEEP = 6
# FINISH STATES
#: The transaction was successful.
EXIT_SUCCESS = "exit-success"
#: The transaction has been cancelled by the user.
EXIT_CANCELLED = "exit-cancelled"
#: The transaction has failed.
EXIT_FAILED = "exit-failed"
#: The transaction failed since a previous one in a chain failed.
EXIT_PREVIOUS_FAILED = "exit-previous-failed"
#: The transaction is still being queued or processed.
EXIT_UNFINISHED = "exit-unfinished"
# ERROR CODES
#: Failed to download package files which should be installed.
ERROR_PACKAGE_DOWNLOAD_FAILED = "error-package-download-failed"
#: Failed to download package information (index files) from the repositories
ERROR_REPO_DOWNLOAD_FAILED = "error-repo-download-failed"
#: Failed to satisfy the dependencies or conflicts of packages.
ERROR_DEP_RESOLUTION_FAILED = "error-dep-resolution-failed"
#: The requested vendor key is not installed.
ERROR_KEY_NOT_INSTALLED = "error-key-not-installed"
#: The requested vendor could not be removed.
ERROR_KEY_NOT_REMOVED = "error-key-not-removed"
#: The package management system could not be locked. Eventually another
#: package manager is running.
ERROR_NO_LOCK = "error-no-lock"
#: The package cache could not be opened. This indicates a serious problem
#: on the system.
ERROR_NO_CACHE = "error-no-cache"
#: The requested package is not available.
ERROR_NO_PACKAGE = "error-no-package"
#: The package could not be upgraded since it is already up-to-date.
ERROR_PACKAGE_UPTODATE = "error-package-uptodate"
#: The package which was requested to install is already installed.
ERROR_PACKAGE_ALREADY_INSTALLED = "error-package-already-installed"
#: The package could not be removed since it is not installed.
ERROR_PACKAGE_NOT_INSTALLED = "error-package-not-installed"
#: It is not allowed to remove an essential system package.
ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE = "error-not-remove-essential"
#: The aptdaemon crashed or could not be connected to on the D-Bus.
ERROR_DAEMON_DIED = "error-daemon-died"
#: On of the maintainer scripts during the dpkg call failed.
ERROR_PACKAGE_MANAGER_FAILED = "error-package-manager-failed"
#: There are packages with broken dependencies installed on the system.
#: This has to fixed before performing another transaction.
ERROR_CACHE_BROKEN = "error-cache-broken"
#: It is not allowed to install an unauthenticated packages. Packages are
#: authenticated by installing the vendor key.
ERROR_PACKAGE_UNAUTHENTICATED = "error-package-unauthenticated"
#: A previous installation has been aborted and is now incomplete.
#: Should be fixed by `dpkg --configure -a` or the :func:`FixIncomplete()`
#: transaction.
ERROR_INCOMPLETE_INSTALL = "error-incomplete-install"
#: Failed to open and read the package file
ERROR_UNREADABLE_PACKAGE_FILE = "error-unreadable-package-file"
#: The package file violates the Debian/Ubuntu policy
ERROR_INVALID_PACKAGE_FILE = "error-invalid-package-file"
#: The requested feature is not supported yet (mainly used by PackageKit
ERROR_NOT_SUPPORTED = "error-not-supported"
#: The license key download failed
ERROR_LICENSE_KEY_DOWNLOAD_FAILED = "error-license-key-download-failed"
#: The license key is invalid
ERROR_LICENSE_KEY_INSTALL_FAILED = "error-license-key-install-failed"
#: The system is already up-to-date and don't needs any upgrades
ERROR_SYSTEM_ALREADY_UPTODATE = "error-system-already-uptodate"
#: An unknown error occured. In most cases these are programming ones.
ERROR_UNKNOWN = "error-unknown"
# TRANSACTION STATES
#: The transaction was created, but hasn't been queued.
STATUS_SETTING_UP = "status-setting-up"
#: The transaction performs a query
STATUS_QUERY = "status-query"
#: The transaction is waiting in the queue.
STATUS_WAITING = "status-waiting"
#: The transaction is paused and waits until a required medium is inserted.
#: See :func:`ProvideMedium()`.
STATUS_WAITING_MEDIUM = "status-waiting-medium"
#: The transaction is paused and waits for the user to resolve a configuration
#: file conflict. See :func:`ResolveConfigFileConflict()`.
STATUS_WAITING_CONFIG_FILE_PROMPT = "status-waiting-config-file-prompt"
#: Wait until the package management system can be locked. Most likely
#: another package manager is running currently.
STATUS_WAITING_LOCK = "status-waiting-lock"
#: The processing of the transaction has started.
STATUS_RUNNING = "status-running"
#: The package cache is opened.
STATUS_LOADING_CACHE = "status-loading-cache"
#: The information about available packages is downloaded
STATUS_DOWNLOADING_REPO = "status-downloading-repo"
#: The required package files to install are getting downloaded.
STATUS_DOWNLOADING = "status-downloading"
#: The actual installation/removal takes place.
STATUS_COMMITTING = "status-committing"
#: The package management system is cleaned up.
STATUS_CLEANING_UP = "status-cleaning-up"
#: The dependecies and conflicts are now getting resolved.
STATUS_RESOLVING_DEP = "status-resolving-dep"
#: The transaction has been completed.
STATUS_FINISHED = "status-finished"
#: The transaction has been cancelled.
STATUS_CANCELLING = "status-cancelling"
#: The transaction waits for authentication
STATUS_AUTHENTICATING = "status-authenticating"
# PACKAGE STATES
#: The package gets unpacked
PKG_UNPACKING = "pkg-unpacking"
#: The installation of the package gets prepared
PKG_PREPARING_INSTALL = "pkg-preparing-install"
#: The package is installed
PKG_INSTALLED = "pkg-installed"
#: The package gets installed
PKG_INSTALLING = "pkg-installing"
#: The configuration of the package gets prepared
PKG_PREPARING_CONFIGURE = "pkg-preparing-configure"
#: The package gets configured
PKG_CONFIGURING = "pkg-configuring"
#: The removal of the package gets prepared
PKG_PREPARING_REMOVE = "pkg-preparing-removal"
#: The package gets removed
PKG_REMOVING = "pkg-removing"
#: The package is removed
PKG_REMOVED = "pkg-removed"
#: The purging of the package gets prepared
PKG_PREPARING_PURGE = "pkg-preparing-purge"
#: The package gets purged
PKG_PURGING = "pkg-purging"
#: The package was completely removed
PKG_PURGED = "pkg-purged"
#: The post installation trigger of the package is processed
PKG_RUNNING_TRIGGER = "pkg-running-trigger"
#: The package disappered - very rare
PKG_DISAPPEARING = "pkg-disappearing"
#: The package gets upgraded
PKG_UPGRADING = "pkg-upgrading"
#: Failed to get a current status of the package
PKG_UNKNOWN = "pkg-unknown"
# TRANSACTION ROLES
#: The role of the transaction has not been specified yet.
ROLE_UNSET = "role-unset"
#: The transaction performs a query compatible to the PackageKit interface
ROLE_PK_QUERY = "role-pk-query"
#: The transaction will install one or more packages.
ROLE_INSTALL_PACKAGES = "role-install-packages"
#: The transaction will install a local package file.
ROLE_INSTALL_FILE = "role-install-file"
#: The transaction will upgrade one or more packages.
ROLE_UPGRADE_PACKAGES = "role-upgrade-packages"
#: The transaction will perform a system upgrade.
ROLE_UPGRADE_SYSTEM = "role-upgrade-system"
#: The transaction will update the package cache.
ROLE_UPDATE_CACHE = "role-update-cache"
#: The transaction will remove one or more packages.
ROLE_REMOVE_PACKAGES = "role-remove-packages"
#: The transaction will perform a combined install, remove, upgrade or
#: downgrade action.
ROLE_COMMIT_PACKAGES = "role-commit-packages"
#: The transaction will add a local vendor key file to authenticate packages.
ROLE_ADD_VENDOR_KEY_FILE = "role-add-vendor-key-file"
#: The transaction will download vendor key to authenticate packages from
#: a keyserver.
ROLE_ADD_VENDOR_KEY_FROM_KEYSERVER = "role-add-vendor-key-from-keyserver"
#: The transaction will remove a vendor key which was used to authenticate
#: packages.
ROLE_REMOVE_VENDOR_KEY = "role-remove-vendor-key"
#: The transaction will try to finish a previous aborted installation.
ROLE_FIX_INCOMPLETE_INSTALL = "role-fix-incomplete-install"
#: The transaction will to resolve broken dependencies of already installed
#: packages.
ROLE_FIX_BROKEN_DEPENDS = "role-fix-broken-depends"
#: The transaction will enable a repository to download software from.
ROLE_ADD_REPOSITORY = "role-add-repository"
#: The transaction will enable a component in the distro repositories,
#: e.g main or universe
ROLE_ENABLE_DISTRO_COMP = "role-enable-distro-comp"
#: The transaction will reconfigure the given already installed packages
ROLE_RECONFIGURE = "role-reconfigure"
#: The transaction will remove all downloaded package files.
ROLE_CLEAN = "role-clean"
#: The transaction will add a license key to the system
ROLE_ADD_LICENSE_KEY = "role-add-license-key"
# DOWNLOAD STATES
#: The download has been completed.
DOWNLOAD_DONE = "download-done"
#: The file could not be downloaded since the authentication for the repository
#: failed.
DOWNLOAD_AUTH_ERROR = "download-auth-error"
#: There file could not be downloaded, e.g. because it is not available (404).
DOWNLOAD_ERROR = "download-error"
#: The file is currently being downloaded.
DOWNLOAD_FETCHING = "download-fetching"
#: The download is currently idling.
DOWNLOAD_IDLE = "download-idle"
#: The download failed since there seem to be a networking problem.
DOWNLOAD_NETWORK_ERROR = "download-network-error"
_ICONS_STATUS = {
STATUS_CANCELLING: 'aptdaemon-cleanup',
STATUS_CLEANING_UP: 'aptdaemon-cleanup',
STATUS_RESOLVING_DEP: 'aptdaemon-resolve',
STATUS_COMMITTING: 'aptdaemon-working',
STATUS_DOWNLOADING: 'aptdaemon-download',
STATUS_DOWNLOADING_REPO: 'aptdaemon-download',
STATUS_FINISHED: 'aptdaemon-cleanup',
STATUS_LOADING_CACHE: 'aptdaemon-update-cache',
STATUS_RUNNING: 'aptdaemon-working',
STATUS_SETTING_UP: 'aptdaemon-working',
STATUS_WAITING: 'aptdaemon-wait',
STATUS_WAITING_LOCK: 'aptdaemon-wait',
STATUS_WAITING_MEDIUM: 'aptdaemon-wait',
STATUS_WAITING_CONFIG_FILE_PROMPT: 'aptdaemon-wait',
}
def get_status_icon_name_from_enum(enum):
"""Get the icon name for a transaction status.
:param enum: The transaction status enum, e.g. :data:`STATUS_WAITING`.
:returns: The icon name string.
"""
try:
return _ICONS_STATUS[enum]
except KeyError:
return "aptdaemon-working"
_ICONS_ROLE = {
ROLE_INSTALL_FILE: 'aptdaemon-add',
ROLE_INSTALL_PACKAGES: 'aptdaemon-add',
ROLE_UPDATE_CACHE: 'aptdaemon-update-cache',
ROLE_REMOVE_PACKAGES: 'aptdaemon-delete',
ROLE_UPGRADE_PACKAGES: 'aptdaemon-upgrade',
ROLE_UPGRADE_SYSTEM: 'system-software-update',
}
def get_role_icon_name_from_enum(enum):
"""Get an icon to represent the role of a transaction.
:param enum: The transaction role enum, e.g. :data:`ROLE_UPDATE_CACHE`.
:returns: The icon name string.
"""
try:
return _ICONS_ROLE[enum]
except KeyError:
return "aptdaemon-working"
_ANIMATIONS_STATUS = {
STATUS_CANCELLING: 'aptdaemon-action-cleaning-up',
STATUS_CLEANING_UP: 'aptdaemon-action-cleaning-up',
STATUS_RESOLVING_DEP: 'aptdaemon-action-resolving',
STATUS_DOWNLOADING: 'aptdaemon-action-downloading',
STATUS_DOWNLOADING_REPO: 'aptdaemon-action-downloading',
STATUS_LOADING_CACHE: 'aptdaemon-action-updating-cache',
STATUS_WAITING: 'aptdaemon-action-waiting',
STATUS_WAITING_LOCK: 'aptdaemon-action-waiting',
STATUS_WAITING_MEDIUM: 'aptdaemon-action-waiting',
STATUS_WAITING_CONFIG_FILE_PROMPT: 'aptdaemon-action-waiting',
}
def get_status_animation_name_from_enum(enum):
"""Get an animation to represent a transaction status.
:param enum: The transaction status enum, e.g. :data:`STATUS_WAITING`.
:returns: The animation name string.
"""
try:
return _ANIMATIONS_STATUS[enum]
except KeyError:
return None
_PAST_ROLE = {
ROLE_INSTALL_FILE : _("Installed file"),
ROLE_INSTALL_PACKAGES : _("Installed packages"),
ROLE_ADD_VENDOR_KEY_FILE: _("Added key from file"),
ROLE_UPDATE_CACHE : _("Updated cache"),
ROLE_PK_QUERY : _("Search done"),
ROLE_REMOVE_VENDOR_KEY : _("Removed trusted key"),
ROLE_REMOVE_PACKAGES : _("Removed packages"),
ROLE_UPGRADE_PACKAGES : _("Updated packages"),
ROLE_UPGRADE_SYSTEM : _("Upgraded system"),
ROLE_COMMIT_PACKAGES : _("Applied changes"),
ROLE_FIX_INCOMPLETE_INSTALL : _("Repaired incomplete installation"),
ROLE_FIX_BROKEN_DEPENDS: _("Repaired broken dependencies"),
ROLE_ADD_REPOSITORY: _("Added software source"),
ROLE_ENABLE_DISTRO_COMP: _("Enabled component of the distribution"),
ROLE_CLEAN: _("Removed downloaded package files"),
ROLE_RECONFIGURE: _("Reconfigured installed packages"),
ROLE_UNSET: ""
}
def get_role_localised_past_from_enum(enum):
"""Get the description of a completed transaction action.
:param enum: The transaction role enum, e.g. :data:`ROLE_UPDATE_CACHE`.
:returns: The description string.
"""
try:
return _PAST_ROLE[enum]
except KeyError:
return None
_STRING_EXIT = {
EXIT_SUCCESS : _("Successful"),
EXIT_CANCELLED : _("Canceled"),
EXIT_FAILED : _("Failed")
}
def get_exit_string_from_enum(enum):
"""Get the description of a transaction exit status.
:param enum: The transaction exit status enum, e.g. :data:`EXIT_FAILED`.
:returns: The description string.
"""
try:
return _STRING_EXIT[enum]
except:
return None
_PRESENT_ROLE = {
ROLE_INSTALL_FILE : _("Installing file"),
ROLE_INSTALL_PACKAGES : _("Installing packages"),
ROLE_ADD_VENDOR_KEY_FILE : _("Adding key from file"),
ROLE_UPDATE_CACHE : _("Updating cache"),
ROLE_REMOVE_VENDOR_KEY : _("Removing trusted key"),
ROLE_REMOVE_PACKAGES : _("Removing packages"),
ROLE_UPGRADE_PACKAGES : _("Updating packages"),
ROLE_UPGRADE_SYSTEM : _("Upgrading system"),
ROLE_COMMIT_PACKAGES : _("Applying changes"),
ROLE_FIX_INCOMPLETE_INSTALL : _("Repairing incomplete installation"),
ROLE_FIX_BROKEN_DEPENDS: _("Repairing installed software"),
ROLE_ADD_REPOSITORY: _("Adding software source"),
ROLE_ENABLE_DISTRO_COMP: _("Enabling component of the distribution"),
ROLE_CLEAN: _("Removing downloaded package files"),
ROLE_RECONFIGURE: _("Reconfiguring installed packages"),
ROLE_PK_QUERY : _("Searching"),
ROLE_UNSET : ""
}
def get_role_localised_present_from_enum(enum):
"""Get the description of a present transaction action.
:param enum: The transaction role enum, e.g. :data:`ROLE_UPDATE_CACHE`.
:returns: The description string.
"""
try:
return _PRESENT_ROLE[enum]
except KeyError:
return None
_ERROR_ROLE = {
ROLE_INSTALL_FILE: _("Installation of the package file failed"),
ROLE_INSTALL_PACKAGES: _("Installation of software failed"),
ROLE_ADD_VENDOR_KEY_FILE: _("Adding the key to the list of trused "
"software vendors failed"),
ROLE_UPDATE_CACHE: _("Refreshing the software list failed"),
ROLE_REMOVE_VENDOR_KEY: _("Removing the vendor from the list of trusted "
"ones failed"),
ROLE_REMOVE_PACKAGES: _("Removing software failed"),
ROLE_UPGRADE_PACKAGES: _("Updating software failed"),
ROLE_UPGRADE_SYSTEM: _("Upgrading the system failed"),
ROLE_COMMIT_PACKAGES: _("Applying software changes failed"),
ROLE_FIX_INCOMPLETE_INSTALL: _("Repairing incomplete installation failed"),
ROLE_FIX_BROKEN_DEPENDS: _("Repairing broken dependencies failed"),
ROLE_ADD_REPOSITORY: _("Adding software source failed"),
ROLE_ENABLE_DISTRO_COMP: _("Enabling component of the distribution failed"),
ROLE_CLEAN: _("Removing downloaded package files failed"),
ROLE_RECONFIGURE: _("Removing downloaded package files failed"),
ROLE_PK_QUERY: _("Search failed"),
ROLE_ADD_LICENSE_KEY: _("Adding license key"),
ROLE_UNSET: ""
}
def get_role_error_from_enum(enum):
"""Get the description of a failed transaction action.
:param enum: The transaction role enum, e.g. :data:`ROLE_UPDATE_CACHE`.
:returns: The description string.
"""
try:
return _ERROR_ROLE[enum]
except KeyError:
return None
_DESCS_ERROR = {
ERROR_PACKAGE_DOWNLOAD_FAILED : _("Check your Internet connection."),
ERROR_REPO_DOWNLOAD_FAILED : _("Check your Internet connection."),
ERROR_CACHE_BROKEN : _("Check if you are using third party "
"repositories. If so disable them, since "
"they are a common source of problems.\n"
"Furthermore run the following command in a "
"Terminal: apt-get install -f"),
ERROR_KEY_NOT_INSTALLED : _("The selected file may not be a GPG key file "
"or it might be corrupt."),
ERROR_KEY_NOT_REMOVED : _("The selected key couldn't be removed. "
"Check that you provided a valid fingerprint."),
ERROR_NO_LOCK : _("Check if you are currently running another "
"software management tool, e.g. Synaptic or aptitude. "
"Only one tool is allowed to make changes at a time."),
ERROR_NO_CACHE : _("This is a serious problem. Try again later. If this "
"problem appears again, please report an error to the "
"developers."),
ERROR_NO_PACKAGE : _("Check the spelling of the package name, and "
"that the appropriate repository is enabled."),
ERROR_PACKAGE_UPTODATE : _("There isn't any need for an update."),
ERROR_PACKAGE_ALREADY_INSTALLED : _("There isn't any need for an "
"installation"),
ERROR_PACKAGE_NOT_INSTALLED : _("There isn't any need for a removal."),
ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE : _("You requested to remove a package "
"which is an essential part of your "
"system."),
ERROR_DAEMON_DIED : _("The connection to the daemon was lost. Most likely "
"the background daemon crashed."),
ERROR_PACKAGE_MANAGER_FAILED: _("The installation or removal of a software "
"package failed."),
ERROR_NOT_SUPPORTED: _("The requested feature is not supported."),
ERROR_UNKNOWN : _("There seems to be a programming error in aptdaemon, "
"the software that allows you to install/remove "
"software and to perform other package management "
"related tasks."),
ERROR_DEP_RESOLUTION_FAILED: _("This error could be caused by required "
"additional software packages which are "
"missing or not installable. Furthermore "
"there could be a conflict between software "
"packages which are not allowed to be "
"installed at the same time."),
ERROR_PACKAGE_UNAUTHENTICATED: _("The action would require the "
"installation of packages from not "
"authenticated sources."),
ERROR_INCOMPLETE_INSTALL: _("The installation could have failed because "
"of an error in the corresponding software "
"package or it was cancelled in an unfriendly "
"way. "
"You have to repair this before you can "
"install or remove any further software."),
ERROR_UNREADABLE_PACKAGE_FILE: _("Please copy the file to your local "
"computer and check the file "
"permissions."),
ERROR_INVALID_PACKAGE_FILE: _("The installation of a package which "
"violates the quality standards isn't "
"allowed. This could cause serious problems "
"on your computer. Please contact the person "
"or organisation who provided this package "
"file and include the details beneath."),
ERROR_LICENSE_KEY_INSTALL_FAILED: _("The downloaded license key which is "
"required to run this piece of "
"software is not valid or could not "
"be installed correctly.\n"
"See the details for more "
"information."),
ERROR_SYSTEM_ALREADY_UPTODATE: _("All available upgrades have already "
"been installed."),
ERROR_LICENSE_KEY_DOWNLOAD_FAILED: _("The license key which allows you to "
"use this piece of software could not be "
"downloaded. Please check your "
"network connection."),
}
def get_error_description_from_enum(enum):
"""Get a long description of an error.
:param enum: The transaction error enum, e.g. :data:`ERROR_NO_LOCK`.
:returns: The description string.
"""
try:
return _DESCS_ERROR[enum]
except KeyError:
return None
_STRINGS_ERROR = {
ERROR_PACKAGE_DOWNLOAD_FAILED : _("Failed to download package files"),
ERROR_REPO_DOWNLOAD_FAILED : _("Failed to download repository information"),
ERROR_DEP_RESOLUTION_FAILED : _("Package dependencies cannot be resolved"),
ERROR_CACHE_BROKEN : _("The package system is broken"),
ERROR_KEY_NOT_INSTALLED : _("Key was not installed"),
ERROR_KEY_NOT_REMOVED: _("Key was not removed"),
ERROR_NO_LOCK : _("Failed to lock the package manager"),
ERROR_NO_CACHE : _("Failed to load the package list"),
ERROR_NO_PACKAGE : _("Package does not exist"),
ERROR_PACKAGE_UPTODATE : _("Package is already up to date"),
ERROR_PACKAGE_ALREADY_INSTALLED : _("Package is already installed"),
ERROR_PACKAGE_NOT_INSTALLED : _("Package isn't installed"),
ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE : _("Failed to remove essential "
"system package"),
ERROR_DAEMON_DIED : _("Task cannot be monitored or controlled"),
ERROR_PACKAGE_MANAGER_FAILED: _("Package operation failed"),
ERROR_PACKAGE_UNAUTHENTICATED: _("Requires installation of untrusted "
"packages"),
ERROR_INCOMPLETE_INSTALL: _("Previous installation hasn't been completed"),
ERROR_INVALID_PACKAGE_FILE: _("The package is of bad quality"),
ERROR_UNREADABLE_PACKAGE_FILE: _("Package file could not be opened"),
ERROR_NOT_SUPPORTED: _("Not supported feature"),
ERROR_LICENSE_KEY_DOWNLOAD_FAILED: _("Failed to download the license key"),
ERROR_LICENSE_KEY_INSTALL_FAILED: _("Failed to install the license key"),
ERROR_SYSTEM_ALREADY_UPTODATE: _("The system is already up to date"),
ERROR_UNKNOWN : _("An unhandlable error occured")
}
def get_error_string_from_enum(enum):
"""Get a short description of an error.
:param enum: The transaction error enum, e.g. :data:`ERROR_NO_LOCK`.
:returns: The description string.
"""
try:
return _STRINGS_ERROR[enum]
except KeyError:
return None
_STRINGS_STATUS = {
STATUS_SETTING_UP : _("Waiting for service to start"),
STATUS_QUERY : _("Searching"),
STATUS_WAITING : _("Waiting"),
STATUS_WAITING_MEDIUM : _("Waiting for required medium"),
STATUS_WAITING_LOCK : _("Waiting for other software managers to quit"),
STATUS_WAITING_CONFIG_FILE_PROMPT : _("Waiting for configuration file "
"prompt"),
STATUS_RUNNING : _("Running task"),
STATUS_DOWNLOADING : _("Downloading"),
STATUS_DOWNLOADING_REPO : _("Querying software sources"),
STATUS_CLEANING_UP : _("Cleaning up"),
STATUS_RESOLVING_DEP : _("Resolving dependencies"),
STATUS_COMMITTING : _("Applying changes"),
STATUS_FINISHED : _("Finished"),
STATUS_CANCELLING : _("Cancelling"),
STATUS_LOADING_CACHE : _("Loading software list"),
STATUS_AUTHENTICATING : _("Waiting for authentication"),
}
def get_status_string_from_enum(enum):
"""Get the description of a transaction status.
:param enum: The transaction status enum, e.g. :data:`STATUS_WAITING`.
:returns: The description string.
"""
try:
return _STRINGS_STATUS[enum]
except KeyError:
return None
STRINGS_PKG_STATUS = {
#TRANSLATORS: %s is the name of a package
PKG_INSTALLING: _("Installing %s"),
#TRANSLATORS: %s is the name of a package
PKG_CONFIGURING: _( "Configuring %s"),
#TRANSLATORS: %s is the name of a package
PKG_REMOVING: _( "Removing %s"),
#TRANSLATORS: %s is the name of a package
PKG_PURGING: _( "Completely removing %s"),
#TRANSLATORS: %s is the name of a package
PKG_PURGING: _( "Noting disappearance of %s"),
#TRANSLATORS: %s is the name of a package
PKG_RUNNING_TRIGGER: _("Running post-installation trigger %s"),
#TRANSLATORS: %s is the name of a package
PKG_UPGRADING: _("Upgrading %s"),
#TRANSLATORS: %s is the name of a package
PKG_UNPACKING: _("Unpacking %s"),
#TRANSLATORS: %s is the name of a package
PKG_PREPARING_INSTALL: _("Preparing installation of %s"),
#TRANSLATORS: %s is the name of a package
PKG_PREPARING_CONFIGURE: _("Preparing configuration of %s"),
#TRANSLATORS: %s is the name of a package
PKG_PREPARING_REMOVE: _("Preparing removal of %s"),
#TRANSLATORS: %s is the name of a package
PKG_PREPARING_PURGE: _("Preparing complete removal of %s"),
#TRANSLATORS: %s is the name of a package
PKG_INSTALLED: _("Installed %s"),
#TRANSLATORS: %s is the name of a package
PKG_PURGED: _("Completely removed %s"),
#TRANSLATORS: %s is the name of a package
PKG_REMOVED: _("Removed %s"),
}
def get_package_status_from_enum(enum):
"""Get the description of a package status.
:param enum: The download status enum, e.g. :data:`PKG_INSTALLING`.
:returns: The description string.
"""
try:
return STRINGS_PKG_STATUS[enum]
except KeyError:
return _("Processing %s")
STRINGS_DOWNLOAD = {
DOWNLOAD_DONE: _("Done"),
DOWNLOAD_AUTH_ERROR: _("Authentication failed"),
DOWNLOAD_ERROR: _("Failed"),
DOWNLOAD_FETCHING: _("Fetching"),
DOWNLOAD_IDLE: _("Idle"),
DOWNLOAD_NETWORK_ERROR: _("Network isn't available"),
}
def get_download_status_from_enum(enum):
"""Get the description of a download status.
:param enum: The download status enum, e.g. :data:`DOWNLOAD_DONE`.
:returns: The description string.
"""
try:
return STRINGS_DOWNLOAD[enum]
except KeyError:
return None
# vim:ts=4:sw=4:et
|