Object containing build information about a library. Parameters ---------- name : str The library name. description : str Description of the library. version : str Version string. sections : dict The sections of the configuration file for
| 74 | return val.replace('\\', '\\\\') |
| 75 | |
| 76 | class LibraryInfo: |
| 77 | """ |
| 78 | Object containing build information about a library. |
| 79 | |
| 80 | Parameters |
| 81 | ---------- |
| 82 | name : str |
| 83 | The library name. |
| 84 | description : str |
| 85 | Description of the library. |
| 86 | version : str |
| 87 | Version string. |
| 88 | sections : dict |
| 89 | The sections of the configuration file for the library. The keys are |
| 90 | the section headers, the values the text under each header. |
| 91 | vars : class instance |
| 92 | A `VariableSet` instance, which contains ``(name, value)`` pairs for |
| 93 | variables defined in the configuration file for the library. |
| 94 | requires : sequence, optional |
| 95 | The required libraries for the library to be installed. |
| 96 | |
| 97 | Notes |
| 98 | ----- |
| 99 | All input parameters (except "sections" which is a method) are available as |
| 100 | attributes of the same name. |
| 101 | |
| 102 | """ |
| 103 | def __init__(self, name, description, version, sections, vars, requires=None): |
| 104 | self.name = name |
| 105 | self.description = description |
| 106 | if requires: |
| 107 | self.requires = requires |
| 108 | else: |
| 109 | self.requires = [] |
| 110 | self.version = version |
| 111 | self._sections = sections |
| 112 | self.vars = vars |
| 113 | |
| 114 | def sections(self): |
| 115 | """ |
| 116 | Return the section headers of the config file. |
| 117 | |
| 118 | Parameters |
| 119 | ---------- |
| 120 | None |
| 121 | |
| 122 | Returns |
| 123 | ------- |
| 124 | keys : list of str |
| 125 | The list of section headers. |
| 126 | |
| 127 | """ |
| 128 | return list(self._sections.keys()) |
| 129 | |
| 130 | def cflags(self, section="default"): |
| 131 | val = self.vars.interpolate(self._sections[section]['cflags']) |
| 132 | return _escape_backslash(val) |
| 133 |