Determine the full path of an executable. Copied from http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python/377028#377028
(program)
| 16 | from .meshio import save_mesh, load_mesh, form_mesh |
| 17 | |
| 18 | def which(program): |
| 19 | """ Determine the full path of an executable. |
| 20 | |
| 21 | Copied from http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python/377028#377028 |
| 22 | """ |
| 23 | def is_exe(fpath): |
| 24 | return os.path.isfile(fpath) and os.access(fpath, os.X_OK) |
| 25 | |
| 26 | fpath, fname = os.path.split(program) |
| 27 | if fpath: |
| 28 | if is_exe(program): |
| 29 | return program |
| 30 | else: |
| 31 | for path in os.environ["PATH"].split(os.pathsep): |
| 32 | path = path.strip('"') |
| 33 | exe_file = os.path.join(path, program) |
| 34 | if is_exe(exe_file): |
| 35 | return exe_file |
| 36 | |
| 37 | return None |
| 38 | |
| 39 | def quick_csg(mesh_1, mesh_2, operation, with_timing=False): |
| 40 | exe_name = None |