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 C9882C001DF for ; Sun, 16 Jul 2023 00:38:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6AF87863EE; Sun, 16 Jul 2023 02:37:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="E97AeEH6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5FBA58634D; Sun, 16 Jul 2023 02:37:37 +0200 (CEST) Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 E40C0861F7 for ; Sun, 16 Jul 2023 02:37:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-34574eb05f4so13895205ab.0 for ; Sat, 15 Jul 2023 17:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467850; x=1692059850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=stPzkRa5M8eQ4Os35ncWML4EA5boxxO312Ol9Z9rIo8=; b=E97AeEH60Gbz+sbejDnBSrxKwGs+A397JdE5s+Z1CrL6bq3GECHVfBqLBAe7R/ISYK oATON5dx9VDsxWOBdwKPN7Pa+RvZUmRFJkyUvb88SFAXDMrjSLHYNAjfY0wvINw2uDga cUWrgIQMmuAbdVBs2yXR+hCzvCvwZf+k4lPKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467850; x=1692059850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=stPzkRa5M8eQ4Os35ncWML4EA5boxxO312Ol9Z9rIo8=; b=Oujc8bmD9iiDrdtq+RDKiIVPt35TOJdV/Fl8+IQczTpMc/3/iV+G/YA7UtOW4cd0Zl 3D/jda3f5TL7CpNk2ishDqoo9clPr+TaMKNbh02EJBtvXXW/c4Z2ZirlEO3Uxfx6w/du otAwuIYeVY13foy2QgC150jJHJt552Lt1KVyc08ifEj2CYWPy9bRgqoZyC1JG37v0JP+ HPIFHKjPcdfkRrDsyUJdfaG5iis9CYvNcdAgk+3dfZOlAH3zGqfpNbDzvJjvFt1pAdF7 wU6gebfr+MAlCavPmgRuFoGyzCwzNYRaPAsg6isiYnUgi370TV5lCFvb/nsJkBw15fzH a7Xg== X-Gm-Message-State: ABy/qLaccyXFnG2BIgbLime/Xsp3UxOSgXDK2Xga3pHjzlI933ufcHs1 mB3OMS6/w5rMuvE3TkjOW1wZsyWrb+7yklBrujY= X-Google-Smtp-Source: APBJJlHa5Ki42ZnuqkiRPLP3gAeTY03CkhY+bhEioElYyfgVqvEnoyC0o/Y5jZJJCLCeiuVidBA7lQ== X-Received: by 2002:a92:d4cb:0:b0:346:7502:aeaa with SMTP id o11-20020a92d4cb000000b003467502aeaamr7305217ilm.18.1689467850483; Sat, 15 Jul 2023 17:37:30 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id t3-20020a05663801e300b0042b52dc77e3sm3510512jaq.158.2023.07.15.17.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:37:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 10/81] buildman: Tidy up common code in parse_file() Date: Sat, 15 Jul 2023 18:35:38 -0600 Message-ID: <20230716003718.231903-11-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.455.g037347b96a-goog In-Reply-To: <20230716003718.231903-1-sjg@chromium.org> References: <20230716003718.231903-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Use a function to add to the maintainers database, to avoid duplicating the same code twice. Signed-off-by: Simon Glass --- Changes in v3: - Add new patch to tidy up common code in parse_file() tools/buildman/boards.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 541c82ff9960..df57f278daad 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -345,6 +345,12 @@ class MaintainersDatabase: srcdir (str): Directory containing source code (Kconfig files) fname (str): MAINTAINERS file to be parsed """ + def add_targets(): + """Add any new targets""" + if targets: + for target in targets: + self.database[target] = (status, maintainers) + targets = [] maintainers = [] status = '-' @@ -382,14 +388,11 @@ class MaintainersDatabase: if match and not rear: targets.append(front) elif line == '\n': - for target in targets: - self.database[target] = (status, maintainers) + add_targets() targets = [] maintainers = [] status = '-' - if targets: - for target in targets: - self.database[target] = (status, maintainers) + add_targets() class Boards: -- 2.41.0.455.g037347b96a-goog