1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 12:53:00 +00:00
kiwi-scp/src/kiwi/subcommands/utils/executable.py

21 lines
436 B
Python
Raw Normal View History

2020-08-12 14:43:13 +00:00
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