config
– Configurations¶
Manage configurations.
-
libvhc.config.
conf_svn_info
(conf)[source]¶ Get the svn info from the configuration as raw values.
Parameters: - conf :
pyhetdex.tools.configuration.ConfigParser
configuration object
Returns: - conf_svn_info : OrderedDict
svn informations; keys: date, revision, author
- conf :
-
libvhc.config.
config_file_name
()[source]¶ Returns the configuration file name.
It searches for the configuration file until it doesn’t find it. The resolution order is:
- environment variable
VHC_CONFIG
containing the file name ./vhc_config/vhc_settings.cfg
$HOME/.config/vhc_config/vhc_settings.cfg
/etc/vhc_config/vhc_settings.cfg
Returns: - string
name of the file
Raises: - pyhetdex.tool.six_ext.ConfigFileError
if the
vhc_settings.cfg
is not found in any of the above places
- environment variable
-
libvhc.config.
default_dict
(conf_file)[source]¶ Default values of the configuration object
Parameters: - conf_file : string
name of the configuration file
Returns: - defaults : dict
options-values pairs
-
libvhc.config.
get_config
(name='default')[source]¶ Returns the configuration file with the specified name
All calls to this functions with a given
name
return the sameconfp.ConfigParser
instance. This means that configuration instances don’t need to be passed between different parts of the application.Parameters: - name : string, optional
name to associate with the config parser,
Returns: confp.ConfigParser
instance
-
libvhc.config.
load_config
(name='default', conf_file=None, reload_=False, args=None)[source]¶ Load the configuration
Parameters: - name : string, optional
name to associate with the configuration object
- conf_name : string, optional
Name of the configuration file; if not provided search for it in the default locations
- reload : bool, optional
load the configuration, even if
name
configuration objects already exists- args : object, optional
if given, use the
args
to override the configuration entries; it usesoverride_conf()
-
libvhc.config.
DEF_CONFDIR
= 'vhc_config'¶ Default directory containing the configuration file
-
libvhc.config.
DEF_CONFNAME
= 'vhc_settings.cfg'¶ Default name of the configuration file
-
libvhc.config.
SVN_REVISION
= 61¶ Minimum revision number of the vhc_settings.cfg file. If the revision number is not found or smaller, warn the user