'Download a binary file.  If the value of initial_download is True, the recipe steps will be
filtered and returned and the installation directory (i.e., dir) will be defined and returned.
If we\'re not in the initial download stage, these actions will not occur, and None values will
be returned for them.'

def execute_step(self, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder, install_environment, work_dir, current_dir=None, initial_download=False):

    url = action_dict['url']
    target_directory = action_dict.get('target_directory', None)
    downloaded_filename = None
    try:
        checksums = self.get_dict_checksums(action_dict)
        log.debug('Attempting    to    download    from    %s    to    %s', url, str(target_directory))
        downloaded_filename = self.download_binary(url, work_dir, checksums)
        if initial_download:
            filtered_actions = self.filter_actions_after_binary_installation(actions[1:])
            actions = [item for item in filtered_actions]
    except Exception as e:
        log.exception(str(e))
        if initial_download:
            filtered_actions = actions[1:]
            (action_type, action_dict) = filtered_actions[0]
    if (downloaded_filename and os.path.exists(os.path.join(work_dir, downloaded_filename))):
        if target_directory:
            target_directory = os.path.realpath(os.path.normpath(os.path.join(install_environment.install_dir, target_directory)))
            if target_directory.startswith(os.path.realpath(install_environment.install_dir)):
                full_path_to_dir = os.path.abspath(os.path.join(install_environment.install_dir, target_directory))
            else:
                full_path_to_dir = os.path.abspath(install_environment.install_dir)
        else:
            full_path_to_dir = os.path.abspath(install_environment.install_dir)
        basic_util.move_file(current_dir=work_dir, source=downloaded_filename, destination=full_path_to_dir)
    dir = None
    if initial_download:
        return (tool_dependency, filtered_actions, dir)
    return (tool_dependency, None, None)
