On Fri, Jun 17, 2011 at 07:35:19PM +0100, Graham Percival wrote:
On Fri, Jun 17, 2011 at 02:18:55PM -0400, Julien Rioux wrote:
On 17/06/2011 2:11 PM, Graham Percival wrote:
make ...blah... || echo "build failed"&& tail logfile
but then when blah fails, make will not stop, since the return
status from echo&& tail is a success (assuming the log file
exists). How would you return failure and force make to stop?
...
The short answer is that I cannot believe that we've exhausted all
options yet. I want Phil to look into those options; of course I
welcome any suggestions from people on this list. But off the top
of my head, I'd say that we can't possibly say that we're out of
ideas until we've spent at least 5 hours googling and/or reading
documentation about make and/or experimenting with make and
stepmake.
ok, I've got a simple solution which avoids all
bash/sh/make/stepmake confusion altogether: write a simple
(5-line?) python script. The script is basically just
import sys
cmd = sys.argv[1]
target = sys.argv[2]
status = os.system(cmd+" "+target)
if not status:
print "Something went wrong! Look in",
print target.replace(".ly", ".log")
sys.exit(1)
sys.exit(0) # success
(not tested)
Now, that's a totally gratuitious use of python... but OTOH, why
not? We already require python, and we use it for tons of other
stuff... and really, a
compile-lilypond-book-file-with-warning-about-log.py
script would be *far* easier for casual hackers to read+understand
than all that make and sh garbage. (ok, the script name is a bit
long, but that's easily thought about)
ok, there we go. We have a backup plan. I'm not wedded to the
"small python script" idea, but if all else fails, it will
definitely work. There might be a better solution out there; I'm
happy to hear alternatives.
Cheers,
- Graham