From a4eaf6e80ca18a4fff3b8729a19c234f88b3b172 Mon Sep 17 00:00:00 2001 From: Punit Vara Date: Fri, 30 Jun 2017 10:40:57 +0530 Subject: [PATCH] scripts: Fix string pattern on byte like objects error This patch fixes following error of python script. TypeError: cannot use a string pattern on a bytes-like object Jira: ZEP-2290 Signed-off-by: Punit Vara --- .shippable.yml | 3 ++- scripts/filter-known-issues.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.shippable.yml b/.shippable.yml index 85ec4c9488c..9467e03ef63 100644 --- a/.shippable.yml +++ b/.shippable.yml @@ -52,7 +52,8 @@ build: echo "- Building Documentation"; echo "Commit range:" ${COMMIT_RANGE} make htmldocs > doc.log 2>&1; - python2 ./scripts/filter-known-issues.py --config-dir .known-issues/doc/ doc.log > doc.warnings; + ./scripts/filter-known-issues.py --config-dir .known-issues/doc/ doc.log > doc.warnings; + if [ "$?" != 0 ]; then echo " ==> Error running filter script" exit 1 diff --git a/scripts/filter-known-issues.py b/scripts/filter-known-issues.py index 1c4ea5b8d5a..f09bb8a4329 100755 --- a/scripts/filter-known-issues.py +++ b/scripts/filter-known-issues.py @@ -43,8 +43,8 @@ exclude_regexs = [] # first is a list of one or more comment lines # followed by a list of non-comments which describe a multiline regex config_regex = \ - "(?P(^\s*#.*\n)+)" \ - "(?P(^[^#].*\n)+)" + b"(?P(^\s*#.*\n)+)" \ + b"(?P(^[^#].*\n)+)" def config_import_file(filename): """ @@ -72,7 +72,7 @@ def config_import_file(filename): raise logging.debug("%s: found regex at bytes %d-%d: %s", filename, m.start(), m.end(), regex) - if '#WARNING' in comment: + if b'#WARNING' in comment: exclude_regexs.append((r, origin, ('warning',))) else: exclude_regexs.append((r, origin, ()))