From 62f96f3bcbf53ac04fe22d57c0d69cd9640a8783 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Fri, 26 Feb 2016 10:10:45 -0800 Subject: [PATCH] add a postamble, too (extra newlines, only) --- tldp/doctypes/common.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tldp/doctypes/common.py b/tldp/doctypes/common.py index 612ba9b..a07b698 100644 --- a/tldp/doctypes/common.py +++ b/tldp/doctypes/common.py @@ -21,6 +21,10 @@ set -o pipefail ''' +postamble = ''' + +''' + def depends(graph, *predecessors): '''decorator to be used for constructing build order graph''' def anon(f): @@ -72,7 +76,7 @@ class BaseDoctype(object): assert validator(thing) return True - def shellscript(self, script, preamble=preamble): + def shellscript(self, script, preamble=preamble, postamble=postamble): source = self.source output = self.output config = self.config @@ -85,6 +89,8 @@ class BaseDoctype(object): if preamble: tf.write(preamble) tf.write(s) + if postamble: + tf.write(postamble) tf.close() mode = stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR @@ -93,6 +99,9 @@ class BaseDoctype(object): cmd = [tf.name] result = execute(cmd, logdir=logdir) if result != 0: + with open(tf.name) as f: + for line in f: + logger.debug("Script: %s", line.rstrip()) return False return True