8062fddc23
update_portage_tree() now: - watch stderr and stdout for each command - use layman command instead of layman API for sync because layman API doesn't work when stdout or stderr is not a real file (we could probably work around that with pipes and epoll) - use egencache instead of emerge to generate cache - export PORTAGE_CONFIGROOT, ROOT, EIX_CACHEFILE etc.. so they are used everywhere Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
33 lines
568 B
Python
33 lines
568 B
Python
|
|
class FakeLogger(object):
|
|
def __getattr__(self, key):
|
|
return lambda *x, **y: None
|
|
|
|
|
|
def set_verbosity_level(logger, verbosity):
|
|
import logging
|
|
|
|
try:
|
|
verbosity = int(verbosity)
|
|
except (ValueError, TypeError):
|
|
return logger
|
|
|
|
levels = {
|
|
0: logging.DEBUG,
|
|
1: logging.INFO,
|
|
2: logging.WARNING,
|
|
3: logging.ERROR,
|
|
4: logging.CRITICAL
|
|
}
|
|
|
|
if verbosity < 0:
|
|
verbosity = 0
|
|
|
|
if verbosity > 4:
|
|
verbosity = 4
|
|
|
|
logger.setLevel(levels[verbosity])
|
|
|
|
return logger
|
|
|