4 # Important: This script is to be run from trunk/moon/test in WINDOWS
5 # This script grabs all the rendered pngs and tifs created by Silverlight
6 # and renames them as masters for Moonlight testing
14 print "\nUsage: saveMasters.py [--missing, --regen]\n"
18 # saveMasters.py --missing, --regen
25 longopts
= ['help','missing','regen']
26 opts
, args
= getopt
.getopt(sys
.argv
[1:],shortopts
, longopts
)
27 except getopt
.GetoptError
, err
:
33 if o
in ('-h','--help'):
36 if o
in ('-m','--missing'):
38 if o
in ('-r','--regen'):
41 if not (missing
or regen
):
45 files
= os
.listdir(os
.path
.join(os
.getcwd(),'xaml'))
52 testname
= curfile
[:-9]
53 if curfile
.endswith('.xaml.png'):
54 newfile
= curfile
[:-9] + 'Master.png'
56 if curfile
.endswith('.xaml.tif'):
57 newfile
= curfile
[:-9] + 'Master.tif'
60 curpath
= os
.path
.join('xaml',curfile
)
61 newpath
= os
.path
.join('harness','masters',newfile
)
64 if os
.path
.exists(newpath
):
65 print 'Deleting master for %s' % testname
67 new_masters
.append(testname
)
68 #print 'Moving %s to %s' % (curpath, newpath)
69 os
.rename(curpath
, newpath
)
71 else: # missing only - not regen
72 if os
.path
.exists(newpath
):
74 #print 'Master exists at %s' % newpath
76 new_masters
.append(testname
)
77 #new_masters_count += 1
78 #print 'Moving %s to %s' % (curpath, newpath)
79 os
.rename(curpath
, newpath
)
81 print "\n%s new masters found" % len(new_masters
)
82 for testname
in new_masters
:
83 print "\t%s" % testname
86 if __name__
== '__main__':