Author: sebastien.lelong
Date: Sat Jan  3 11:48:12 2009
New Revision: 714

Modified:
    trunk/tools/jallib.py

Log:
if compilation fails, do not delete sample if manually generated (no -a  
option)

Modified: trunk/tools/jallib.py
==============================================================================
--- trunk/tools/jallib.py       (original)
+++ trunk/tools/jallib.py       Sat Jan  3 11:48:12 2009
@@ -915,7 +915,7 @@
        return content


-def generate_one_sample(boardfile,testfile,outfile):
+def generate_one_sample(boardfile,testfile,outfile,deleteiffailed=True):
        # try to find which linefeed is used
        board = normalize_linefeed(file(boardfile).read()).splitlines()
        ##board = map(lambda x:  
x.replace("\r\n",os.linesep),file(boardfile).readlines())
@@ -945,7 +945,7 @@
        status = do_compile([outfile],exitonerror=False,clean=True)
        if status == 0:
                print "Sucesfully generated sample '%s' from board '%s' and 
test '%s'" %  
(outfile,boardfile,testfile)
-       else:
+       elif deleteiffailed:
                # delete the file !
                os.unlink(outfile)
                raise Exception("Can't compile sample '%s' generated from '%s' 
and  
test '%s'" % (outfile,boardfile,testfile))
@@ -1023,7 +1023,8 @@
        elif automatic and path_to_sample:
                generate_all_samples(path_to_sample)
        elif boardfile and testfile and outfile:
-               generate_one_sample(boardfile,testfile,outfile)
+               # don't delete sample if compilation fails: user knows what 
he's doing
+               
generate_one_sample(boardfile,testfile,outfile,deleteiffailed=False)
        else:
                print >> sys.stderr, "Provide a board, a test file and an 
output file"
                sys.exit(255)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to