Comps class is representating comps.xml file represented in structure form.
arch_filter(arch_list)->libcomps.Comps Filter Comps object content by _arch attribute matchingpassed archictures
Parameter: | arch_list (list of strings or libcomps.StrSeq) – list of architectures |
---|---|
Returns: | new :py:class:`libcomps.Comps` instace |
validate inner structure of Comps object.Raise appropriate exception on first occured error
Raises ValueError: | |
---|---|
with appropriate error message |
validate inner structure of Comps object.Raise appropriate exception on first occured error
Raises ValueError: | |
---|---|
with appropriate error message |
fromxml_f(fname, [def_options])->int Load COMPS from xml file
Parameters: |
|
---|---|
Returns: | 1 if some non-fatal error occured during parsing 0 if parsing ended without any error |
Raises libcomps.ParserError: | |
if some fatal erroroccured during parsing |
|
Raises IOError: | if specified filename cannot be opened for reading |
fromxml_str(xml_str, [def_options])->int Load COMPS from xml string
Parameters: |
|
---|---|
Returns: | 1 if some non-fatal error occured during parsing 0 if parsing ended without any error |
Raises libcomps.ParserError: | |
if some fatal error occured during parsing |
validate inner structure of Comps object.Raise appropriate exception on first occured error
Raises ValueError: | |
---|---|
with appropriate error message |
validate inner structure of Comps object.Raise appropriate exception on first occured error
Raises ValueError: | |
---|---|
with appropriate error message |
validate inner structure of Comps class.Returns list of error strings
Return type: | list of strings |
---|
xml_f(fname,[xml_options,[def_options]])->list Generate xml output of Comps class to file
Parameters: |
|
---|---|
Returns: | list of errors encountered during xml generating |
Return type: | list of strings |
Raises XMLGenError: | |
if generating xml encounter some fatal error |
xml_str([xml_options,[def_options]])->str Generate xml output of Comps object a return it as string
Parameters: |
|
---|---|
Returns: | string containing xml output |
Comps Group list
is class mostly similar to normal python list with few diferences:
g1 = libcomps.Group()
g1.id = "g1"
comps.categories.append(g1)
g2 = libcomps.Group()
g2.id = "g2"
comps.categories.append(g2)
g = comps.groups["g2"]
comps.categories["g1"] = libcomps.Group()
insert(pos, item) -> None Insert item into list at position pos
Parameter: | pos – intposition |
---|---|
Returns: | None |
remove(item) -> None Remove first occurence of item from list
Raises TypeError: | |
---|---|
If type of item is not type acceptable for list | |
Raises ValueError: | |
If item is not in the list |
Comps Category list
is class mostly similar to normal python list with few diferences:
c1 = libcomps.Category()
c1.id = "c1"
comps.categories.append(c1)
c2 = libcomps.Category()
c2.id = "c2"
comps.categories.append(c2)
c = comps.groups["c2"]
comps.categories["c1"] = libcomps.Category()
insert(pos, item) -> None Insert item into list at position pos
Parameter: | pos – intposition |
---|---|
Returns: | None |
remove(item) -> None Remove first occurence of item from list
Raises TypeError: | |
---|---|
If type of item is not type acceptable for list | |
Raises ValueError: | |
If item is not in the list |
Comps Env list
is class mostly similar to normal python list with few diferences:
e1 = libcomps.Environment()
e1.id = "e1"
comps.environments.append(e1)
e2 = libcomps.Environment()
e2.id = "e2"
comps.environments.append(e2)
e = comps.groups["e2"]
comps.categories["e1"] = libcomps.Environment()
insert(pos, item) -> None Insert item into list at position pos
Parameter: | pos – intposition |
---|---|
Returns: | None |
remove(item) -> None Remove first occurence of item from list
Raises TypeError: | |
---|---|
If type of item is not type acceptable for list | |
Raises ValueError: | |
If item is not in the list |
Comps Group
Return list of packages matching selected criteria
Returns: | List of packages |
---|
Validate inner group structure. Raise exception on firstoccured error.
Returns: | None if validation successful |
---|---|
Raises ValueError: | |
on first occured error |
Comps Group Package list
is class mostly similar to normal python list with few diferences:
Comps Group Package
package type which could be one of following:
Validate inner package structure. Raise exception on firstoccured error.
Returns: | None if validation successful |
---|---|
Raises ValueError: | |
on first occured error |
Comps Category
Comps Environment
Validate inner environment structure. Raise exception on firstoccured error.
Returns: | None if validation successful |
---|---|
Raises ValueError: | |
on first occured error |
Comps GIDs list
is class mostly similar to normal python list with few diferences:
Comps Str Dict
get(key)->object Return object associated with key
Parameter: | str/unicode key – object key |
---|---|
Returns: | object if there’s object associated with key None otherwise |
has_key(key)->bool Tests if there’s key in object
Parameter: | str/unicode key – object key |
---|---|
Returns: | True if there’s object associated with key False otherwise |
update(dict)->None Update dictionary with (key,value) pair from another dictionary.Existing pairs are overwritten
Parameter: | dict – :py:class:`libcomps.Dict` instance or subclass instance |
---|---|
Returns: | None |
is very lightweight version of python dict
- libcomps.StrDict can have only string/unicode keys and accepts only string/unicode object
Comps Dict
get(key)->list of strings Return object associated with key
Parameter: | str/unicode key – object key |
---|---|
Returns: | object if there’s object associated with key None otherwise |
has_key(key)->bool Tests if there’s key in object
Parameter: | str/unicode key – object key |
---|---|
Returns: | True if there’s object associated with key False otherwise |
update(dict)->None Update dictionary with (key,value) pair from another dictionary.Existing pairs are overwritten
Parameter: | dict – :py:class:`libcomps.Dict` instance or subclass instance |
---|---|
Returns: | None |
is class similar to python dict, except of these properties:
- libcomps.MDict can have only string/unicode keys and accepts only list of string or libcomps.StrSeq which is also object returned from dict.__get__()
- output of StrDict.keys() is in alphabetical order ()
Comps Str list
insert(pos, item) -> None Insert item into list at position pos
Parameter: | pos – intposition |
---|---|
Returns: | None |
remove(item) -> None Remove first occurence of item from list
Raises TypeError: | |
---|---|
If type of item is not type acceptable for list | |
Raises ValueError: | |
If item is not in the list |
is class similar to list, but accepts only string/unicode objects.