How to use the pyalpm.LOG_WARNING function in pyalpm

To help you get started, we’ve selected a few pyalpm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Antergos / Cnchi / src / pacman / pac.py View on Github external
def cb_log(self, level, line):
        """ Log pyalpm warning and error messages.
            Possible message types:
            LOG_ERROR, LOG_WARNING, LOG_DEBUG, LOG_FUNCTION """

        # Strip ending '\n'
        line = line.rstrip()

        # Log everything to cnchi-alpm.log
        self.logger.debug(line)

        logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING

        if not level & logmask:
            # Only log errors and warnings
            return

        if level & pyalpm.LOG_ERROR:
            logging.error(line)
        elif level & pyalpm.LOG_WARNING:
            logging.warning(line)
        elif level & pyalpm.LOG_DEBUG or level & pyalpm.LOG_FUNCTION:
            logging.debug(line)
github Antergos / Cnchi / src / pacman / original / transaction.py View on Github external
else :
			progress_label.set_text(' ')
	if ID is 27:
		progress_label.set_text('Downloading '+format_size(total_size))
		print('Downloading a file')
	if ID is 17:
		progress_label.set_text('Checking signatures')
		print('Checking signatures')
	progress_bar.set_fraction(0.0)
	progress_bar.set_text('')
	print(ID,event)

def cb_conv(*args):
	print("conversation", args)

_logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING

def cb_log(level, line):
	#global t
	#try:
	#	_line = str(_line, encoding='utf-8').strip("\n")
	#except:
	#	_line = str(_line, encoding='latin-1').strip("\n")
	if not (level & _logmask):
		return
	if level & pyalpm.LOG_ERROR:
		ErrorDialog.format_secondary_text("ERROR: "+line)
		response = ErrorDialog.run()
		if response:
			ErrorDialog.hide()
			#t.release()
	elif level & pyalpm.LOG_WARNING:
github manjaro / thus / src / pacman / pac.py View on Github external
def cb_log(self, level, line):
        # Only manage error and warning messages
        _logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING

        if not (level & _logmask):
            return

        if level & pyalpm.LOG_ERROR or level & pyalpm.LOG_WARNING:
            # Even if there is a real error we're not sure we want to abort all installation
            # Instead of issuing a fatal error we just log an error message
            logging.error(line)
        
        '''
        if level & pyalpm.LOG_ERROR:
github archlinux / pyalpm / pycman / config.py View on Github external
def cb_log(level, line):
	if not (level & _logmask):
		return
	if level & pyalpm.LOG_ERROR:
		line = "ERROR: " + line
	elif level & pyalpm.LOG_WARNING:
		line = "WARNING: " + line
	elif level & pyalpm.LOG_DEBUG:
		line = "DEBUG: " + line
	elif level & pyalpm.LOG_FUNCTION:
		line = "FUNC: " + line
	sys.stderr.write(line)
github Antergos / Cnchi / cnchi / pacman / pac.py View on Github external
if "error 31 from alpm_db_get_pkg" in line:
            # It's ok not to show this error because we search the package
            # in all repos, and obviously it will only be in one of them,
            # throwing errors when searching in the other ones
            return

        if "command failed to execute correctly" in line:
            # We get this warning sometimes (I think it's when Cnchi installs
            # the kernel package). It seems to be harmless, we'll log it as
            # a debug message instead of an error message
            logging.debug(line)
            return

        if level & pyalpm.LOG_ERROR == pyalpm.LOG_ERROR:
            logging.error(line)
        elif level & pyalpm.LOG_WARNING == pyalpm.LOG_WARNING:
            # Alpm outputs non-english log messages so we can't target certain
            # useless warnings. I think most of the warnings are useless anyway.
            # We can revisit this later if need be.
            logging.debug(line)
        elif level & pyalpm.LOG_DEBUG == pyalpm.LOG_DEBUG:
            # There are a lot of "extracting" messages (not very useful), so we
            # do not log them.
            if " error " in line and "error 0" not in line:
                logging.debug(line)
            elif "extracting" not in line and "extract: skipping dir extraction" not in line:
                logging.debug(line)