mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-22 12:53:00 +00:00
21 lines
436 B
Python
21 lines
436 B
Python
|
import os
|
||
|
|
||
|
|
||
|
def get_exe_key(exe_name):
|
||
|
return f'executables:{exe_name}'
|
||
|
|
||
|
|
||
|
def is_executable(filename):
|
||
|
if filename is None:
|
||
|
return False
|
||
|
|
||
|
return os.path.isfile(filename) and os.access(filename, os.X_OK)
|
||
|
|
||
|
|
||
|
def find_exe_file(exe_name):
|
||
|
for path in os.environ['PATH'].split(os.pathsep):
|
||
|
exe_file = os.path.join(path, exe_name)
|
||
|
if is_executable(exe_file):
|
||
|
return exe_file
|
||
|
|
||
|
return None
|