From a88302bcfbf73f9b8b50bea593beb82534bfcc63 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 15 Dec 2018 14:03:14 +0100 Subject: Fix user-defined preprocessor function example code The functions must be defined before they can be put into 'functions'. --- kconfiglib.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index ee78e5e..f3c51b1 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -456,14 +456,8 @@ module being run by default, as well as installation directories. If the KCONFIG_FUNCTIONS environment variable is set, it gives a different module name to use instead of 'kconfigfunctions'. -The imported module is expected to define a dictionary named 'functions', with -the following format: - - functions = { - "my-fn": (my_fn, , /None), - "my-other-fn": (my_other_fn, , /None), - ... - } +The imported module is expected to define a global dictionary named 'functions' +that maps function names to Python functions, as follows: def my_fn(kconf, name, arg_1, arg_2, ...): # kconf: @@ -482,6 +476,12 @@ the following format: def my_other_fn(kconf, name, arg_1, arg_2, ...): ... + functions = { + "my-fn": (my_fn, , /None), + "my-other-fn": (my_other_fn, , /None), + ... + } + ... and are the minimum and maximum number of arguments -- cgit v1.2.3