Fix R description parsing for last field in the file

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
Patrick McCarty
2019-10-30 10:24:34 -07:00
parent a87515e7fa
commit 2e014238df
+4 -2
View File
@@ -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(' ,')