parameters: (cmd_name, cmd_dir, cmd_path=None)
docstring: Returns absolute path to cmd_path if it is given,
    or absolute path to cmd_dir/cmd_name.
docstring_summary: Returns absolute path to cmd_path if it is given,
    or absolute path to cmd_dir/cmd_name.
docstring_tokens: Returns absolute path to cmd_path if it is given or absolute path to cmd_dir / cmd_name .
function: def check_cmd(cmd_name, cmd_dir, cmd_path=None):
    """
    Returns absolute path to cmd_path if it is given,
    or absolute path to cmd_dir/cmd_name.
    """
    if cmd_path:
      # Make the path absolute so the creduce test can be run from any directory.
      cmd_path = os.path.abspath(cmd_path)
      cmd = find_executable(cmd_path)
      if cmd:
        return cmd
      sys.exit("ERROR: executable `%s` not found" % (cmd_path))
  
    cmd = find_executable(cmd_name, path=cmd_dir)
    if cmd:
      return cmd
  
    if not cmd_dir:
      cmd_dir = "$PATH"
    sys.exit("ERROR: `%s` not found in %s" % (cmd_name, cmd_dir))
function_tokens: def check_cmd ( cmd_name , cmd_dir , cmd_path = None ) : if cmd_path : # Make the path absolute so the creduce test can be run from any directory. cmd_path = os . path . abspath ( cmd_path ) cmd = find_executable ( cmd_path ) if cmd : return cmd sys . exit ( "ERROR: executable `%s` not found" % ( cmd_path ) ) cmd = find_executable ( cmd_name , path = cmd_dir ) if cmd : return cmd if not cmd_dir : cmd_dir = "$PATH" sys . exit ( "ERROR: `%s` not found in %s" % ( cmd_name , cmd_dir ) )