Lines Matching +full:- +full:- +full:flatten

1 # Copyright (c) 2011-2019, Ulf Magnusson
2 # SPDX-License-Identifier: ISC
9 from Kconfig (https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt)
27 $ wget -qO- https://raw.githubusercontent.com/ulfalizer/Kconfiglib/master/makefile.patch | git am
28 …$ wget -qO- https://raw.githubusercontent.com/ulfalizer/Kconfiglib/master/makefile.patch | patch -
30 Warning: Not passing -p1 to patch will cause the wrong file to be patched.
43 $ git am Kconfiglib/makefile.patch (or 'patch -p1 < Kconfiglib/makefile.patch')
53 ----------------
61 --------------
69 --------------------------------
89 ----------------------------------------------------
92 configuration. sys.argv[1] holds the name of the top-level Kconfig file
100 -------------------
127 CC_VERSION_TEXT (gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0)
142 Search the top-level Makefile for "Additional ARCH settings" to see other
193 In this example, A && B && C && D (the prompt condition) needs to be non-n for
209 select*ing* symbol. 'select' does not respect visibility, so non-visible
212 For non-bool/tristate symbols, it only matters whether the visibility is n or
213 non-n: m visibility acts the same as y visibility.
241 sym.visibility is non-0 (non-n) to see whether the user value will have an
250 top-level menu, the title of which is shown at the top in the standard
256 following the 'next' pointer. Usually, a non-None 'list' pointer indicates a
257 menu or Choice, but menu nodes for symbols can sometimes have a non-None 'list'
302 ---------- --------------
329 - The value of A && B is min(A.tri_value, B.tri_value)
331 - The value of A || B is max(A.tri_value, B.tri_value)
333 - The value of !A is 2 - A.tri_value
335 - The value of A = B is 2 (y) if A.str_value == B.str_value, and 0 (n)
358 ---------------------------
367 +--Kconfig
369 +--src
370 +--Kconfig
372 +--SubSystem1
373 +--Kconfig
375 +--ModuleA
376 +--Kconfig
391 'rsource' can be used to create "position-independent" Kconfig trees that can
396 -----------------
413 For example, the following statements will be no-ops if neither "foo" nor any
421 'source' and 'osource' are analogous to 'include' and '-include' in Make.
425 --------------------------
433 -----------------------
437 - KCONFIG_WARN_UNDEF: If set to 'y', warnings will be generated for all
450 - KCONFIG_WARN_UNDEF_ASSIGN: If set to 'y', warnings will be generated for
459 ---------------------------------------------
481 # Name of the user-defined function ("my-fn"). Think argv[0].
494 "my-fn": (my_fn, <min.args>, <max.args>/None),
495 "my-other-fn": (my_other_fn, <min.args>, <max.args>/None),
520 depends on $(my-fn,arg1,arg2)
531 User-defined preprocessor functions are called as they're encountered at parse
537 Preferably, user-defined functions should be stateless.
583 read-only, and some are implemented through @property magic.
590 Undefined symbols can be recognized by Symbol.nodes being empty -- see
640 'source "/foo/Kconfig"') are kept as-is.
643 top-level Kconfig file. If a file is source'd multiple times, it will
700 Gotcha: scripts/kconfig/Makefile might pass --defconfig=<defconfig> to
706 The menu node (see the MenuNode class) of the implicit top-level menu.
711 Can be changed with the 'mainmenu' statement (see kconfig-language.txt).
721 When 'warn' is False, the values of the other warning-related variables
771 right-hand side of the assignment verbatim.
784 out-of-tree builds. The C tools use this environment variable in the same
850 # Parsing-related
868 encoding="utf-8", suppress_traceback=False):
888 from the top-level directory, as environment variables will make sure
919 encoding (default: "utf-8"):
924 The "utf-8" default avoids exceptions on systems that are configured
932 Related PEP: https://www.python.org/dev/peps/pep-0538/
1011 # Make n/m/y well-formed symbols
1022 "error-if": (_error_if_fn, 2, 2),
1026 "warning-if": (_warning_if_fn, 2, 2),
1029 # Add any user-defined preprocessor functions
1078 # Open the top-level Kconfig file. Store the readline() method directly
1091 # Close the top-level Kconfig file. __self__ fetches the 'file' object
1097 # Do various menu tree post-processing
1120 check_dep_loop_sym = _check_dep_loop_sym # Micro-optimization
1414 Command-specific configuration filename - "allyes.config",
1708 # non-choice symbols, as selects don't affect choice
1916 that holds the top-level items.
1969 To get the string value of non-bool/tristate symbols, use
1971 all non-bool/tristate symbols have the tristate value 0 (n).
1980 # to monkey-patch things a bit here to reuse it.
2128 # https://docs.python.org/3/reference/compound_stmts.html#the-try-statement
2175 # doing in-place modification
2207 self.filename, self.linenr = self._include_path[-1]
2234 line = line[:-2] + self._readline()
2250 # checked in _next_line(). This special-casing gets rid of it and makes
2255 line = line[:-2] + self._readline()
2268 # used out there to force evaluation-related warnings to be generated.
2339 # Parses 's', returning a None-terminated list of tokens. Registers any
2364 # (accidentally) accepted stuff like "--help--" and "-help---".
2368 if s.strip(" \t\n-") == "help":
2402 # It's a non-const symbol, except we translate n, m, and y
2437 # Neither a keyword nor a non-const symbol
2450 val = s[i + 1:end_i - 1]
2463 val = expandvars(s[i + 1:end_i - 1]
2539 # None-terminating the token list makes token fetching simpler/faster
2547 # More of these could be added, but the single-use cases are inlined as an
2607 # Expand any macros in the left-hand side of the assignment (the
2620 # $(warning-if,$(foo),ops)), provided it expands to a blank string
2673 if i == -1:
2772 nesting -= 1
2809 # args[1..len(args)-1]. Plain variables are treated as functions
2830 var._n_expansions -= 1
2834 # Built-in or user-defined function
2838 if len(args) - 1 < min_arg or \
2839 (max_arg is not None and len(args) - 1 > max_arg):
2846 expected_args = "{}-{}".format(min_arg, max_arg)
2851 expected_args, len(args) - 1))
2978 # - glob() doesn't support globbing relative to a directory, so
2983 # - Sort the glob results to ensure a consistent ordering of
3261 "Note that modules are supported -- "
3285 # Reuse the tokens for the non-property line later
3327 "one help text -- only the last one will be used")
3329 # Micro-optimization. This code is pretty hot.
3332 # Find first non-blank (not all-space) line and get its
3344 len_ = len # Micro-optimization
3350 indent = len_(expline) - len_(expline.lstrip())
3355 # The help text goes on till the first non-blank line with less indent
3360 add_line = lines.append # Micro-optimization
3372 if len_(expline) - len_(expline.lstrip()) < indent:
3390 # simple top-down approach. See the module docstring for the expression
3405 # It helps to think of the 'expr: and_expr' case as a single-operand OR
3406 # (no ||), and of the 'and_expr: factor' case as a single-operand AND
3423 # Return 'and_expr' directly if we have a "single-operand" OR.
3432 # Return 'factor' directly if we have a "single-operand" AND.
3460 return (self._tokens[self._tokens_i - 1], token,
3487 depend_on = _depend_on # Micro-optimization
3541 # y-mode selection of the choice might change if a choice symbol's
3546 # <choice symbol> <-> <choice> dependency loops, but they make loop
3564 # Post-parsing menu tree processing, including dependency propagation and
3570 # - Applies configdefault node defaults to final symbols
3588 # - Copies properties from menu nodes up to their contained
3591 # - Propagates dependencies from parent to child nodes
3593 # - Creates implicit menus (see kconfig-language.txt)
3595 # - Removes 'if' nodes
3597 # - Sets 'choice' types and registers choice symbols
3658 # Add the node's non-node-specific properties to the choice, like
3674 # Due to the similar interface, Choice works as a drop-in replacement
3724 # traverses the menu tree roughly breadth-first, meaning properties on
3803 "the {} symbol {} has a malformed default {} -- "
3813 # the quotes were left out if 'foo' isn't all-uppercase
3820 self._warn("the {0} symbol {1} has a non-{0} default {2}"
3846 self._warn("the {0} symbol {1} has a non-{0} "
3864 msg += "\n - " + split_expr(si, AND)[0].name_and_loc
3927 # - Enable universal newlines mode on Python 2 to ease
3932 # deprecated on Python 3, so play it future-safe.
3955 # - For Python 3, force the encoding. Forcing the encoding on Python 2
3972 # Otherwise, symbols whose names happen to contain only the letters A-F
3989 # - sym.nodes empty means the symbol is undefined (has no
3992 # - Due to Kconfig internals, numbers show up as undefined Kconfig
3995 # - The MODULES symbol always exists
4002 msg += "\n\n- Referenced at {}:{}:\n\n{}" \
4028 The following attributes are available. They should be viewed as read-only,
4041 UNKNOWN is for undefined symbols, (non-special) constant symbols, and
4047 menuconfig-like functionality.
4055 representing n, m, y. Always 0 (n) for non-bool/tristate symbols.
4089 Returns the empty set for non-bool/tristate symbols and for symbols with
4093 visibility. menuconfig represents this as -M- and -*-, respectively.
4095 For string/hex/int symbols, check if Symbol.visibility is non-0 (non-n)
4102 # What's the highest value it can be assigned? [-1] in Python
4104 sym_high = sym.assignable[-1]
4110 if sym.assignable[-1] >= 1:
4127 symbols get written out. This includes all non-n-valued bool/tristate
4135 even for non-.config-like formats. To write just the symbols that would
4142 That function skips all n-valued symbols.
4146 n-valued symbol entries in there.
4163 Holds the parent Choice for choice symbols, and None for non-choice
4353 # separate code path (post-processing after loading a .config).
4376 # or has an out-of-range user value
4385 "being outside the active range ([{}, {}]) -- falling "
4391 # If the user value is well-formed and satisfies range
4492 # Non-choice symbol
4517 # Reverse (select-related) dependencies take precedence
4533 # Visible choice symbol in y-mode choice. The choice mode limits
4539 # Visible choice symbol in m-mode choice, with set non-0 user value
4634 visibility is non-n.
4661 "the value {} is invalid for {}, which has type {} -- "
4742 # Only add quotes for non-bool/tristate symbols
4750 # Only add quotes for non-bool/tristate symbols
4812 Symbol constructor -- not intended to be called directly by Kconfiglib
4824 # - UNKNOWN == 0
4825 # - _visited is used during tree iteration and dep. loop detection
4907 # Invalidating MODULES has wide-ranging effects
4915 # of calculating all other (non-constant) cached values.
4998 "currently being {}-selected by the following symbols:" \
5009 # - 'select A if B' turns into A && B
5010 # - 'select A' just turns into A
5015 msg += "\n - {}, with value {}, direct dependencies {} " \
5039 treated as read-only, and some are implemented through @property magic (but
5058 for menuconfig-like functionality.
5068 0 (n) - The choice is disabled and no symbols can be selected. For
5070 the 'optional' flag set (see kconfig-language.txt).
5072 1 (m) - Any number of choice symbols can be set to m, the rest will
5075 2 (y) - One symbol will be y, the rest n.
5085 special-casing in many code paths. This is why there is a lot of
5088 lower bound to m for visible non-optional choices (the reverse
5097 and interface less confusing (especially in a user-facing interface).
5233 # non-optional choices, which is how the C implementation does it
5309 "the value {} is invalid for {}, which has type {} -- "
5413 Choice constructor -- not intended to be called directly by Kconfiglib
5421 # - UNKNOWN == 0
5422 # - _visited is used during dep. loop detection
5437 # to special-case choices.
5510 in e.g. the 'make menuconfig' interface, though non-visible choices, menus,
5514 The top-level menu node, corresponding to the implicit top-level menu, is
5523 be viewed as read-only.
5538 kconfig-language.txt).
5621 - Menus (node.item == MENU)
5623 - Choices
5625 - Symbols defined with the 'menuconfig' keyword. The children come from
5641 in the top-level Kconfig file passed to Kconfig.__init__(), etc.
5930 # ... if dep -> ... if y
5934 # (AND, X, dep) -> X
5998 Exception raised for Kconfig-related errors.
6037 'expr' must be an already-parsed expression from a Symbol, Choice, or
6048 # Short-circuit the n case as an optimization (~5% faster
6054 # Short-circuit the y case as an optimization
6058 return 2 - expr_value(expr[1])
6075 comp = _sym_to_num(v1) - _sym_to_num(v2)
6177 Returns a list containing the top-level AND or OR operands in the
6178 expression 'expr', in the same (left-to-right) order as they appear in
6187 (Having this as an operand might be more future-safe than having two
6191 Pseudo-code examples:
6193 split_expr( A , OR ) -> [A]
6194 split_expr( A && B , OR ) -> [A && B]
6195 split_expr( A || B , OR ) -> [A, B]
6196 split_expr( A || B , AND ) -> [A || B]
6197 split_expr( A || B || (C && D) , OR ) -> [A, B, C && D]
6200 split_expr( A || (B && (C || D)) , OR ) -> [A, B && (C || D)]
6203 # encounter any non-'op' nodes)
6204 split_expr( (A || B) || C , OR ) -> [A, B, C]
6205 split_expr( A || (B || C) , OR ) -> [A, B, C]
6264 help="Top-level Kconfig file (default: Kconfig)")
6296 # PEP-3151).
6334 # Symbol or Choice 'sc' -- the logic is nearly identical.
6345 # Non-tristate choice symbols are only visible in y mode
6352 # Promote m to y if we're dealing with a non-tristate (possibly due to
6375 # Non-constant symbol, or choice
6389 # version seems to be a common idiom. It relies on short-circuit evaluation
6406 # strcmp()-alike that returns -1, 0, or 1
6408 return (s1 > s2) - (s1 < s2)
6468 # <filename>.old file is usually more of a nice-to-have, and not worth
6526 # "Flattens" menu nodes without prompts (e.g. 'if' nodes and non-visible
6531 # Do not flatten promptless choices (which can appear "legitimately" if a
6609 # Detects dependency loops using depth-first search on the dependency graph
6691 # '<sym FOO> -> <choice> -> <sym FOO>' loop otherwise.
6694 # Prevent the choice from being immediately re-entered via the
6754 msg += "(select-related dependencies: {})\n\n" \
6758 msg += "(imply-related dependencies: {})\n\n" \
6783 e.object[max(e.start - 40, 0):e.end + 40],
6851 # newline-to-space conversion.
6957 "---help---": _T_HELP,
7031 # Client code shouldn't rely on it though, as it was non-zero in
7058 # def_bool -> BOOL, etc.
7071 # Identifier-like lexemes ("missing quotes") are also treated as strings after
7114 # Obligatory (non-optional) sources
7183 # expansions in the left-hand side.
7184 _command_match = _re_match(r"\s*([A-Za-z0-9_$-]+)\s*")
7188 _id_keyword_match = _re_match(r"([A-Za-z0-9_$/.-]+)\s*")
7190 # A fragment in the left-hand side of a preprocessor variable assignment. These
7193 _assignment_lhs_fragment_match = _re_match("[A-Za-z0-9_-]*")
7195 # The assignment operator and value (right-hand side) in a preprocessor
7206 # end-of-line, in case the macro is the last thing on the line.
7207 _name_special_search = _re_search(r'[^A-Za-z0-9_$/.-]|\$\(|$')
7209 # A valid right-hand side for an assignment to a string symbol in a .config