From 423dd2f7cdcb5181ec1e7029ee700e1685c38483 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Thu, 14 Feb 2013 12:28:32 +0100 Subject: bitbake: ConfHandler: Use re.X to make long regexp more readable The __config_regexp__ in ConfHandler is quite long, and using re.X to break the expression onto several lines make it a bit easier to read. (Bitbake rev: 54dce9e14ab0657d76f0d0ae22eef7fab8e8950d) Signed-off-by: Olof Johansson Signed-off-by: Richard Purdie --- bitbake/lib/bb/parse/parse_py/ConfHandler.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 4b62a3a5eb..3255c8beb8 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -29,7 +29,30 @@ import logging import bb.utils from bb.parse import ParseError, resolve_file, ast, logger -__config_regexp__ = re.compile( r"(?Pexport\s*)?(?P[a-zA-Z0-9\-~_+.${}/]+?)(\[(?P[a-zA-Z0-9\-_+.]+)\])?\s*((?P:=)|(?P\?\?=)|(?P\?=)|(?P\+=)|(?P=\+)|(?P=\.)|(?P\.=)|=)\s*(?!'[^']*'[^']*'$)(?!\"[^\"]*\"[^\"]*\"$)(?P['\"])(?P.*)(?P=apo)$") +__config_regexp__ = re.compile( r""" + ^ + (?Pexport\s*)? + (?P[a-zA-Z0-9\-~_+.${}/]+?) + (\[(?P[a-zA-Z0-9\-_+.]+)\])? + + \s* ( + (?P:=) | + (?P\?\?=) | + (?P\?=) | + (?P\+=) | + (?P=\+) | + (?P=\.) | + (?P\.=) | + = + ) \s* + + (?!'[^']*'[^']*'$) + (?!\"[^\"]*\"[^\"]*\"$) + (?P['\"]) + (?P.*) + (?P=apo) + $ + """, re.X) __include_regexp__ = re.compile( r"include\s+(.+)" ) __require_regexp__ = re.compile( r"require\s+(.+)" ) __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/]+)$" ) -- cgit v1.2.3-54-g00ecf