Package entropy :: Package core :: Package settings :: Module base :: Class SystemSettings

Class SystemSettings

source code


This is the place where all the Entropy settings are stored if they are not considered instance constants (etpConst). For example, here we store package masking cache information and settings, client-side, server-side and services settings. Also, this class mimics a dictionary (even if not inheriting it due to development choices).

Sample code:

>>> from entropy.core.settings.base import SystemSettings
>>> system_settings = SystemSettings()
>>> system_settings.clear()
>>> system_settings.destroy()
Nested Classes
  CachingList
This object overrides a list, making possible to store cache information in the same place of the data to be cached.
Instance Methods
 
init_singleton(self)
Replaces __init__ because SystemSettings is a Singleton.
source code
 
__enter__(self)
Make possible to add plugins without triggering parse() every time.
source code
 
__exit__(self, exc_type, exc_value, traceback)
Make possible to add plugins without triggering parse() every time.
source code
None
destroy(self)
Overloaded method from Singleton.
source code
None
add_plugin(self, system_settings_plugin_instance)
This method lets you add custom parsers to SystemSettings.
source code
None
remove_plugin(self, plugin_id)
This method lets you remove previously added custom parsers from SystemSettings through its plugin identifier.
source code
set
get_updatable_configuration_files(self, repository_id)
Poll SystemSettings plugins and get a list of updatable configuration files.
source code
 
__setitem__(self, mykey, myvalue)
dict method.
source code
 
__getitem__(self, key)
dict method.
source code
 
__delitem__(self, key)
dict method.
source code
 
__iter__(self)
dict method.
source code
 
__contains__(self, item)
dict method.
source code
 
__hash__(self)
dict method.
source code
 
__len__(self)
dict method.
source code
 
get(self, key, *args, **kwargs)
dict method.
source code
 
copy(self)
dict method.
source code
 
fromkeys(self, *args, **kwargs)
dict method.
source code
 
items(self)
dict method.
source code
 
iteritems(self)
dict method.
source code
 
iterkeys(self)
dict method.
source code
 
keys(self)
dict method.
source code
 
pop(self, key, *args, **kwargs)
dict method.
source code
 
popitem(self)
dict method.
source code
 
setdefault(self, key, *args, **kwargs)
dict method.
source code
 
update(self, kwargs)
dict method.
source code
 
values(self)
dict method.
source code
 
clear(self)
dict method.
source code
None
set_persistent_setting(self, persistent_dict)
Make metadata persistent, the input dict will be merged with the base one at every reset call (clear()).
source code
None
unset_persistent_setting(self, persistent_key)
Remove dict key from persistent dictionary
source code
dict
get_setting_files_data(self)
Return a copy of the internal *files* dictionary.
source code
dict
get_setting_dirs_data(self)
Return a copy of the internal *dirs* dictionary.
source code
 
packages_configuration_hash(self)
Return a SHA1 hash of the current packages configuration.
source code
 
validate_entropy_cache(self, *args, **kwargs)
A call to this method is no longer necessary.
source code

Inherited from Singleton: __init__

Inherited from EntropyPluginStore: drop_plugins, get_plugins, has_plugin

Inherited from object: __delattr__, __format__, __getattribute__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods
 
packages_config_directory()
Return the actual {ROOT}etc/entropy/packages path.
source code
 
packages_sets_directory()
Return the actual {ROOT}etc/entropy/packages/sets path.
source code

Inherited from Singleton: __new__

Class Variables
  __singleton__ = SystemSettings()
Properties

Inherited from object: __class__

Method Details

init_singleton(self)

source code 

Replaces __init__ because SystemSettings is a Singleton. see Singleton API reference for more information.

__exit__(self, exc_type, exc_value, traceback)

source code 

Make possible to add plugins without triggering parse() every time. Reload SystemSettings on exit

destroy(self)

source code 

Overloaded method from Singleton. "Destroys" the instance.

Returns: None
None

add_plugin(self, system_settings_plugin_instance)

source code 

This method lets you add custom parsers to SystemSettings. Mind that you are responsible of handling your plugin instance and remove it before it is destroyed. You can remove the plugin instance at any time by issuing remove_plugin. Every add_plugin or remove_plugin method will also issue clear() for you. This could be bad and it might be removed in future.

Parameters:
  • system_settings_plugin_instance (SystemSettingsPlugin instance) - valid SystemSettingsPlugin instance
Returns: None
None
Overrides: EntropyPluginStore.add_plugin

remove_plugin(self, plugin_id)

source code 

This method lets you remove previously added custom parsers from SystemSettings through its plugin identifier. If plugin_id is not available, KeyError exception will be raised. Every add_plugin or remove_plugin method will also issue clear() for you. This could be bad and it might be removed in future.

Parameters:
  • plugin_id (basestring) - plugin identifier
Returns: None
None
Overrides: EntropyPluginStore.remove_plugin

get_updatable_configuration_files(self, repository_id)

source code 

Poll SystemSettings plugins and get a list of updatable configuration files. For "updatable" it is meant, configuration files that expose package matches (not just keys) at the beginning of new lines. This makes possible to implement automatic configuration files updates upon package name renames.

Parameters:
  • repository_id (string or None) - repository identifier, if needed to return a list of specific configuration files
Returns: set
list (set) of package files paths (must check for path avail)

packages_config_directory()
Static Method

source code 

Return the actual {ROOT}etc/entropy/packages path.

Returns:
path

packages_sets_directory()
Static Method

source code 

Return the actual {ROOT}etc/entropy/packages/sets path.

Returns:
path

__setitem__(self, mykey, myvalue)
(Index assignment operator)

source code 

dict method. See Python dict API reference.

__getitem__(self, key)
(Indexing operator)

source code 

dict method. See Python dict API reference.

__delitem__(self, key)
(Index deletion operator)

source code 

dict method. See Python dict API reference.

__iter__(self)

source code 

dict method. See Python dict API reference.

__contains__(self, item)
(In operator)

source code 

dict method. See Python dict API reference.

__hash__(self)
(Hashing function)

source code 

dict method. See Python dict API reference.

Overrides: object.__hash__

__len__(self)
(Length operator)

source code 

dict method. See Python dict API reference.

get(self, key, *args, **kwargs)

source code 

dict method. See Python dict API reference.

copy(self)

source code 

dict method. See Python dict API reference.

fromkeys(self, *args, **kwargs)

source code 

dict method. See Python dict API reference.

items(self)

source code 

dict method. See Python dict API reference.

iteritems(self)

source code 

dict method. See Python dict API reference.

iterkeys(self)

source code 

dict method. See Python dict API reference.

keys(self)

source code 

dict method. See Python dict API reference.

pop(self, key, *args, **kwargs)

source code 

dict method. See Python dict API reference.

popitem(self)

source code 

dict method. See Python dict API reference.

setdefault(self, key, *args, **kwargs)

source code 

dict method. See Python dict API reference.

update(self, kwargs)

source code 

dict method. See Python dict API reference.

values(self)

source code 

dict method. See Python dict API reference.

clear(self)

source code 

dict method. See Python dict API reference. Settings are also re-initialized here.

@return None

set_persistent_setting(self, persistent_dict)

source code 

Make metadata persistent, the input dict will be merged with the base one at every reset call (clear()).

Parameters:
  • persistent_dict (dict) - dictionary to merge
Returns: None
None

unset_persistent_setting(self, persistent_key)

source code 

Remove dict key from persistent dictionary

Parameters:
  • persistent_key - key to remove
  • persistent_dict (dict)
Returns: None
None

get_setting_files_data(self)

source code 

Return a copy of the internal *files* dictionary. This dict contains config file paths and their identifiers.

Returns: dict
dict __setting_files

get_setting_dirs_data(self)

source code 

Return a copy of the internal *dirs* dictionary. This dict contains *.d config dirs enclosing respective config files.

Returns: dict
dict __setting_dirs

packages_configuration_hash(self)

source code 

Return a SHA1 hash of the current packages configuration. This includes masking, unmasking, keywording, system masking settings.