(self, cmd: str, libname: str, opt: str)
| 223 | |
| 224 | # Heuristics |
| 225 | def replace_link_lib(self, cmd: str, libname: str, opt: str) -> str: |
| 226 | archive = f"{libname}.a" |
| 227 | patterns = ["-l" + libname[3:], archive] |
| 228 | tokens = cmd.split() |
| 229 | place = set() |
| 230 | |
| 231 | for i, token in enumerate(tokens): |
| 232 | if Path(token).name == archive or token in patterns: |
| 233 | place.add(i) |
| 234 | |
| 235 | if not place: |
| 236 | raise RuntimeError("Not Found Link Option [ " + cmd + " ]") |
| 237 | |
| 238 | place = sorted(place) |
| 239 | tokens[place[0]] = opt |
| 240 | |
| 241 | for index in reversed(place[1:]): |
| 242 | del tokens[index] |
| 243 | |
| 244 | return " ".join(tokens) |
| 245 | |
| 246 | |
| 247 | def prepare_git(git: Git, name: str, dst: Path, src: Path): |
no test coverage detected