This module deals with finding absolute paths to executables or apps to run. It is imperative that we return absolute paths so that the executables will be able to bootstrap a proper development environment.
Apps are searched for within key_base/applications in all tools listed in KS_PYTHON_SITES and in KS_TOOLS. Executables are searched for within PATH.
Find an executable on the current $PATH.
Parameters: | name (str) – The name of the executable to find. |
---|---|
Throws ValueError: | |
When it cannot find an executable. |
>>> get_executable_path('toolbox')
<snip $KS_TOOLS>/key_base/bin/generated/toolbox
Find an OS X app (if on a Mac), and fall back to an executable.
Parameters: | |
---|---|
Throws ValueError: | |
When it cannot find an app or executable. |
|
Returns: | A list that is directly usable in subprocess.Popen, and which anything appended to will be treated as an argument. |
On a Mac when there is an application:
>>> get_app_or_executable_cmd('qb-reelsmart', 'qb_reelsmart')
['open', '<snip $KS_TOOLS>/key_base/qb-reelsmart.app', '--args']
On Linux, or when there is no application:
>>> get_app_or_executable_cmd('qb-reelsmart', 'qb_reelsmart')
['<snip $KS_TOOLS>/key_base/bin/generated/qb_reelsmart']