From 2e014238df0cd7bbd6811278e718f7202d7ef6e9 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Wed, 30 Oct 2019 10:24:34 -0700 Subject: [PATCH] Fix R description parsing for last field in the file Signed-off-by: Patrick McCarty --- autospec/buildreq.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autospec/buildreq.py b/autospec/buildreq.py index 9bc28c7..5ac9b55 100644 --- a/autospec/buildreq.py +++ b/autospec/buildreq.py @@ -314,8 +314,10 @@ def _get_desc_field(field, desc): create the list. """ val = [] - # Values may span multiple lines... - pat = re.compile(r"^" + field + r":(.*?)(?=\n\S+:)", re.MULTILINE | re.DOTALL) + # Note that fields may appear on any line, and values may span multiple + # lines. The end of the match is captured by either a lookahead assertion + # for the "next" field in the file, or \Z, which matches EOF in this case. + pat = re.compile(r"^" + field + r":(.*?)((?=\n\S+:)|\Z)", re.MULTILINE | re.DOTALL) match = pat.search(desc) if match: joined = match.group(1).replace("\n", " ").strip(' ,')