Package sabayon :: Module storage :: Class ProfileStorage
[hide private]
[frames] | no frames]

Class ProfileStorage

source code

An encapsulation of all the files which make up the contents of a profile.

The files are stored in a ZIP file with metadata. In order to add/extract files to the profile, they are first copied to/from a temporary directory which is then zipped. Note, though, that the fact that its a ZIP file and the fact that there is a temporary directory are both implementation details and not exposed in the API.

Profile files are stored in /etc/desktop-profiles.

Each file or directory in the profile has metadata associated with it - the "source" of the file/directory and a set of arbitrary key value pairs which that source may interpret.

Instance Methods [hide private]
  __init__(self, name)
Create a ProfileStorage.
  __del__(self)
  __create_empty_metadata_doc(self)
  __read_metadata(self)
  __get_node_source(self, node)
  __get_node_attributes(self, node)
  __update_file_or_dir_node(self, file_or_dir_node, source, attributes, metadata)
  __update_file_node(self, path, source, attributes, metadata=None)
  __update_directory_node(self, path, source, attributes, metadata=None)
  __unpack(self)
  __foreach_all(self, callback, user_data)
  copy(self, name)
Create a new ProfileStorage object, copying the contents of this profile to the new profile.
  add(self, path, src_dir, source, attributes=None, src_path=None)
Add a new - or update an existing - file or directory to the profile.
  __get_dir_node(self, path, metadata=None)
  __get_file_node(self, path, metadata=None)
  __get_node(self, path, metadata=None)
  remove(self, path)
Remove a file or directory from the profile.
  __get_item_type(self, path)
  get_extract_src_path(self, path)
Return the src path of a file or directory for extraction from the profile.
  extract(self, path, dst_dir, overwrite=False)
Extract a file or directory from the profile.
  list(self, source=None)
List the current contents of the profile.
  __foreach_node(self, node, callback, user_data, source)
  foreach(self, callback, user_data=None, source=None)
Iterate over the contents of the profile:
  save(self)
Save the contents of the profile to /etc/desktop-profiles/$(name).zip.
  get_attributes(self, path)
Return the attributes associated with a file or directory from the profile.
  get_source(self, path)
Return the source associated with a file or directory from the profile.

Method Details [hide private]

__init__(self, name)
(Constructor)

source code 
Create a ProfileStorage.

__del__(self)
(Destructor)

source code 
None

__create_empty_metadata_doc(self)

source code 
None

__read_metadata(self)

source code 
None

__get_node_source(self, node)

source code 
None

__get_node_attributes(self, node)

source code 
None

__update_file_or_dir_node(self, file_or_dir_node, source, attributes, metadata)

source code 
None

__update_file_node(self, path, source, attributes, metadata=None)

source code 
None

__update_directory_node(self, path, source, attributes, metadata=None)

source code 
None

__unpack(self)

source code 
None

__foreach_all(self, callback, user_data)

source code 
None

copy(self, name)

source code 
Create a new ProfileStorage object, copying the contents of this profile to the new profile.

add(self, path, src_dir, source, attributes=None, src_path=None)

source code 
Add a new - or update an existing - file or directory to the profile. If @path is a directory, then the contents of the directory will be recursively saved in the profile.

__get_dir_node(self, path, metadata=None)

source code 
None

__get_file_node(self, path, metadata=None)

source code 
None

__get_node(self, path, metadata=None)

source code 
None

remove(self, path)

source code 
Remove a file or directory from the profile.

__get_item_type(self, path)

source code 
None

get_extract_src_path(self, path)

source code 
Return the src path of a file or directory for extraction from the profile.

extract(self, path, dst_dir, overwrite=False)

source code 
Extract a file or directory from the profile.

list(self, source=None)

source code 
List the current contents of the profile.

__foreach_node(self, node, callback, user_data, source)

source code 
None

foreach(self, callback, user_data=None, source=None)

source code 
Iterate over the contents of the profile:

save(self)

source code 
Save the contents of the profile to /etc/desktop-profiles/$(name).zip.

get_attributes(self, path)

source code 
Return the attributes associated with a file or directory from the profile.

get_source(self, path)

source code 
Return the source associated with a file or directory from the profile.