CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
submit.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # to submit a benchmark webpage to the validation website
3 # author: Colin
4 
5 import shutil, sys, os, valtools
6 
7 from optparse import OptionParser
8 
9 
10 
11 
12 parser = OptionParser()
13 parser.usage = "usage: %prog"
14 
15 parser.add_option("-e", "--extension", dest="extension",
16  help="adds an extension to the name of this benchmark",
17  default=None)
18 
19 parser.add_option("-f", "--force", dest="force",action="store_true",
20  help="force the submission. Be careful!",
21  default=False)
22 
23 
24 (options,args) = parser.parse_args()
25 
26 
27 
28 if len(args)!=0:
29  parser.print_help()
30  sys.exit(1)
31 
32 
33 website = valtools.website()
34 bench = valtools.benchmark( options.extension )
35 localBench = valtools.benchmark()
36 print 'submitting from local: ', localBench
37 print ' to: ', bench
38 
39 comparisons = website.listComparisons( bench )
40 if len(comparisons)>0:
41  print 'You are about to make the following list of comparison pages obsolete. These pages will thus be removed:'
42  print comparisons
43 
44  answer = None
45  while answer != 'y' and answer != 'n':
46  answer = raw_input('do you agree? [y/n]')
47 
48  if answer == 'n':
49  sys.exit(0)
50 
51 # check that the user can write in the website
52 website.writeAccess()
53 bench.makeRelease( website )
54 
55 
56 if bench.exists( website ) == True:
57  if options.force == False:
58  print 'please use the -e option to choose another extension'
59  print ' e.g: submit.py -e Feb10'
60  print 'or force it.'
61  sys.exit(1)
62  else:
63  print 'overwriting...'
64  shutil.rmtree(bench.benchmarkOnWebSite(website))
65 
66 
67 # local benchmark. this one does not have an extension!
68 
69 shutil.copytree(localBench.fullName(), bench.benchmarkOnWebSite(website) )
70 print 'done. Access your benchmark here:'
71 print bench.benchmarkUrl( website )
72 
73 # removing comparisons
74 # COMPARISONS COULD ALSO BE REDONE.
75 for comparison in comparisons:
76  rm = 'rm -rf '+comparison
77  os.system(rm)
78