DPDK CI discussions
 help / color / mirror / Atom feed
From: ohilyard@iol.unh.edu
To: ci@dpdk.org
Cc: aconole@redhat.com, Owen Hilyard <ohilyard@iol.unh.edu>
Subject: [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes
Date: Fri, 24 Sep 2021 12:05:27 -0400	[thread overview]
Message-ID: <20210924160527.45602-2-ohilyard@iol.unh.edu> (raw)
In-Reply-To: <20210924160527.45602-1-ohilyard@iol.unh.edu>

From: Owen Hilyard <ohilyard@iol.unh.edu>

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 <ohilyard@iol.unh.edu>
---
 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


  reply	other threads:[~2021-09-24 16:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 16:05 [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier ohilyard
2021-09-24 16:05 ` ohilyard [this message]
2021-10-11 17:38   ` [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes Ali Alnubani
2021-10-11 17:53 ` [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier Ali Alnubani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210924160527.45602-2-ohilyard@iol.unh.edu \
    --to=ohilyard@iol.unh.edu \
    --cc=aconole@redhat.com \
    --cc=ci@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).