Blame dnf/callback.py

Packit 6f3914
# callbacks.py
Packit 6f3914
# Abstract interfaces to communicate progress on tasks.
Packit 6f3914
#
Packit 6f3914
# Copyright (C) 2014-2015  Red Hat, Inc.
Packit 6f3914
#
Packit 6f3914
# This copyrighted material is made available to anyone wishing to use,
Packit 6f3914
# modify, copy, or redistribute it subject to the terms and conditions of
Packit 6f3914
# the GNU General Public License v.2, or (at your option) any later version.
Packit 6f3914
# This program is distributed in the hope that it will be useful, but WITHOUT
Packit 6f3914
# ANY WARRANTY expressed or implied, including the implied warranties of
Packit 6f3914
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
Packit 6f3914
# Public License for more details.  You should have received a copy of the
Packit 6f3914
# GNU General Public License along with this program; if not, write to the
Packit 6f3914
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit 6f3914
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
Packit 6f3914
# source code or documentation are not subject to the GNU General Public
Packit 6f3914
# License and may only be used or replicated with the express permission of
Packit 6f3914
# Red Hat, Inc.
Packit 6f3914
#
Packit 6f3914
Packit 6f3914
from __future__ import unicode_literals
Packit 6f3914
import dnf.yum.rpmtrans
Packit 6f3914
Packit 6f3914
import dnf.transaction
Packit 6f3914
Packit 6f3914
PKG_DOWNGRADE = dnf.transaction.PKG_DOWNGRADE  # :api
Packit 6f3914
PKG_DOWNGRADED = dnf.transaction.PKG_DOWNGRADED  # :api
Packit 6f3914
PKG_INSTALL = dnf.transaction.PKG_INSTALL  # :api
Packit 6f3914
PKG_OBSOLETE = dnf.transaction.PKG_OBSOLETE  # :api
Packit 6f3914
PKG_OBSOLETED = dnf.transaction.PKG_OBSOLETED  # :api
Packit 6f3914
PKG_REINSTALL = dnf.transaction.PKG_REINSTALL  # :api
Packit 6f3914
PKG_REINSTALLED = dnf.transaction.PKG_REINSTALLED  # :api
Packit 6f3914
PKG_REMOVE = dnf.transaction.PKG_ERASE  # :api
Packit 6f3914
PKG_ERASE = PKG_REMOVE  # deprecated, use PKG_REMOVE instead
Packit 6f3914
PKG_UPGRADE = dnf.transaction.PKG_UPGRADE  # :api
Packit 6f3914
PKG_UPGRADED = dnf.transaction.PKG_UPGRADED  # :api
Packit 6f3914
Packit 6f3914
PKG_CLEANUP = dnf.transaction.PKG_CLEANUP  # :api
Packit 6f3914
PKG_VERIFY = dnf.transaction.PKG_VERIFY  # :api
Packit 6f3914
PKG_SCRIPTLET = dnf.transaction.PKG_SCRIPTLET  # :api
Packit 6f3914
Packit 6f3914
TRANS_PREPARATION = dnf.transaction.TRANS_PREPARATION  # :api
Packit 6f3914
TRANS_POST = dnf.transaction.TRANS_POST  # :api
Packit 6f3914
Packit 6f3914
STATUS_OK = None # :api
Packit 6f3914
STATUS_FAILED = 1 # :api
Packit 6f3914
STATUS_ALREADY_EXISTS = 2 # :api
Packit 6f3914
STATUS_MIRROR = 3  # :api
Packit 6f3914
STATUS_DRPM = 4    # :api
Packit 6f3914
Packit 6f3914
Packit 6f3914
class KeyImport(object):
Packit 6f3914
    def _confirm(self, id, userid, fingerprint, url, timestamp):
Packit 6f3914
        """Ask the user if the key should be imported."""
Packit 6f3914
        return False
Packit 6f3914
Packit 6f3914
Packit 6f3914
class Payload(object):
Packit 6f3914
    # :api
Packit 6f3914
Packit 6f3914
    def __init__(self, progress):
Packit 6f3914
        self.progress = progress
Packit 6f3914
Packit 6f3914
    def __str__(self):
Packit 6f3914
        """Nice, human-readable representation. :api"""
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
    @property
Packit 6f3914
    def download_size(self):
Packit 6f3914
        """Total size of the download. :api"""
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
Packit 6f3914
class DownloadProgress(object):
Packit 6f3914
    # :api
Packit 6f3914
Packit 6f3914
    def end(self, payload, status, msg):
Packit 6f3914
        """Communicate the information that `payload` has finished downloading.
Packit 6f3914
Packit 6f3914
        :api, `status` is a constant denoting the type of outcome, `err_msg` is an
Packit 6f3914
        error message in case the outcome was an error.
Packit 6f3914
Packit 6f3914
        """
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
    def message(self, msg):
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
    def progress(self, payload, done):
Packit 6f3914
        """Update the progress display. :api
Packit 6f3914
Packit 6f3914
        `payload` is the payload this call reports progress for, `done` is how
Packit 6f3914
        many bytes of this payload are already downloaded.
Packit 6f3914
Packit 6f3914
        """
Packit 6f3914
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
    def start(self, total_files, total_size, total_drpms=0):
Packit 6f3914
        """Start new progress metering. :api
Packit 6f3914
Packit 6f3914
        `total_files` the number of files that will be downloaded,
Packit 6f3914
        `total_size` total size of all files.
Packit 6f3914
Packit 6f3914
        """
Packit 6f3914
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
Packit 6f3914
class NullDownloadProgress(DownloadProgress):
Packit 6f3914
    pass
Packit 6f3914
Packit 6f3914
Packit 6f3914
class Depsolve(object):
Packit 6f3914
    def start(self):
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
    def pkg_added(self, pkg, mode):
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
    def end(self):
Packit 6f3914
        pass
Packit 6f3914
Packit 6f3914
Packit 6f3914
TransactionProgress = dnf.yum.rpmtrans.TransactionDisplay  # :api