###############################################################################
import configparser
-import io
import logging
import os
-import socket
log = logging.getLogger("pakfire.config")
log.propagate = 1
from .constants import *
-from .i18n import _
class Config(object):
def __init__(self, *files):
def get_bool(self, section, option, default=None):
return self._config.getboolean(section, option, fallback=default)
- def dump(self):
- """
- Dump the configuration that was read
-
- (Only in debugging mode)
- """
- log.debug(_("Configuration:"))
-
- for section in self._config.sections():
- log.debug(" " + _("Section: %s") % section)
-
- for option in self._config[section]:
- value = self.get(section, option)
-
- log.debug(" %-20s: %s" % (option, value))
-
- def get_repos(self):
- repos = []
- for section in self._config.sections():
- if not section.startswith("repo:"):
- continue
-
- name = section[5:]
-
- repo = self._config.items(section)
- repos.append((name, dict(repo)))
-
- return repos
-
# Read initial configuration
config = Config("general.conf")