summaryrefslogtreecommitdiff
path: root/genconfig.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-11-17 03:41:12 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2019-11-17 05:32:59 +0100
commitde45874719772a40f1d8d244e2f5a6c6036415ac (patch)
treeadee2494dba26c340c81d3689e43db546221dcd3 /genconfig.py
parentfaa1d2199801a19d7eef3caba8f0519a224ada2f (diff)
Make header strings customizable via the environment
If no header string is specified in write_(min_)config() or write_autoconf(), use the values of the environment variables KCONFIG_CONFIG_HEADER and KCONFIG_AUTOHEADER_HEADER, respectively, if set. KCONFIG_AUTOHEADER_HEADER is consistent with KCONFIG_AUTOHEADER (the header path), which will be added soon. Using environment variables avoids having to add separate flags to each tool that writes configuration files or headers. Like for $prefix and $CONFIG_, store the values of the environment variables when the Kconfig instance is created, and expose them via Kconfig.config_header and Kconfig.header_header. This if flexible and avoids gotchas when working with multiple Kconfig instances. Also remove the old default header and make the default no header. Less advertising, but it felt a bit silly to add workarounds to keep it. Came up in https://github.com/ulfalizer/Kconfiglib/pull/80.
Diffstat (limited to 'genconfig.py')
-rwxr-xr-xgenconfig.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/genconfig.py b/genconfig.py
index bb3e6ff..96124c5 100755
--- a/genconfig.py
+++ b/genconfig.py
@@ -20,6 +20,13 @@ might save work depending on your build setup.
By default, the configuration is generated from '.config'. A different
configuration file can be passed in the KCONFIG_CONFIG environment variable.
+
+A custom header string can be inserted at the beginning of generated
+configuration and header files by setting the KCONFIG_CONFIG_HEADER and
+KCONFIG_AUTOHEADER_HEADER environment variables, respectively (this also works
+for other scripts). The string is not automatically made a comment (this is by
+design, to allow anything to be added), and no trailing newline is added, so
+add '/* */', '#', and newlines as appropriate.
"""
import argparse
import os