From patchwork Fri Aug 9 13:13:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: johannes.thumshirn@men.de X-Patchwork-Id: 2841929 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D9EB9F295 for ; Fri, 9 Aug 2013 13:18:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4664C202B1 for ; Fri, 9 Aug 2013 13:18:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1FB1B202A7 for ; Fri, 9 Aug 2013 13:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967596Ab3HINSg (ORCPT ); Fri, 9 Aug 2013 09:18:36 -0400 Received: from mail1.bemta3.messagelabs.com ([195.245.230.162]:48661 "EHLO mail1.bemta3.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967587Ab3HINSf (ORCPT ); Fri, 9 Aug 2013 09:18:35 -0400 X-Greylist: delayed 383 seconds by postgrey-1.27 at vger.kernel.org; Fri, 09 Aug 2013 09:18:34 EDT Received: from [85.158.137.19:16026] by server-2.bemta-3.messagelabs.com id 73/C2-19293-9AAE4025; Fri, 09 Aug 2013 13:12:09 +0000 X-Env-Sender: Johannes.Thumshirn@men.de X-Msg-Ref: server-7.tower-39.messagelabs.com!1376053929!14905285!1 X-Originating-IP: [80.255.6.145] X-StarScan-Received: X-StarScan-Version: 6.9.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8056 invoked from network); 9 Aug 2013 13:12:09 -0000 Received: from unknown (HELO keys.men.de) (80.255.6.145) by server-7.tower-39.messagelabs.com with AES128-SHA encrypted SMTP; 9 Aug 2013 13:12:09 -0000 Received: from men-exch1.intra.men.de ([192.168.1.1]) by keys.men.de (PGP Universal service); Fri, 09 Aug 2013 15:12:09 +0200 X-PGP-Universal: processed; by keys.men.de on Fri, 09 Aug 2013 15:12:09 +0200 Received: from MEN-EX1.intra.men.de ([192.168.1.2]) by men-exch1.intra.men.de with Microsoft SMTPSVC(6.0.3790.4675); Fri, 9 Aug 2013 15:12:09 +0200 Received: from jtlinux (192.1.1.31) by MEN-EX1.intra.men.de (192.168.1.2) with Microsoft SMTP Server (TLS) id 14.1.438.0; Fri, 9 Aug 2013 15:12:09 +0200 Date: Fri, 9 Aug 2013 15:13:12 +0200 From: Johannes Thumshirn To: Tim Bird , Michal Marek CC: Sam Ravnborg , , Johannes Thumshirn , linux-kbuild Subject: [RESEND PATCH] kconfig: Make diffconfig work with Python 3 Message-ID: <20130809131305.GA8898@jtlinux> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [192.1.1.31] X-OriginalArrivalTime: 09 Aug 2013 13:12:09.0297 (UTC) FILETIME=[0DB82C10:01CE9502] Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adjust diffconfig to run cleanly on Python 3 (Tested with 3.3.2) and Python 2 (2.7.5) Signed-off-by: Johannes Thumshirn --- scripts/diffconfig | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 1.7.9.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 diff --git a/scripts/diffconfig b/scripts/diffconfig index b91f3e3..dd0e75b 100755 --- a/scripts/diffconfig +++ b/scripts/diffconfig @@ -10,7 +10,7 @@ import sys, os def usage(): - print """Usage: diffconfig [-h] [-m] [ ] + print ("""Usage: diffconfig [-h] [-m] [ ] Diffconfig is a simple utility for comparing two .config files. Using standard diff to compare .config files often includes extraneous and @@ -33,7 +33,7 @@ Example usage: EXT2_FS y -> n LOG_BUF_SHIFT 14 -> 16 PRINTK_TIME n -> y -""" +""") sys.exit(0) # returns a dictionary of name/value pairs for config items in the file @@ -54,23 +54,23 @@ def print_config(op, config, value, new_value): if merge_style: if new_value: if new_value=="n": - print "# CONFIG_%s is not set" % config + print("# CONFIG_%s is not set" % config) else: - print "CONFIG_%s=%s" % (config, new_value) + print("CONFIG_%s=%s" % (config, new_value)) else: if op=="-": - print "-%s %s" % (config, value) + print("-%s %s" % (config, value)) elif op=="+": - print "+%s %s" % (config, new_value) + print("+%s %s" % (config, new_value)) else: - print " %s %s -> %s" % (config, value, new_value) + print(" %s %s -> %s" % (config, value, new_value)) def main(): global merge_style # parse command line args if ("-h" in sys.argv or "--help" in sys.argv): - usage() + usage() merge_style = 0 if "-m" in sys.argv: @@ -79,13 +79,13 @@ def main(): argc = len(sys.argv) if not (argc==1 or argc == 3): - print "Error: incorrect number of arguments or unrecognized option" + print("Error: incorrect number of arguments or unrecognized option") usage() if argc == 1: # if no filenames given, assume .config and .config.old build_dir="" - if os.environ.has_key("KBUILD_OUTPUT"): + if 'KBUILD_OUTPUT' in os.environ: build_dir = os.environ["KBUILD_OUTPUT"]+"/" configa_filename = build_dir + ".config.old" @@ -94,8 +94,8 @@ def main(): configa_filename = sys.argv[1] configb_filename = sys.argv[2] - a = readconfig(file(configa_filename)) - b = readconfig(file(configb_filename)) + a = readconfig(open(configa_filename)) + b = readconfig(open(configb_filename)) # print items in a but not b (accumulate, sort and print) old = [] @@ -121,7 +121,7 @@ def main(): # now print items in b but not in a # (items from b that were in a were removed above) - new = b.keys() + new = list(b.keys()) new.sort() for config in new: print_config("+", config, None, b[config])