Package sabayon :: Module util
[hide private]
[frames] | no frames]

Module util

source code

Classes [hide private]
  GeneralError
  DictCompare

Functions [hide private]
  get_admin_log_config_filename()
Returns the human-readable filename used for log configuration, as stored with set_log_config_filename().
  set_admin_log_config_filename(str)
Stores the filename of the human-readable configuration file which the system administrator used to set up the log configuration.
  get_readable_log_config_filename()
Returns the filename that the program actually used to read the log configuration, as stored with set_readable_log_config_filename().
  set_readable_log_config_filename(str)
Stores the filename that the program actually used to read the log configuration.
  set_home_dir_for_unit_tests(homedir)
  get_home_dir()
  get_group_membership()
Returns a list of non-primary, non-system groups that the user belongs to.
  get_user_name()
  print_exception()
  init_gettext()
Binds _() to gettext.gettext() in the global namespace.
  random_string(len)
Returns a string with random binary data of the specified length
  split_path(path, head=None, tail=None)
Given a path split it into a head and tail.
  run_unit_tests()
  dump_change_set(cs)
  should_ignore_dir(base_dir, ignore_dir_list, dir)
  should_ignore_file(base_dir, ignore_dir_list, ignore_file_list, file)

Variables [hide private]
  EXIT_CODE_NORMAL = 0
  EXIT_CODE_FATAL = 1
  EXIT_CODE_RECOVERABLE = 2
  EXIT_CODE_NO_USER_PROFILE = 3
  _util_admin_log_config_filename = <sabayon.cache.cacheRepository instance at 0x11ce170>
  _util_readable_log_config_filename = <sabayon.cache.cacheRepository instance at 0x11ce170>
  unit_tests_homedir = <sabayon.cache.cacheRepository instance at 0x11ce170>
  __package__ = 'sabayon'

Function Details [hide private]

get_admin_log_config_filename()

source code 
Returns the human-readable filename used for log configuration, as stored with set_log_config_filename(). This is the file that the system administrator actually modifies to set up the log configuration.

set_admin_log_config_filename(str)

source code 
Stores the filename of the human-readable configuration file which the system administrator used to set up the log configuration. This can be queried back with get_admin_log_config_filename().

get_readable_log_config_filename()

source code 
Returns the filename that the program actually used to read the log configuration, as stored with set_readable_log_config_filename(). This may be different from the filename from get_admin_log_config_filename(), since the helper processes in Sabayon may need to be given a temporary file to read their log configuration (as root's human-readable file may not be readable by the helper processes).

set_readable_log_config_filename(str)

source code 
Stores the filename that the program actually used to read the log configuration. This can be queried back with get_readable_log_config_filename(). This may be different from the filename from get_admin_log_config_filename(), since the helper processes in Sabayon may need to be given a temporary file to read their log configuration (as root's human-readable file may not be readable by the helper processes).

set_home_dir_for_unit_tests(homedir)

source code 
None

get_home_dir()

source code 
None

get_group_membership()

source code 
Returns a list of non-primary, non-system groups that the user belongs to. Raises a GeneralError if this fails. May return an empty list.

get_user_name()

source code 
None

print_exception()

source code 
None

init_gettext()

source code 
Binds _() to gettext.gettext() in the global namespace. Run util.init_gettext() at the entry point to any script and you'll be able to use _(), gettext(), and ngettext() to mark strings for translation.

random_string(len)

source code 
Returns a string with random binary data of the specified length

split_path(path, head=None, tail=None)

source code 

Given a path split it into a head and tail. If head is passed then it is assumed to comprise the first part of the full path. If tail is passed it is assumed to comprise the second part of the full path. The path, head, and tail are made canonical via os.path.normpath prior to the operations. ValueErrors are raised if head is not present at the start of the path or if the path does not end with tail. The split must occur on a directory separator boundary.

The return value is the tuple (head, tail) in canonical form.

run_unit_tests()

source code 
None

dump_change_set(cs)

source code 
None

should_ignore_dir(base_dir, ignore_dir_list, dir)

source code 
None

should_ignore_file(base_dir, ignore_dir_list, ignore_file_list, file)

source code 
None

Variables Details [hide private]

EXIT_CODE_NORMAL

None
Value:
0                                                                     
      

EXIT_CODE_FATAL

None
Value:
1                                                                     
      

EXIT_CODE_RECOVERABLE

None
Value:
2                                                                     
      

EXIT_CODE_NO_USER_PROFILE

None
Value:
3                                                                     
      

_util_admin_log_config_filename

None
Value:
<sabayon.cache.cacheRepository instance at 0x11ce170>                  
      

_util_readable_log_config_filename

None
Value:
<sabayon.cache.cacheRepository instance at 0x11ce170>                  
      

unit_tests_homedir

None
Value:
<sabayon.cache.cacheRepository instance at 0x11ce170>                  
      

__package__

None
Value:
'sabayon'