blob: 3b68ca2f589c0f906ffd8c56be096a3fdbbaf709 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
__all__ = [ "find_executable", ]
import os
def find_executable(executable, path=None):
if executable:
import os.path
if path is None:
path = os.getenv("PATH", "")
for p in path.split(":"):
fullpath = os.path.join(p, executable)
if os.access(fullpath, os.X_OK) and\
not os.path.isdir(fullpath):
return fullpath
return None
|