mirror of
https://git.yoctoproject.org/poky
synced 2026-07-16 03:47:03 +00:00
bitbake: codeparser: Add function decorators for vardeps
Adds bb.parse.vardeps bb.parse.excludevardeps function decorators that can be used to explicitly add or exclude variables from a python function parsed by bitbake (Bitbake rev: 030fb3dee067640a3a50f24a53d200bdb5048376) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
af91ed1691
commit
820824f5fe
@@ -176,4 +176,41 @@ def get_file_depends(d):
|
||||
dep_files.append(os.path.abspath(fn))
|
||||
return " ".join(dep_files)
|
||||
|
||||
def vardeps(*varnames):
|
||||
"""
|
||||
Function decorator that can be used to instruct the bitbake dependency
|
||||
parsing to add a dependency on the specified variables names
|
||||
|
||||
Example:
|
||||
|
||||
@bb.parse.vardeps("FOO", "BAR")
|
||||
def my_function():
|
||||
...
|
||||
|
||||
"""
|
||||
def inner(f):
|
||||
if not hasattr(f, "bb_vardeps"):
|
||||
f.bb_vardeps = set()
|
||||
f.bb_vardeps |= set(varnames)
|
||||
return f
|
||||
return inner
|
||||
|
||||
def vardepsexclude(*varnames):
|
||||
"""
|
||||
Function decorator that can be used to instruct the bitbake dependency
|
||||
parsing to ignore dependencies on the specified variable names in the code
|
||||
|
||||
Example:
|
||||
|
||||
@bb.parse.vardepsexclude("FOO", "BAR")
|
||||
def my_function():
|
||||
...
|
||||
"""
|
||||
def inner(f):
|
||||
if not hasattr(f, "bb_vardepsexclude"):
|
||||
f.bb_vardepsexclude = set()
|
||||
f.bb_vardepsexclude |= set(varnames)
|
||||
return f
|
||||
return inner
|
||||
|
||||
from bb.parse.parse_py import __version__, ConfHandler, BBHandler
|
||||
|
||||
Reference in New Issue
Block a user