Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/code_format/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,15 @@ def read_file(self, path):
# look_path searches for the given executable in all directories in PATH
# environment variable. If it cannot be found, empty string is returned.
def look_path(self, executable):
if executable is None:
return ''
return shutil.which(executable) or ''

# path_exists checks whether the given path exists. This function assumes that
# the path is absolute and evaluates environment variables.
def path_exists(self, executable):
if executable is None:
return False
return os.path.exists(os.path.expandvars(executable))

# executable_by_others checks whether the given path has execute permission for
Expand Down