diff mbox

[RESEND] diffconfig: Gracefully exit if the default config files are not present

Message ID 20130816184056.GA30565@woodpecker.gentoo.org (mailing list archive)
State New, archived
Headers show

Commit Message

Mike Pagano Aug. 16, 2013, 6:40 p.m. UTC
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(-)

--
1.8.1.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Michal Marek Aug. 19, 2013, 8:40 p.m. UTC | #1
Dne 16.8.2013 20:40, Mike Pagano napsal(a):
> 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(-)

Applied to kbuild.git#kconfig, thanks.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 = []