2 |
|
|
3 |
|
# A script to compare the provenance of two input root files. |
4 |
|
# It prints out informations about those modules which are common to the input files, |
5 |
< |
# but whose parameters are set to different values, and about those modules |
5 |
> |
# but whose parameters are setted to different values, and about those modules |
6 |
|
# present only in one of the two files. |
7 |
|
# According to the level of verbosity, it will be report the name of these modules |
8 |
|
# and details about the parameters and their values. |
12 |
|
from optparse import OptionParser |
13 |
|
import sys |
14 |
|
from subprocess import Popen, PIPE, STDOUT |
15 |
< |
from PhysicsTools.PythonAnalysis.read_provenance import * |
16 |
< |
from PhysicsTools.PythonAnalysis.diff_provenance import * |
15 |
> |
from readProv import * |
16 |
> |
from diffProv import * |
17 |
|
|
18 |
|
|
19 |
|
usage = "usage: %prog filename1 filename2" |
21 |
|
parser.add_option("-v", "--verbosity_level", dest="verbose", help="[0] to print short message [1], to print details about the differences of modules common to both files, [2] to print all the details about the differences between the two files") |
22 |
|
(options, args) = parser.parse_args() |
23 |
|
|
24 |
– |
# check whether all needed options are given |
24 |
|
if len(args) != 2: |
25 |
< |
parser.print_help() |
26 |
< |
sys.exit() |
28 |
< |
|
25 |
> |
print 'Incorrect usage' |
26 |
> |
|
27 |
|
def provenance(args): |
28 |
|
cmd="edmProvDump "+args |
29 |
|
if sys.platform == "linux2": |
37 |
|
file.write(provenance) |
38 |
|
|
39 |
|
return s |
40 |
< |
|
41 |
< |
prov1=provenance(args[0]) |
42 |
< |
prov2=provenance(args[1]) |
40 |
> |
try: |
41 |
> |
prov1=provenance(args[0]) |
42 |
> |
prov2=provenance(args[1]) |
43 |
> |
except IndexError: |
44 |
> |
print "Specify input file names\nType 'edmProvDiff -h' to visualize the arguments needed" |
45 |
|
f=filereader() |
46 |
|
module1=f.readfile(prov1) |
47 |
|
module2=f.readfile(prov2) |
48 |
|
d=difference(options.verbose) |
49 |
|
d.module_diff(module1,module2,args[0],args[1]) |
50 |
|
|
51 |
+ |
|