'Parse a tool_dependency.xml file\'s <actions> tag set to gather information for installation using
self.install_and_build_package().  The use of fabric is being eliminated, so some of these functions
may need to be renamed at some point.'

def install_via_fabric(self, tool_shed_repository, tool_dependency, install_dir, package_name=None, custom_fabfile_path=None, actions_elem=None, action_elem=None, **kwd):

    if (not os.path.exists(install_dir)):
        os.makedirs(install_dir)
    actions_dict = dict(install_dir=install_dir)
    if package_name:
        actions_dict['package_name'] = package_name
    actions = []
    is_binary_download = False
    if (actions_elem is not None):
        elems = actions_elem
        if ((elems.get('os') is not None) and (elems.get('architecture') is not None)):
            is_binary_download = True
    elif (action_elem is not None):
        elems = [action_elem]
    else:
        elems = []
    step_manager = StepManager(self.app)
    tool_shed_repository_install_dir = self.get_tool_shed_repository_install_dir(tool_shed_repository)
    install_environment = InstallEnvironment(self.app, tool_shed_repository_install_dir, install_dir)
    for action_elem in elems:
        if (action_elem.tag != 'action'):
            continue
        action_dict = {}
        action_type = action_elem.get('type', None)
        if (action_type is not None):
            action_dict = step_manager.prepare_step(tool_dependency=tool_dependency, action_type=action_type, action_elem=action_elem, action_dict=action_dict, install_environment=install_environment, is_binary_download=is_binary_download)
            action_tuple = (action_type, action_dict)
            if (action_type == 'set_environment'):
                if (action_tuple not in actions):
                    actions.append(action_tuple)
            else:
                actions.append(action_tuple)
    if actions:
        actions_dict['actions'] = actions
    if (custom_fabfile_path is not None):
        raise Exception('Tool    dependency    installation    using    proprietary    fabric    scripts    is    not    yet    supported.')
    else:
        tool_dependency = self.install_and_build_package_via_fabric(install_environment, tool_shed_repository, tool_dependency, actions_dict)
    return tool_dependency
