diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py
index 6e845b94b70c..4fa2eee3a127 100644
--- a/lib/galaxy/tools/evaluation.py
+++ b/lib/galaxy/tools/evaluation.py
@@ -130,7 +130,7 @@ def input():
param_dict.update( incoming )
input_dataset_paths = dataset_path_rewrites( input_paths )
- self.__populate_wrappers(param_dict, input_dataset_paths)
+ self.__populate_wrappers(param_dict, input_dataset_paths, job_working_directory)
self.__populate_input_dataset_wrappers(param_dict, input_datasets, input_dataset_paths)
self.__populate_output_dataset_wrappers(param_dict, output_datasets, output_paths, job_working_directory)
self.__populate_output_collection_wrappers(param_dict, output_collections, output_paths, job_working_directory)
@@ -165,18 +165,20 @@ def do_walk( inputs, input_values ):
do_walk( inputs, input_values )
- def __populate_wrappers(self, param_dict, input_dataset_paths):
+ def __populate_wrappers(self, param_dict, input_dataset_paths, job_working_directory):
def wrap_input( input_values, input ):
if isinstance( input, DataToolParameter ) and input.multiple:
value = input_values[ input.name ]
dataset_instances = DatasetListWrapper.to_dataset_instances( value )
input_values[ input.name ] = \
- DatasetListWrapper( dataset_instances,
+ DatasetListWrapper( job_working_directory,
+ dataset_instances,
dataset_paths=input_dataset_paths,
datatypes_registry=self.app.datatypes_registry,
tool=self.tool,
name=input.name )
+
elif isinstance( input, DataToolParameter ):
# FIXME: We're populating param_dict with conversions when
# wrapping values, this should happen as a separate
@@ -234,6 +236,7 @@ def wrap_input( input_values, input ):
name=input.name
)
wrapper = DatasetCollectionWrapper(
+ job_working_directory,
dataset_collection,
**wrapper_kwds
)
@@ -306,6 +309,7 @@ def __populate_output_collection_wrappers(self, param_dict, output_collections,
name=name
)
wrapper = DatasetCollectionWrapper(
+ job_working_directory,
out_collection,
**wrapper_kwds
)
diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py
index 9d8822a40811..55889d268a92 100644
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -1114,7 +1114,7 @@ def to_dict( self, trans, view='collection', value_mapper=None, other_values={}
'options' : options,
'value' : value,
'display' : self.display,
- 'multiple' : self.multiple
+ 'multiple' : self.multiple,
})
return d
diff --git a/lib/galaxy/tools/parameters/wrapped.py b/lib/galaxy/tools/parameters/wrapped.py
index becf89f48724..c97692f46eae 100644
--- a/lib/galaxy/tools/parameters/wrapped.py
+++ b/lib/galaxy/tools/parameters/wrapped.py
@@ -58,7 +58,8 @@ def wrap_values( self, inputs, input_values, skip_missing_values=False ):
value = input_values[ input.name ]
dataset_instances = DatasetListWrapper.to_dataset_instances( value )
input_values[ input.name ] = \
- DatasetListWrapper( dataset_instances,
+ DatasetListWrapper( None,
+ dataset_instances,
datatypes_registry=trans.app.datatypes_registry,
tool=tool,
name=input.name )
@@ -72,6 +73,7 @@ def wrap_values( self, inputs, input_values, skip_missing_values=False ):
input_values[ input.name ] = SelectToolParameterWrapper( input, input_values[ input.name ], tool.app, other_values=incoming )
elif isinstance( input, DataCollectionToolParameter ):
input_values[ input.name ] = DatasetCollectionWrapper(
+ None,
input_values[ input.name ],
datatypes_registry=trans.app.datatypes_registry,
tool=tool,
diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py
index f61cb1aca18f..f0a7ca50f877 100644
--- a/lib/galaxy/tools/wrappers.py
+++ b/lib/galaxy/tools/wrappers.py
@@ -1,4 +1,6 @@
+import os
import pipes
+import tempfile
from galaxy import exceptions
from galaxy.util.none_like import NoneDataset
from galaxy.util import odict
@@ -263,11 +265,18 @@ def _dataset_wrapper( self, dataset, dataset_paths, **kwargs ):
wrapper_kwds[ "dataset_path" ] = dataset_paths[ real_path ]
return DatasetFilenameWrapper( dataset, **wrapper_kwds )
+ def paths_as_file(self, sep="\n"):
+ handle, filepath = tempfile.mkstemp(prefix="gx_file_list", dir=self.job_working_directory)
+ contents = sep.join(map(str, self))
+ os.write(handle, contents)
+ os.close(handle)
+ return filepath
+
class DatasetListWrapper( list, ToolParameterValueWrapper, HasDatasets ):
"""
"""
- def __init__( self, datasets, dataset_paths=[], **kwargs ):
+ def __init__( self, job_working_directory, datasets, dataset_paths=[], **kwargs ):
if not isinstance(datasets, list):
datasets = [datasets]
@@ -279,6 +288,7 @@ def to_wrapper( dataset ):
return self._dataset_wrapper( dataset, dataset_paths, **kwargs )
list.__init__( self, map( to_wrapper, datasets ) )
+ self.job_working_directory = job_working_directory
@staticmethod
def to_dataset_instances( dataset_instance_sources ):
@@ -300,8 +310,9 @@ def __str__( self ):
class DatasetCollectionWrapper( ToolParameterValueWrapper, HasDatasets ):
- def __init__( self, has_collection, dataset_paths=[], **kwargs ):
+ def __init__( self, job_working_directory, has_collection, dataset_paths=[], **kwargs ):
super(DatasetCollectionWrapper, self).__init__()
+ self.job_working_directory = job_working_directory
if has_collection is None:
self.__input_supplied = False
@@ -330,7 +341,7 @@ def __init__( self, has_collection, dataset_paths=[], **kwargs ):
element_identifier = dataset_collection_element.element_identifier
if dataset_collection_element.is_collection:
- element_wrapper = DatasetCollectionWrapper( dataset_collection_element, dataset_paths, **kwargs )
+ element_wrapper = DatasetCollectionWrapper(job_working_directory, dataset_collection_element, dataset_paths, **kwargs )
else:
element_wrapper = self._dataset_wrapper( element_object, dataset_paths, **kwargs)
diff --git a/test/functional/tools/paths_as_file.xml b/test/functional/tools/paths_as_file.xml
new file mode 100644
index 000000000000..b6dd3b00647a
--- /dev/null
+++ b/test/functional/tools/paths_as_file.xml
@@ -0,0 +1,37 @@
+
+
+
+
+ $out1
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml
index 553c704f15c6..48084ab8ff6d 100644
--- a/test/functional/tools/samples_tool_conf.xml
+++ b/test/functional/tools/samples_tool_conf.xml
@@ -44,6 +44,7 @@
+