Find the script. If the input is not a file, then $PATH will be searched.
(script_name)
| 485 | |
| 486 | |
| 487 | def _find_script(script_name): |
| 488 | """ Find the script. |
| 489 | |
| 490 | If the input is not a file, then $PATH will be searched. |
| 491 | """ |
| 492 | if os.path.isfile(script_name): |
| 493 | return script_name |
| 494 | path = os.getenv('PATH', os.defpath).split(os.pathsep) |
| 495 | for folder in path: |
| 496 | if not folder: |
| 497 | continue |
| 498 | fn = os.path.join(folder, script_name) |
| 499 | if os.path.isfile(fn): |
| 500 | return fn |
| 501 | |
| 502 | sys.stderr.write('Could not find script {0}\n'.format(script_name)) |
| 503 | raise SystemExit(1) |
| 504 | |
| 505 | |
| 506 | class _TimeStamperCM(object): |