Checks if 'command' can be found either in path or is a full name to an existing file.
(command)
| 391 | |
| 392 | #ported from trunk@47281 |
| 393 | def check_tool_aux(command): |
| 394 | """ Checks if 'command' can be found either in path |
| 395 | or is a full name to an existing file. |
| 396 | """ |
| 397 | assert(isinstance(command, str)) |
| 398 | dirname = os.path.dirname(command) |
| 399 | if dirname: |
| 400 | if os.path.exists(command): |
| 401 | return command |
| 402 | # Both NT and Cygwin will run .exe files by their unqualified names. |
| 403 | elif on_windows() and os.path.exists(command + '.exe'): |
| 404 | return command |
| 405 | # Only NT will run .bat files by their unqualified names. |
| 406 | elif os_name() == 'NT' and os.path.exists(command + '.bat'): |
| 407 | return command |
| 408 | else: |
| 409 | paths = path.programs_path() |
| 410 | if path.glob(paths, [command]): |
| 411 | return command |
| 412 | |
| 413 | # ported from trunk@47281 |
| 414 | def check_tool(command): |
no test coverage detected