Module e.c.u.misc

Part of elisa.core.utils

Miscellaneaous utilities that don't need their own module because they are reasonnably small.
Line # Kind Name Docs
45 Function env_var_expand Expand the given environment variable content. If it contains
83 Function env_var_explode_list Explode a list of values stored in an environment variable as a
112 Function un_camelify Convert CamelCase styled strings to lower_cased style.
135 Function is_hildon_desktop_running Undocumented
161 Function get_distro Undocumented
207 Function get_os_name Undocumented
215 Function pkg_resources_copy_dir Copy a directory recursively using pkg_resources.
243 Function run_functional_tests_check Check whether functional tests should be run or not. This is done by
269 Function chainDeferredIgnoringResult Undocumented
281 Function mappings_from_text Unserialise mappings from a string text. Mappings are lists of 2-uplets.
305 Function text_from_mappings Takes a mappings and return a serialised form. Mappings are list of
327 Function read_mappings Setuptools compliant deserialiser for mappings.
def env_var_expand(var_name):

Expand the given environment variable content. If it contains other references to environment variables, they are expanded too.

Supported platforms are win32 and linux.

Example of use:

  >>> env_var_expand('$HOME')
  >>> '/home/phil'
Parametersvar_nameenvironment variable (type: string )
Returns (type: string )
RaisesValueErrorif current system's platform is not windows or linux
def env_var_explode_list(var_name, default=''):

Explode a list of values stored in an environment variable as a single string. On win32 the item separator is ';' and on other platforms it is ':'.

Example of use:

  >>> env_var_explode_list('$PATH')
  >>> ['/usr/bin','/bin']
Parametersvar_nameenvironment variable (type: string )
defaultvalue to use if environment variable not found (type: string )
Returns (type: list of strings )
def un_camelify(camel_string):
Convert CamelCase styled strings to lower_cased style.
Parameterscamel_stringCamelStyled string to convert (type: string )
Returns (type: string )
def is_hildon_desktop_running():
Undocumented
def get_distro():
Undocumented
def get_os_name():
Undocumented
def pkg_resources_copy_dir(resource_spec, resource_dir, dest_dir):
Copy a directory recursively using pkg_resources.
def run_functional_tests_check():

Check whether functional tests should be run or not. This is done by checking whether the FUNCTIONAL_TESTS_STR environment variable is set to 'True'. If it is not explictly set to True, this method raises a twisted.trial.unittest.SkipTest (saying that the functional test is not run).

This method allows functional tests to have an easy way to check if they should be run. This simple example checks in the setup (but it could also be done inside the method itself):

   from elisa.core.utils.misc import run_functional_tests_check
   [...]
   class MyFunctionalTestCase(TestCase):

       def setUp(self):
           run_functional_tests_check()
           ...
def chainDeferredIgnoringResult(first, chained):
Undocumented
def mappings_from_text(text):

Unserialise mappings from a string text. Mappings are lists of 2-uplets.

Example:

   key1 = value1
   key2 = value2a
   key2 = value2b

is deserialised into:

   [("key1", "value1"), ("key2", "value2a"), ("key2", "value2b")]
def text_from_mappings(mappings):

Takes a mappings and return a serialised form. Mappings are list of 2-uplets.

Example:

   [("key1", "value1"), ("key2", "value2a"), ("key2", "value2b")]

is serialised into:

   key1 = value1
   key2 = value2a
   key2 = value2b
def read_mappings(iter_lines):
Setuptools compliant deserialiser for mappings.
API Documentation for Elisa Media Center, generated by pydoctor at 2009-02-16 19:15:05.