def build_command(runner, job_wrapper, container=None, modify_command_for_container=True, include_metadata=False, include_work_dir_outputs=True, create_tool_working_directory=True, remote_command_params={}, metadata_directory=None):
 shell = job_wrapper.shell
 base_command_line = job_wrapper.get_command_line()
 if (not base_command_line):
  raise Exception('Attempting to run a tool with empty command definition.')
 commands_builder = CommandsBuilder(base_command_line)
 if (not commands_builder.commands):
  return None
 __handle_version_command(commands_builder, job_wrapper)
 __handle_task_splitting(commands_builder, job_wrapper)
 if ((not container) or container.resolve_dependencies):
  __handle_dependency_resolution(commands_builder, job_wrapper, remote_command_params)
 if ((container and modify_command_for_container) or job_wrapper.commands_in_new_shell):
  if (container and modify_command_for_container):
   external_command_shell = container.shell
  else:
   external_command_shell = shell
  externalized_commands = __externalize_commands(job_wrapper, external_command_shell, commands_builder, remote_command_params)
  if (container and modify_command_for_container):
   run_in_container_command = container.containerize_command(externalized_commands)
   commands_builder = CommandsBuilder(run_in_container_command)
  else:
   commands_builder = CommandsBuilder(externalized_commands)
 if create_tool_working_directory:
  commands_builder.prepend_command('rm -rf working; mkdir -p working; cd working')
 if include_work_dir_outputs:
  __handle_work_dir_outputs(commands_builder, job_wrapper, runner, remote_command_params)
 commands_builder.capture_return_code()
 if (include_metadata and job_wrapper.requires_setting_metadata):
  metadata_directory = (metadata_directory or job_wrapper.working_directory)
  commands_builder.append_command(("cd '%s'" % metadata_directory))
  __handle_metadata(commands_builder, job_wrapper, runner, remote_command_params)
 return commands_builder.build()

def build_command ( runner , job_wrapper , container = None , modify_command_for_container = True , include_metadata = False , include_work_dir_outputs = True , create_tool_working_directory = True , remote_command_params = { } , metadata_directory = None ) : shell = job_wrapper . shell base_command_line = job_wrapper . get_command_line ( ) if ( not base_command_line ) : raise Exception ( 'Attempting to run a tool with empty command definition.' ) commands_builder = CommandsBuilder ( base_command_line ) if ( not commands_builder . commands ) : return None __handle_version_command ( commands_builder , job_wrapper ) __handle_task_splitting ( commands_builder , job_wrapper ) if ( ( not container ) or container . resolve_dependencies ) : __handle_dependency_resolution ( commands_builder , job_wrapper , remote_command_params ) if ( ( container and modify_command_for_container ) or job_wrapper . commands_in_new_shell ) : if ( container and modify_command_for_container ) : external_command_shell = container . shell else : external_command_shell = shell externalized_commands = __externalize_commands ( job_wrapper , external_command_shell , commands_builder , remote_command_params ) if ( container and modify_command_for_container ) : run_in_container_command = container . containerize_command ( externalized_commands ) commands_builder = CommandsBuilder ( run_in_container_command ) else : commands_builder = CommandsBuilder ( externalized_commands ) if create_tool_working_directory : commands_builder . prepend_command ( 'rm -rf working; mkdir -p working; cd working' ) if include_work_dir_outputs : __handle_work_dir_outputs ( commands_builder , job_wrapper , runner , remote_command_params ) commands_builder . capture_return_code ( ) if ( include_metadata and job_wrapper . requires_setting_metadata ) : metadata_directory = ( metadata_directory or job_wrapper . working_directory ) commands_builder . append_command ( ( "cd '%s'" % metadata_directory ) ) __handle_metadata ( commands_builder , job_wrapper , runner , remote_command_params ) return commands_builder . build ( )
builds and returns a getfacl/setfacl command .