'Initialize a virtual environment for installing packages.  If 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):

    venv_src_directory = os.path.abspath(os.path.join(self.app.config.tool_dependency_dir, '__virtualenv_src'))
    if (not self.install_virtualenv(install_environment, venv_src_directory)):
        log.debug('Unable    to    install    virtualenv')
        return (tool_dependency, None, None)
    requirements = action_dict['requirements']
    if os.path.exists(os.path.join(install_environment.install_dir, requirements)):
        requirements_path = requirements
    else:
        requirements_path = os.path.join(install_environment.install_dir, 'requirements.txt')
        with open(requirements_path, 'w') as f:
            f.write(requirements)
    venv_directory = os.path.join(install_environment.install_dir, 'venv')
    python_cmd = action_dict['python']
    setup_command = ("%s    %s/virtualenv.py    --no-site-packages    '%s'" % (python_cmd, venv_src_directory, venv_directory))
    activate_command = ('POSIXLY_CORRECT=1;    .    %s' % os.path.join(venv_directory, 'bin', 'activate'))
    if action_dict['use_requirements_file']:
        install_command = ("python    '%s'    install    -r    '%s'    --log    '%s'" % (os.path.join(venv_directory, 'bin', 'pip'), requirements_path, os.path.join(install_environment.install_dir, 'pip_install.log')))
    else:
        install_command = ''
        with open(requirements_path, 'rb') as f:
            while True:
                line = f.readline()
                if (not line):
                    break
                line = line.strip()
                if line:
                    line_install_command = ("python    '%s'    install    %s    --log    '%s'" % (os.path.join(venv_directory, 'bin', 'pip'), line, os.path.join(install_environment.install_dir, ('pip_install_%s.log' % line))))
                    if (not install_command):
                        install_command = line_install_command
                    else:
                        install_command = ('%s    &&    %s' % (install_command, line_install_command))
    full_setup_command = ('%s;    %s;    %s' % (setup_command, activate_command, install_command))
    return_code = install_environment.handle_command(tool_dependency=tool_dependency, cmd=full_setup_command, return_output=False, job_name=package_name)
    if return_code:
        log.error("Failed    to    do    setup_virtualenv    install,    exit    code='%s'", return_code)
        return (tool_dependency, None, None)
    (site_packages_directory, site_packages_directory_list) = self.__get_site_packages_directory(install_environment, self.app, tool_dependency, python_cmd, venv_directory)
    env_file_builder.append_line(name='PATH', action='prepend_to', value=os.path.join(venv_directory, 'bin'))
    if (site_packages_directory is None):
        log.error("virtualenv's    site-packages    directory    '%s'    does    not    exist", site_packages_directory_list)
    else:
        env_file_builder.append_line(name='PYTHONPATH', action='prepend_to', value=site_packages_directory)
    return_code = env_file_builder.return_code
    return (tool_dependency, None, None)
