xonsh.procs.executables¶
Interfaces to locate executable files on file system.
- xonsh.procs.executables.clear_paths(paths)[source]¶
Remove duplicates and nonexistent directories from paths.
- xonsh.procs.executables.get_paths(env=None)[source]¶
Return tuple with deduplicated and existent paths from
$PATH.
- xonsh.procs.executables.get_possible_names(name, env=None)[source]¶
Expand name to all possible variants based on PATHEXT.
PATHEXT is a Windows convention containing extensions to be considered when searching for an executable file.
Conserves order of any extensions found and gives precedence to the bare name.
- xonsh.procs.executables.is_executable(filepath, check_file_exist=True)¶
Check the file is executable in POSIX.
- Parameters:
- filepathstr
Path to file.
- check_file_existbool
If
Falsedo not check that file exists. This made to consistency withis_executable_in_windows.
- xonsh.procs.executables.is_executable_in_posix(filepath, check_file_exist=True)[source]¶
Check the file is executable in POSIX.
- Parameters:
- filepathstr
Path to file.
- check_file_existbool
If
Falsedo not check that file exists. This made to consistency withis_executable_in_windows.
- xonsh.procs.executables.is_executable_in_windows(filepath, check_file_exist=True, env=None)[source]¶
Check the file is executable in Windows.
- Parameters:
- filepathstr
Path to file.
- check_file_existbool
If
Falsedo not check that file exists. This helps to disable double checking in case the file already checked in upstream code. This is important for Windows where checking can take a long time.
- xonsh.procs.executables.locate_executable(name, env=None)[source]¶
Search executable binary name in
$PATHand return full path.
- xonsh.procs.executables.locate_file(name, env=None, check_executable=False, use_pathext=False)[source]¶
Search file name in the current working directory and in
$PATHand return full path.
- xonsh.procs.executables.locate_file_in_path_env(name, env=None, check_executable=False, use_pathext=False)[source]¶
Search file name in
$PATHand return full path.Compromise. There is no way to get case sensitive file name without listing all files. If the file name is
CaMeL.exeand we found thatcamel.EXEexists there is no way to get back the case sensitive name. We don’t want to read the list of files in all$PATHdirectories because of performance reasons. So we’re ok to get existent but case insensitive (or different) result from resolver. May be in the future file systems as well as Python Path will be smarter to get the case sensitive name. The task for reading and returning case sensitive filename we give to completer in interactive mode withcommands_cache.
- xonsh.procs.executables.locate_relative_path(name, env=None, check_executable=False, use_pathext=False)[source]¶
Return absolute path by relative file path.
We should not locate files without prefix (e.g.
"binfile") by security reasons like other shells. If directory has “binfile” it can be called only by providing prefix “./binfile” explicitly.