From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D163A0548 for ; Fri, 24 Sep 2021 18:05:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6744741329; Fri, 24 Sep 2021 18:05:31 +0200 (CEST) Received: from mail-pg1-f226.google.com (mail-pg1-f226.google.com [209.85.215.226]) by mails.dpdk.org (Postfix) with ESMTP id E7B65412F8 for ; Fri, 24 Sep 2021 18:05:29 +0200 (CEST) Received: by mail-pg1-f226.google.com with SMTP id w8so10308559pgf.5 for ; Fri, 24 Sep 2021 09:05:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kYGE688UpM2t4hb3kdy2mrwiwJH3DTaQw8y2q2XjI3w=; b=hiA9qsfk0l/aFvVeZsoWmKj6sEBa9iKh45dLSQfdRgEufiD0Sizts6OAgoBfpjMeI4 TV/hhtzRFqO9JCYA4fuy2cVDHyqzf7tJiCmazXZamsQoQWNUyir+0a19ENWAt/I3zvKY iwHB/3Bh5PrmjHF/i9k0cV6FQF6ClHtfy9B3A= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=kYGE688UpM2t4hb3kdy2mrwiwJH3DTaQw8y2q2XjI3w=; b=nNdJwrQm/53I0XuhANU1BKNbRYwwn3Vl6FL1sHdT9PIO6GYqTfgjSoiLBOIgLRdB37 aPCdccCVXkVIF2JDf5nCvHGPiJaI5frP9wUO66X9yZ44PxLP0Pi7jMPsfSDtwfZevTQE FxpaH5kYGZfWyefk7sGfKR/OOF99Sbem1mta8H4nHa4xC4N1awOhubjDs6g4NtXRIroh 3ZRnjVfg8I1WTAssX4x19xZ4W55hkzimxxEUzh+wg4Gpa5MJyUpuc/K4BAuY7D34sVVp PltmSmYT0oND/JAya9DFgGqrpptz6lhdI5xI7x1QWGn1rce3TAu14geMLgHHmbT7LV05 UJsA== X-Gm-Message-State: AOAM5304j/PvHgO9aiyB8IVF8MCx4Proy2mtRf3YZWk4vYumRDwpxxqm WvF3REq/e/+T+NocV9yR2wmwYeHbIoVcW9D40KyrajAf06PtxoGan9inJE34gfYLoxxWlLT+8FS lpLxD+VsLBR4afOor9jLEco7fneFKU5w3gcEmCFemPLDMZ7RoeJYCEvA0/NshRAogvEiltFlI X-Google-Smtp-Source: ABdhPJwPOcKLo5z1Iok+Ebz8JBmq1jco/FOoa3jfPw4Q32Z2H9uC08c9y9cBqTZuCL9Q5L7nF8mZmDWHwepy X-Received: by 2002:a63:1504:: with SMTP id v4mr4419588pgl.151.1632499528970; Fri, 24 Sep 2021 09:05:28 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id p25sm2827074uaw.0.2021.09.24.09.05.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Sep 2021 09:05:28 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::105d]) by postal.iol.unh.edu (Postfix) with ESMTP id 4C37C605248B; Fri, 24 Sep 2021 12:05:28 -0400 (EDT) From: ohilyard@iol.unh.edu To: ci@dpdk.org Cc: aconole@redhat.com, Owen Hilyard Date: Fri, 24 Sep 2021 12:05:27 -0400 Message-Id: <20210924160527.45602-2-ohilyard@iol.unh.edu> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210924160527.45602-1-ohilyard@iol.unh.edu> References: <20210924160527.45602-1-ohilyard@iol.unh.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ci-bounces@dpdk.org Sender: "ci" From: Owen Hilyard The import statements in the file have been moved below the module doc comment per PEP 257. A sanity check has been added to find_filenames. Occasionally, due to how the community lab internally handles getting patches from patchworks, a patch will result in no diff. This patch adds handling for this case. Signed-off-by: Owen Hilyard --- tools/guess_git_tree.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/guess_git_tree.py b/tools/guess_git_tree.py index c9eef39..63892e1 100755 --- a/tools/guess_git_tree.py +++ b/tools/guess_git_tree.py @@ -1,20 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: (BSD-3-Clause AND GPL-2.0-or-later AND MIT) # Copyright 2019 Mellanox Technologies, Ltd -import os -import sys -import re -import argparse -import fnmatch - -from requests.exceptions import HTTPError - -from git_pw import config -from git_pw import api -from git_pw import utils - """ Description: This script uses the git-pw API to retrieve Patchwork's @@ -49,6 +37,17 @@ tree = maintainers.get_tree(files) """ +import os +import sys +import re +import argparse +import fnmatch + +from requests.exceptions import HTTPError + +from git_pw import config +from git_pw import api +from git_pw import utils MAINTAINERS_FILE_PATH = os.environ.get('MAINTAINERS_FILE_PATH') if not MAINTAINERS_FILE_PATH: @@ -93,6 +92,11 @@ def find_filenames(diff): - Moved _filename_re into the method. - Reduced newlines. """ + # sanity check diff + # for patches without any diff, it will try to run diff.replace + # while diff is None. just return an empty list + if diff is None: + return [] _filename_re = re.compile(r'^(---|\+\+\+) (\S+)') # normalise spaces diff = diff.replace('\r', '') -- 2.30.2