File: win.py

package info (click to toggle)
pymol 2.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 43,400 kB
  • sloc: cpp: 482,465; python: 81,253; ansic: 27,428; sh: 94; makefile: 32; csh: 8
file content (103 lines) | stat: -rw-r--r-- 1,943 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import os
import sys
import re
import glob
import string
import traceback
import time

# list of tests to run ...

# prefixes
# C = command line scripts
# G = graphics and internal GUI

standard_prefixes = ['C', 'G' ]

# uniform parameter handling

argv = sys.argv

if len(argv):
   if re.search("\.py$",argv[0]):
      argv = argv[1:]

# ---

pymol = "pymol"
cmmd = "c:\pymolws\pymol.exe "
cmp = "cmp"
ref = "ref"
inp = "inp"
tmp = "tmp"

if not os.path.exists(cmp):
   os.mkdir(cmp)

if not os.path.exists(tmp):
   os.mkdir(tmp)

if len(argv)>1:
   tests = argv
else:
   tests = standard_prefixes

for test in tests:
   flist = glob.glob( inp+"/"+test+"*" )
   cvs = inp+"/CVS"
   if cvs in flist:
      flist.remove(cvs)
   flist.sort()
   for ifil in flist:
      # get options
      f = open(ifil)
      opt = string.strip(f.readline())
      opt = re.sub("^\s*\#","",opt)
      f.close()
      
      tst = re.sub(r".*/|.*\\","",ifil) # get exact test name without suffix
      tst = re.sub(r"\..*","",tst)
      
      print " run_tests: "+tst+"..."
      
      syscmd = cmmd+" -x -d pwd "+opt+" "+ifil+" > tmp.txt 2>&1"
      print syscmd
      #os.system("c:\\pymolws\\pymol.exe")
      os.system(syscmd)
      # generate log file
 
      f = open("tmp.txt")
      g = open("cmp\\"+tst+".log","w")

      echo = 0 
      while 1:
         l = f.readline()
         if not l: break
         ll=string.strip(l)
         if ll=='BEGIN-LOG':
            echo = 1
         elif ll=='END-LOG':
            echo = 0
         elif echo:
            g.write(l)

      f.close()
      g.close()

# now compare

      f = open("cmp\\"+tst+".log","r")
      g = open("ref\\"+tst+".log","r")
      while 1:
         lf = f.readline()
         lg = g.readline()
         if (not lf) and not (lg):
            break
         if string.strip(lf)!=string.strip(lg):
            print "<",lf
            print ">",lg

print "done"
time.sleep(360)

#