def _print(msgtype, pkg, reason, details): global _badness_score threshold = badnessThreshold() badness = 0 if threshold >= 0: badness = Config.badness(reason) # anything with badness is an error if badness: msgtype = 'E' # errors without badness become warnings elif msgtype == 'E': msgtype = 'W' ln = "" if pkg.current_linenum is not None: ln = "%s:" % pkg.current_linenum arch = "" if pkg.arch is not None: arch = ".%s" % pkg.arch s = "%s%s:%s %s: %s" % (pkg.name, arch, ln, msgtype, reason) if badness: s = s + " (Badness: %d)" % badness for d in details: s = s + " %s" % d if Testing and Testing.isTest(): Testing.addOutput(s) else: if _rawout: print(s.encode(locale.getpreferredencoding(), "replace"), file=_rawout) if not Config.isFiltered(s): printed_messages[msgtype] += 1 _badness_score += badness if threshold >= 0: _diagnostic.append(s + "\n") else: __print(s) if Config.info: printDescriptions(reason) return True return False