Checks if external command is available in PATH, erroring out if it is not available. Parameters: cmd (str): External command name or path.
(cmd: str)
| 19 | |
| 20 | |
| 21 | def check_cmd(cmd: str) -> None: |
| 22 | """ |
| 23 | Checks if external command is available in PATH, erroring out if it is not |
| 24 | available. |
| 25 | |
| 26 | Parameters: |
| 27 | cmd (str): External command name or path. |
| 28 | """ |
| 29 | if not shutil.which(cmd): |
| 30 | die( |
| 31 | f"The external command '{cmd}' is needed but it could not be found in PATH, please install it!" |
| 32 | ) |
| 33 | |
| 34 | |
| 35 | def die(string: str) -> NoReturn: |