ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tools
PyUtils
bin
diffConfigs.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4
5
# @file: diffConfigs.py
6
# @purpose: check that 2 ConfigurationShelves have same content (both in
7
# configurables and properties)
8
# @author: Sebastien Binet <binet@cern.ch>
9
# @date: September 2008
10
#
11
# @example:
12
#
13
# diffConfigs ref.pkl chk.pkl
14
#
15
16
__author__ =
"Sebastien Binet"
17
18
import
sys
19
import
os
20
21
from
optparse
import
OptionParser
22
23
if
__name__ ==
"__main__"
:
24
25
parser = OptionParser(usage=
"usage: %prog [options] [-r] ref.pkl [-f] chk.pkl"
)
26
parser.add_option(
"-r"
,
27
"--ref"
,
28
dest =
"refFileName"
,
29
help =
"The path to the first ConfigurationShelve file to analyze"
)
30
parser.add_option(
"-f"
,
31
"--file"
,
32
dest =
"fileName"
,
33
help =
"The path to the second ConfigurationShelve file to analyze"
)
34
parser.add_option(
"-v"
,
35
"--verbose"
,
36
action =
"store_true"
,
37
dest =
"verbose"
,
38
default =
False
,
39
help =
"Switch to activate verbose printout"
)
40
41
42
(options, args) = parser.parse_args()
43
44
if
len(args) > 0
and
args[0][0] !=
"-"
:
45
options.refFileName = args[0]
46
pass
47
if
len(args) > 1
and
args[1][0] !=
"-"
:
48
options.fileName = args[1]
49
pass
50
51
if
options.fileName
is
None
or
options.refFileName
is
None
:
52
str(parser.print_help()
or
""
)
53
sys.exit(1)
54
pass
55
56
chkFileName = os.path.expandvars(os.path.expanduser(options.fileName))
57
refFileName = os.path.expandvars(os.path.expanduser(options.refFileName))
58
59
print
(
"::: comparing configurations:"
)
60
print
(
"::: ref: %s"
% refFileName)
61
print
(
"::: chk: %s"
% chkFileName)
62
from
AthenaCommon.ConfigurationShelve
import
cmpConfigs
63
ref, chk, report = cmpConfigs (ref=refFileName,
64
chk=chkFileName)
65
if
len(report)==0:
66
print
(
"::: all good"
)
67
sys.exit(0)
68
69
for
l
in
report:
print
(l)
70
print
(
"::: configurations differ !"
)
71
sys.exit(1)
Generated on
for ATLAS Offline Software by
1.17.0