INNER CODE UNIT · Python
makepipeline
theyosh/TerrariumPI · contrib/pipes/__init__.py:189
def makepipeline(infile, steps, outfile):
# Build a list with for each command:
# [input filename or '', command string, kind, output filename or '']
list = []
for cmd, kind in steps:
list.append(["", cmd, kind, ""])
#
# Make sure there is at least one step
#
if not list:
list.append(["", "cat", "--", ""])
#
# Take care of the input and output ends
#
[cmd, kind] = list[0][1:3]
if kind[0] == "f" and not infile:
list.insert(0, ["", "cat", "--", ""])