Given input_path, returns a tuple with sourceTree and path values. Examples: input_path (source_tree, output_path) '$(VAR)/path' ('VAR', 'path') '$(VAR)' ('VAR', None) 'path' (None, 'path')
(input_path)
| 174 | |
| 175 | |
| 176 | def SourceTreeAndPathFromPath(input_path): |
| 177 | """Given input_path, returns a tuple with sourceTree and path values. |
| 178 | |
| 179 | Examples: |
| 180 | input_path (source_tree, output_path) |
| 181 | '$(VAR)/path' ('VAR', 'path') |
| 182 | '$(VAR)' ('VAR', None) |
| 183 | 'path' (None, 'path') |
| 184 | """ |
| 185 | |
| 186 | if source_group_match := _path_leading_variable.match(input_path): |
| 187 | source_tree = source_group_match.group(1) |
| 188 | output_path = source_group_match.group(3) # This may be None. |
| 189 | else: |
| 190 | source_tree = None |
| 191 | output_path = input_path |
| 192 | |
| 193 | return (source_tree, output_path) |
| 194 | |
| 195 | |
| 196 | def ConvertVariablesToShellSyntax(input_string): |
no test coverage detected