def for_path(path): """Produce a class:`Runnable` for supplied path.""" runnable_type = None if os.path.isdir(path): runnable_type = RunnableType.directory elif looks_like_a_tool_cwl(path): runnable_type = RunnableType.cwl_tool elif looks_like_a_tool_xml(path): runnable_type = RunnableType.galaxy_tool elif is_a_yaml_with_class(path, ["GalaxyWorkflow"]): runnable_type = RunnableType.galaxy_workflow elif path.endswith(".ga"): runnable_type = RunnableType.galaxy_workflow elif looks_like_a_cwl_artifact(path, ["Workflow"]): runnable_type = RunnableType.cwl_workflow if runnable_type is None: error("Unable to determine runnable type for path [%s]" % path) raise ExitCodeException(EXIT_CODE_UNKNOWN_FILE_TYPE) return Runnable(path, runnable_type)
def for_path(path): """Produce a class:`Runnable` for supplied path.""" runnable_type = None if os.path.isdir(path): runnable_type = RunnableType.directory elif looks_like_a_tool_cwl(path): runnable_type = RunnableType.cwl_tool elif looks_like_a_tool_xml(path): runnable_type = RunnableType.galaxy_tool elif is_a_yaml_with_class(path, ["GalaxyWorkflow"]): runnable_type = RunnableType.galaxy_workflow elif path.endswith(".ga"): runnable_type = RunnableType.galaxy_workflow elif looks_like_a_cwl_artifact(path, ["Workflow"]): runnable_type = RunnableType.cwl_workflow if runnable_type is None: error("Unable to determine runnable type for path [%s]" % path) raise ExitCodeException(EXIT_CODE_UNKNOWN_FILE_TYPE) return Runnable(path, runnable_type)