Adds a configuration to a file. Args: path: Relative path to the file. config: Name of configuration to add. attrs: Dict of configuration attributes; may be None. tools: List of tools (strings or Tool objects); may be None. Raises:
(self, path, config, attrs=None, tools=None)
| 163 | # filter. That is, it doesn't merge the trees. |
| 164 | |
| 165 | def AddFileConfig(self, path, config, attrs=None, tools=None): |
| 166 | """Adds a configuration to a file. |
| 167 | |
| 168 | Args: |
| 169 | path: Relative path to the file. |
| 170 | config: Name of configuration to add. |
| 171 | attrs: Dict of configuration attributes; may be None. |
| 172 | tools: List of tools (strings or Tool objects); may be None. |
| 173 | |
| 174 | Raises: |
| 175 | ValueError: Relative path does not match any file added via AddFiles(). |
| 176 | """ |
| 177 | # Find the file node with the right relative path |
| 178 | parent = self.files_dict.get(path) |
| 179 | if not parent: |
| 180 | raise ValueError('AddFileConfig: file "%s" not in project.' % path) |
| 181 | |
| 182 | # Add the config to the file node |
| 183 | spec = self._GetSpecForConfiguration("FileConfiguration", config, attrs, tools) |
| 184 | parent.append(spec) |
| 185 | |
| 186 | def WriteIfChanged(self): |
| 187 | """Writes the project file.""" |
no test coverage detected