* [PATCH RESEND] diffconfig: Gracefully exit if the default config files are not present
@ 2013-08-16 18:40 Mike Pagano
2013-08-19 20:40 ` Michal Marek
0 siblings, 1 reply; 2+ messages in thread
From: Mike Pagano @ 2013-08-16 18:40 UTC (permalink / raw)
To: linux-kbuild
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>
---
scripts/diffconfig | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/diffconfig b/scripts/diffconfig
index b91f3e3..0ee6583 100755
--- a/scripts/diffconfig
+++ b/scripts/diffconfig
@@ -94,8 +94,13 @@ def main():
configa_filename = sys.argv[1]
configb_filename = sys.argv[2]
- a = readconfig(file(configa_filename))
- b = readconfig(file(configb_filename))
+ try:
+ a = readconfig(file(configa_filename))
+ b = readconfig(file(configb_filename))
+ except (IOError):
+ e = sys.exc_info()[1]
+ print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
+ usage()
# print items in a but not b (accumulate, sort and print)
old = []
--
1.8.1.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-19 20:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 18:40 [PATCH RESEND] diffconfig: Gracefully exit if the default config files are not present Mike Pagano
2013-08-19 20:40 ` Michal Marek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox