From: <ai...@us...> - 2004-02-13 18:58:02
|
Update of /cvsroot/plplot/plplot/examples/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11786 Modified Files: pythondemos.py Log Message: Adaptation (works for all python's from 1.5 onward, correct example ranges, and proper globals and locals argument for __import__) of Rafael's privately communicated idea for delivering proper return code when one of the examples fails. Works like a charm if a bad example is inserted. Index: pythondemos.py =================================================================== RCS file: /cvsroot/plplot/plplot/examples/python/pythondemos.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pythondemos.py 7 Feb 2004 00:47:44 -0000 1.8 +++ pythondemos.py 13 Feb 2004 18:52:04 -0000 1.9 @@ -14,25 +14,22 @@ # Initialize plplot plinit() -import xw01 -import xw02 -import xw03 -import xw04 -import xw05 -import xw06 -import xw07 -import xw08 -import xw09 -import xw10 -import xw11 -import xw12 -import xw13 # xw14.py must be standalone so cannot be run from pythondemos.py -import xw15 -import xw16 # xw17.py must be standalone and interactive so cannot be run from pythondemos.py -import xw18 -import xw19 + +failed = [] +for i in range(1, 14) + [15, 16, 18, 19]: + script = 'xw' + '%02d' % i + try: + __import__(script, globals(), locals(), []) + except: + failed.append(script) # Terminate plplot plend() + +if len(failed) != 0: + import string + print "Failed script(s): " + string.join(failed,", ") + sys.exit(1) + |