Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9BB9C433EF for ; Tue, 12 Jul 2022 21:14:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EAE1A84195; Tue, 12 Jul 2022 23:14:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="XuGISTLd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8A7AC84013; Tue, 12 Jul 2022 23:14:06 +0200 (CEST) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 75113841C2 for ; Tue, 12 Jul 2022 23:14:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82e.google.com with SMTP id ck6so10435007qtb.7 for ; Tue, 12 Jul 2022 14:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Xoa7uNZTmf7zDBTo4yPZ71wTKyLOVu4FPgYaQuCwrx8=; b=XuGISTLdmJCpniQCl6zjyfxExypBmM0Bae4Hc4QBoIIOr8boj/Z/FAOsNhilT5g07p ztdiQ5B32EwmtSOmbjZJJFc7MYDhv7uNFc8UTdUaWq4Y/6Og1ENKx60QHtJMx0ppy6GQ Tcn+tbmmxzFn+CkBwxQosFn10S42utNKTBLxw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Xoa7uNZTmf7zDBTo4yPZ71wTKyLOVu4FPgYaQuCwrx8=; b=7MvY2hQ2d3Ot6k2LndaR/LRIyRSvZ0DItuY+g9RW7Na9dTMLRJv1OwhBiM/mTtminy K3KDujsgMaVIjZHNe6tMVFYDZZVfUYwVhvDzfvMx0pYwKx/rPKj4uLcO0ht6IQdK58pA KampXWUNDFrboi+/y+28kdQ4yVpkxAaRXi19XKU7Ms9Nwgbme19Gn7jYltxDLT0WboZO 1cc1m8Z729g79KAVaTm5pwWgvXBRbOqV991usXCadeTqYOtBFVEktaA6Qml1qJcGVUEc Ch3n7p7uQYrc0WDsjMRxMj4L4PnQFyiyk7uB91o4DrtnoLkRi3976hOzgN4d0kM9xMyU P0rQ== X-Gm-Message-State: AJIora8JABmKCW/F5bJ6jRo/U534tm6F1cynpdPJtTl4/ANWisWQYEhA 8DHPegY3O36VdFczooe2Q+dvmeS7MYJToQ== X-Google-Smtp-Source: AGRyM1vgl8X2LMq9YnxmT71iSV4D1Q39uq4rQ0P6BG0DQGnglaO50SEB27tXxkpiZqjEQ+2t7Km+ug== X-Received: by 2002:a05:622a:553:b0:31e:acc3:c2cd with SMTP id m19-20020a05622a055300b0031eacc3c2cdmr15147020qtx.417.1657660441815; Tue, 12 Jul 2022 14:14:01 -0700 (PDT) Received: from bill-the-cat.lan (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id bk20-20020a05620a1a1400b006b5b33915besm296309qkb.85.2022.07.12.14.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 14:14:01 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: wd@denx.de, Heinrich Schuchardt Subject: [gitdm v2] reports.py: Add very basic rST output Date: Tue, 12 Jul 2022 17:14:00 -0400 Message-Id: <20220712211400.3140459-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add a -R option to gitdm to allow for reStructuredText output and add some very simple table generation. We assume that whatever uses this output will be including it in other documents and we only concern ourselves with making tables. Give ourselves 36 characters to fill in the nae field, as this tends to be long enough and can be corrected manually in the cases where it's slightly too short still. Cc: Heinrich Schuchardt Signed-off-by: Tom Rini --- Changes in v2: - Rework how we declare a table, per Heinrich --- gitdm | 5 ++++- reports.py | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gitdm b/gitdm index b837f0aafe27..3568d08f55af 100755 --- a/gitdm +++ b/gitdm @@ -59,6 +59,7 @@ FileReport = None # -D Output date statistics # -f file Write touched-files report to # -h hfile HTML output to hfile +# -R rfile reStructuredText output to rfile # -H file Export individual developer raw data as CSV # -l count Maximum length for output lists # -n Use numstats instead of generated patch from git log @@ -80,7 +81,7 @@ def ParseOpts(): global ReportByFileType, ReportUnknowns, CompanyFilter, FileReport global HackersCSV - opts, rest = getopt.getopt(sys.argv[1:], 'ab:dC:c:Df:H:h:l:no:p:r:stUuwx:yz') + opts, rest = getopt.getopt(sys.argv[1:], 'ab:dC:c:Df:H:h:l:no:p:r:R:stUuwx:yz') for opt in opts: if opt[0] == '-a': AkpmOverLt = 1 @@ -111,6 +112,8 @@ def ParseOpts(): elif opt[0] == '-r': print('Filter on "%s"' % (opt[1])) FileFilter = re.compile(opt[1]) + elif opt[0] == '-R': + reports.SetrSTOutput(open(opt[1], 'w')) elif opt[0] == '-s': AuthorSOBs = 0 elif opt[0] == '-t': diff --git a/reports.py b/reports.py index 39c237bdae00..782ebb8fb032 100644 --- a/reports.py +++ b/reports.py @@ -14,6 +14,7 @@ import sys Outfile = sys.stdout HTMLfile = None +rSTfile = None ListCount = 999999 @@ -25,6 +26,10 @@ def SetHTMLOutput(file): global HTMLfile HTMLfile = file +def SetrSTOutput(file): + global rSTfile + rSTfile = file + def SetMaxList(max): global ListCount ListCount = max @@ -40,10 +45,21 @@ THead = '''

%s ''' +RHead = ''' +.. table:: %s + :widths: auto + + ==================================== ===== + Name Count + ==================================== ===== +''' + def BeginReport(title): Outfile.write('\n%s\n' % title) if HTMLfile: HTMLfile.write(THead % title) + if rSTfile: + rSTfile.write(RHead % title) TRow = ' %s%d%.1f%%\n' TRowStr = ' %s%d%s\n' @@ -54,6 +70,8 @@ def ReportLine(text, count, pct): Outfile.write ('%-25s %4d (%.1f%%)\n' % (text, count, pct)) if HTMLfile: HTMLfile.write(TRow % (text, count, pct)) + if rSTfile: + rSTfile.write(" %-36s %d (%.1f%%)\n" % (text.strip(), count, pct)) def ReportLineStr(text, count, extra): if count == 0: @@ -61,10 +79,14 @@ def ReportLineStr(text, count, extra): Outfile.write ('%-25s %4d %s\n' % (text, count, extra)) if HTMLfile: HTMLfile.write(TRowStr % (text, count, extra)) + if rSTfile: + rSTfile.write('%-36s %d %s\n' % (text, count, extra)) def EndReport(): if HTMLfile: HTMLfile.write('\n\n') + if rSTfile: + rSTfile.write(' ==================================== =====\n\n') # # Comparison and report generation functions. -- 2.25.1