From patchwork Sun Sep 23 22:47:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973771 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN140QWlz9s9N for ; Mon, 24 Sep 2018 08:53:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CAB93C21F41; Sun, 23 Sep 2018 22:51:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 31447C21F82; Sun, 23 Sep 2018 22:48:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 381E2C21F7E; Sun, 23 Sep 2018 22:48:03 +0000 (UTC) Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by lists.denx.de (Postfix) with ESMTPS id 05AFEC21F64 for ; Sun, 23 Sep 2018 22:47:59 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id n135-v6so3578392vke.17 for ; Sun, 23 Sep 2018 15:47:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=SU9ItMeHyDcfbXcs5250sbusrAC3/FIuOG1WR8KyOfQ=; b=mmQvnyET/I5wO3/43l8VHfLK0XBNIwnn93kyo2BwlWQmhpPqHAtxFfCDUJ6dwJSERP GFxyMnPTnU980qaxog4VlZoC4g8O7qlR6fCgHLm3GljD46M7T9hvNajAavwyPduGzrGx 1pfymtY+TcFxPyCbrSQGaH2tPYvbQHLHZSTCWgAwXTeuzgLMDdCSM4kdC1jh5Eo4eP8k BXJEW15fsOA/Y50vU93QDCqe4eyoXwx5/D0i8gpuDn6ZUtraEGu6mEnkGNSNrFW4dURx OeZJTM0ch2hgK4gHRhlgPtaZYzAYYytLXK9DjxzBwlJbvR2UpA9m/FiX19HZ2fOWESl6 B7SQ== X-Gm-Message-State: APzg51ALlpMCsvxqEhGAYnbAAVx295IYDtnjNk+grFLc+Fr2oAXxcLfb rZ2wyP+DomIqUvhA5LRDDT6rzcc= X-Google-Smtp-Source: ANB0VdY8EFQyCqwuvhpIomMcVPtgLGsg/zhS7ujCofxiMrzbx/bgubjpI5o3poYETIAQmlXShwN0Sjo= X-Received: by 2002:ab0:6654:: with SMTP id b20-v6mr2379017uaq.8.1537742878163; Sun, 23 Sep 2018 15:47:58 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:27 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-16-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 15/15] patman: Don't clear progress in tout unless it was used X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present calling Uninit() always called ClearProgress() which outputs a \r character as well as spaces to remove any progress information on the line. This can mess up the normal output of binman and other tools. Fix this by outputing this only when progress information has actually been previous written. Signed-off-by: Simon Glass --- tools/patman/tout.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/patman/tout.py b/tools/patman/tout.py index 4cd49e1c685..4957c7ae1df 100644 --- a/tools/patman/tout.py +++ b/tools/patman/tout.py @@ -15,6 +15,8 @@ NOTICE = 2 INFO = 3 DEBUG = 4 +in_progress = False + """ This class handles output of progress and other useful information to the user. It provides for simple verbosity level control and can @@ -48,9 +50,11 @@ def UserIsPresent(): def ClearProgress(): """Clear any active progress message on the terminal.""" - if verbose > 0 and stdout_is_tty: + global in_progress + if verbose > 0 and stdout_is_tty and in_progress: _stdout.write('\r%s\r' % (" " * len (_progress))) _stdout.flush() + in_progress = False def Progress(msg, warning=False, trailer='...'): """Display progress information. @@ -58,6 +62,7 @@ def Progress(msg, warning=False, trailer='...'): Args: msg: Message to display. warning: True if this is a warning.""" + global in_progress ClearProgress() if verbose > 0: _progress = msg + trailer @@ -65,6 +70,7 @@ def Progress(msg, warning=False, trailer='...'): col = _color.YELLOW if warning else _color.GREEN _stdout.write('\r' + _color.Color(col, _progress)) _stdout.flush() + in_progress = True else: _stdout.write(_progress + '\n')