poky/meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py
Trevor Gamblin 4a6f38c532 patchtest: Add tests from patchtest oe repo
Copy the core components of the patchtest-oe repo into
meta/lib/patchtest in oe-core.

(From OE-Core rev: 257f64f4e4414b78981104aec132b067beb5a92a)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-14 15:20:08 +01:00

23 lines
761 B
Python

# signed-off-by pyparsing definition
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0
import pyparsing
import common
name = pyparsing.Regex('\S+.*(?= <)')
username = pyparsing.OneOrMore(common.worddot)
domain = pyparsing.OneOrMore(common.worddot)
# taken from https://pyparsing-public.wikispaces.com/Helpful+Expressions
email = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})")
email_enclosed = common.lessthan + email + common.greaterthan
signed_off_by_mark = pyparsing.Literal("Signed-off-by:")
signed_off_by = pyparsing.AtLineStart(signed_off_by_mark + name + email_enclosed)
patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_mark + name + email_enclosed)