aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMike Pagano <mpagano@gentoo.org>2013-08-16 14:40:56 -0400
committerMichal Marek <mmarek@suse.cz>2013-08-19 16:33:32 -0400
commit6bf2e84b8cebc4c53bf44343ed4e9b88aa73e34d (patch)
treec030d050ac801da1f7f82ba4439e7e4577883531 /scripts
parent11097a0367e48954ecf616f9b0df48d86835dd0d (diff)
diffconfig: Gracefully exit if the default config files are not present
Handle gracefully the instance where config files are not present. Compatible with python versions 2.5, 2.6 and 2.7. The try/except is forward compatible with python version 3 once the entire script is ported. Signed-off-by: Mike Pagano <mpagano@gentoo.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/diffconfig9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/diffconfig b/scripts/diffconfig
index b91f3e34d44d..0ee65839f7aa 100755
--- a/scripts/diffconfig
+++ b/scripts/diffconfig
@@ -94,8 +94,13 @@ def main():
94 configa_filename = sys.argv[1] 94 configa_filename = sys.argv[1]
95 configb_filename = sys.argv[2] 95 configb_filename = sys.argv[2]
96 96
97 a = readconfig(file(configa_filename)) 97 try:
98 b = readconfig(file(configb_filename)) 98 a = readconfig(file(configa_filename))
99 b = readconfig(file(configb_filename))
100 except (IOError):
101 e = sys.exc_info()[1]
102 print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
103 usage()
99 104
100 # print items in a but not b (accumulate, sort and print) 105 # print items in a but not b (accumulate, sort and print)
101 old = [] 106 old = []