From patchwork Sun Jul 24 14:17:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 72662 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp720641qga; Sun, 24 Jul 2016 07:18:50 -0700 (PDT) X-Received: by 10.194.97.73 with SMTP id dy9mr11001986wjb.132.1469369930465; Sun, 24 Jul 2016 07:18:50 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id v10si19821303wmf.49.2016.07.24.07.18.50; Sun, 24 Jul 2016 07:18:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 14833A7714; Sun, 24 Jul 2016 16:18:40 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vmjw_rdN7e0X; Sun, 24 Jul 2016 16:18:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 85022A7710; Sun, 24 Jul 2016 16:18:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 09A0EA75F3 for ; Sun, 24 Jul 2016 16:18:22 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EPW3h5-Z4SIX for ; Sun, 24 Jul 2016 16:18:21 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by theia.denx.de (Postfix) with ESMTPS id 3D107A75CE for ; Sun, 24 Jul 2016 16:18:17 +0200 (CEST) Received: from grover.sesame (FL1-119-242-215-193.osk.mesh.ad.jp [119.242.215.193]) (authenticated) by conuserg-08.nifty.com with ESMTP id u6OEHflQ008919; Sun, 24 Jul 2016 23:17:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com u6OEHflQ008919 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1469369869; bh=2v/tHxXWemtFUMUDTz9jtvdbMsqU/DWGhczeG/EjADM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pcHiESEJtXpJ0rJG612D4TGdoExIjwf5YdvB5tqAr4CLNvWFltcZqPd3y+o6KWPCh t+D/X+JmcKeCyrzoVPt/kpMMv5EQsuSvsInGQDTVrFYrpS0Bvak9cWyF6myh/ESMyN T09rMze5a7kDtzG0eKiuyYqD7TcPQccPus7tLBpIkK27IPtunLIOT1GYrDdxnXzydb 6fiFik4uY/xEVnHO/omyN5A3II3lo6sRatGO3Z5Ja6lCLO3PU8Y5u9X6Jz9fblNsVD ZA2eifME7Kx/FfWTemw6jrYsdnkq6rZ6gOd4fTQOq4dYqiO+b+EQ+EqZR29RZEcGKH C1lAZvQOh+CJg== X-Nifty-SrcIP: [119.242.215.193] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sun, 24 Jul 2016 23:17:38 +0900 Message-Id: <1469369859-14277-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469369859-14277-1-git-send-email-yamada.masahiro@socionext.com> References: <1469369859-14277-1-git-send-email-yamada.masahiro@socionext.com> Cc: Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH 3/4] tools: moveconfig: show result of header cleaning in color mode X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This commit makes the tool show the cleaned lines in red if the --color option is given. Signed-off-by: Masahiro Yamada --- tools/moveconfig.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 27bd958..69701d4 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -356,7 +356,7 @@ def extend_matched_lines(lines, matched, pre_pattern, post_pattern, extend_pre, matched += extended_matched matched.sort() -def cleanup_one_header(header_path, patterns, dry_run): +def cleanup_one_header(header_path, patterns, options): """Clean regex-matched lines away from a file. Arguments: @@ -406,16 +406,17 @@ def cleanup_one_header(header_path, patterns, dry_run): tofile=os.path.join('b', header_path)) for line in diff: - print line, + print color_text(options.color and line[0] == '-' and line[1] != '-', + COLOR_LIGHT_RED, line), - if dry_run: + if options.dry_run: return with open(header_path, 'w') as f: for line in tolines: f.write(line) -def cleanup_headers(configs, dry_run): +def cleanup_headers(configs, options): """Delete config defines from board headers. Arguments: @@ -441,7 +442,7 @@ def cleanup_headers(configs, dry_run): for filename in filenames: if not fnmatch.fnmatch(filename, '*~'): cleanup_one_header(os.path.join(dirpath, filename), - patterns, dry_run) + patterns, options) ### classes ### class Progress: @@ -1115,7 +1116,7 @@ def main(): move_config(configs, options) if configs: - cleanup_headers(configs, options.dry_run) + cleanup_headers(configs, options) if __name__ == '__main__': main()