# Own modules
from . import __version__ as __pkg_version__
+from . import CFGFILE_BASENAME
from fb_tools.common import pp
from .xlate import __mo_file__ as __xlate_mo_file__
from .xlate import XLATOR, LOCALE_DIR, DOMAIN
-__version__ = '1.0.4'
+__version__ = '1.0.5'
LOG = logging.getLogger(__name__)
SIGNAL_NAMES = {
self.yaml_file = None
self.config = None
self.handler = None
+ self._cfg_dir = None
self._cfg_file = None
desc = _(
description=desc, terminal_has_colors=terminal_has_colors, initialized=False,
)
+ # -------------------------------------------------------------------------
+ @property
+ def cfg_dir(self):
+ """Directory of the configuration file."""
+ return self._cfg_dir
+
# -------------------------------------------------------------------------
@property
def cfg_file(self):
self.init_logging()
+ self._cfg_dir = self.base_dir.joinpath('etc')
+ self._cfg_file = self.cfg_dir.joinpath(CFGFILE_BASENAME)
+
self.perform_arg_parser()
+ if not self.cfg_file.exists():
+ default_conf_file = self.cfg_dir.joinpath(CFGFILE_BASENAME + '.default')
+ msg = (_(
+ "Configuration file {f!r} does not exists. Please copy {d!r} to {f!r} and "
+ "fill out all necessary entries, e.g. the passwords and API keys.").format(
+ f=str(self.cfg_file), d=str(default_conf_file)))
+ LOG.error(msg)
+ self.exit(1)
+
self.config = CrTfConfiguration(
appname=self.appname, verbose=self.verbose, base_dir=self.base_dir,
config_file=self.cfg_file)
res = super(CrTfApplication, self).as_dict(short=short)
+ res['cfg_dir'] = self.cfg_dir
res['cfg_file'] = self.cfg_file
res['__pkg_version__'] = __pkg_version__
res['config'] = None