mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-07 00:59:00 +08:00
将scons --menuconfig/--pyconfig/--pyconfig-silent统一调用kconfiglib
This commit is contained in:
@@ -354,7 +354,7 @@ jobs:
|
||||
chmod 777 install_ubuntu.sh
|
||||
./install_ubuntu.sh
|
||||
git config --global http.postBuffer 524288000
|
||||
python -c "import tools.menuconfig; tools.menuconfig.touch_env()"
|
||||
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
|
||||
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
|
||||
echo "RTT_CC=gcc" >> $GITHUB_ENV
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
git config --global http.postBuffer 524288000
|
||||
git remote -v
|
||||
git fetch origin
|
||||
python -c "import tools.menuconfig; tools.menuconfig.touch_env()"
|
||||
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
|
||||
|
||||
- name: Install Arm ToolChains
|
||||
if: ${{ success() }}
|
||||
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
chmod 777 install_ubuntu.sh
|
||||
./install_ubuntu.sh
|
||||
git config --global http.postBuffer 524288000
|
||||
python -c "import tools.menuconfig; tools.menuconfig.touch_env()"
|
||||
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
|
||||
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
|
||||
echo "RTT_CC=gcc" >> $GITHUB_ENV
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
chmod 777 install_ubuntu.sh
|
||||
./install_ubuntu.sh
|
||||
git config --global http.postBuffer 524288000
|
||||
python -c "import tools.menuconfig; tools.menuconfig.touch_env()"
|
||||
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
|
||||
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
|
||||
echo "RTT_CC=gcc" >> $GITHUB_ENV
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ jobs:
|
||||
chmod 777 install_ubuntu.sh
|
||||
./install_ubuntu.sh
|
||||
git config --global http.postBuffer 524288000
|
||||
python -c "import tools.menuconfig; tools.menuconfig.touch_env()"
|
||||
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
|
||||
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
|
||||
echo "RTT_CC=gcc" >> $GITHUB_ENV
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
chmod 777 install_ubuntu.sh
|
||||
./install_ubuntu.sh
|
||||
git config --global http.postBuffer 524288000
|
||||
python -c "import tools.menuconfig; tools.menuconfig.touch_env()"
|
||||
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
|
||||
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
|
||||
echo "RTT_CC=gcc" >> $GITHUB_ENV
|
||||
|
||||
|
||||
+20
-10
@@ -139,10 +139,20 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
||||
|
||||
# set RTT_ROOT in ENV
|
||||
Env['RTT_ROOT'] = Rtt_Root
|
||||
os.environ["RTT_DIR"] = Rtt_Root
|
||||
# set BSP_ROOT in ENV
|
||||
Env['BSP_ROOT'] = Dir('#').abspath
|
||||
os.environ["BSP_DIR"] = Dir('#').abspath
|
||||
# set PKGS_ROOT in ENV
|
||||
if not "PKGS_DIR" in os.environ:
|
||||
if "ENV_ROOT" in os.environ:
|
||||
os.environ["PKGS_DIR"] = os.path.join(os.environ["ENV_ROOT"], "packages")
|
||||
elif sys.platform == "win32":
|
||||
os.environ["PKGS_DIR"] = os.path.join(os.environ["USERPROFILE"], ".env/packages")
|
||||
else:
|
||||
os.environ["PKGS_DIR"] = os.path.join(os.environ["HOME"], ".env/packages")
|
||||
|
||||
sys.path = sys.path + [os.path.join(Rtt_Root, 'tools')]
|
||||
sys.path = sys.path + [os.path.join(Rtt_Root, 'tools'), os.path.join(Rtt_Root, 'tools/kconfiglib')]
|
||||
|
||||
# {target_name:(CROSS_TOOL, PLATFORM)}
|
||||
tgt_dict = {'mdk':('keil', 'armcc'),
|
||||
@@ -303,7 +313,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
||||
print('--global-macros arguments are illegal!')
|
||||
|
||||
if GetOption('genconfig'):
|
||||
from genconf import genconfig
|
||||
from menukconfig import genconfig
|
||||
genconfig()
|
||||
exit(0)
|
||||
|
||||
@@ -311,25 +321,25 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
||||
from WCS import ThreadStackStaticAnalysis
|
||||
ThreadStackStaticAnalysis(Env)
|
||||
exit(0)
|
||||
if platform.system() != 'Windows':
|
||||
if GetOption('menuconfig'):
|
||||
from menuconfig import menuconfig
|
||||
menuconfig(Rtt_Root)
|
||||
exit(0)
|
||||
|
||||
if GetOption('menuconfig'):
|
||||
from menukconfig import menuconfig
|
||||
menuconfig(Rtt_Root)
|
||||
exit(0)
|
||||
|
||||
if GetOption('pyconfig-silent'):
|
||||
from menuconfig import guiconfig_silent
|
||||
from menukconfig import guiconfig_silent
|
||||
guiconfig_silent(Rtt_Root)
|
||||
exit(0)
|
||||
|
||||
elif GetOption('pyconfig'):
|
||||
from menuconfig import guiconfig
|
||||
from menukconfig import guiconfig
|
||||
guiconfig(Rtt_Root)
|
||||
exit(0)
|
||||
|
||||
configfn = GetOption('useconfig')
|
||||
if configfn:
|
||||
from menuconfig import mk_rtconfig
|
||||
from menukconfig import mk_rtconfig
|
||||
mk_rtconfig(configfn)
|
||||
exit(0)
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import os
|
||||
|
||||
def genconfig() :
|
||||
from SCons.Script import SCons
|
||||
|
||||
PreProcessor = SCons.cpp.PreProcessor()
|
||||
|
||||
try:
|
||||
f = open('rtconfig.h', 'r')
|
||||
contents = f.read()
|
||||
f.close()
|
||||
except :
|
||||
print("Open rtconfig.h file failed.")
|
||||
|
||||
PreProcessor.process_contents(contents)
|
||||
options = PreProcessor.cpp_namespace
|
||||
|
||||
try:
|
||||
f = open('.config', 'w')
|
||||
for (opt, value) in options.items():
|
||||
if type(value) == type(1):
|
||||
f.write("CONFIG_%s=%d\n" % (opt, value))
|
||||
|
||||
if type(value) == type('') and value == '':
|
||||
f.write("CONFIG_%s=y\n" % opt)
|
||||
elif type(value) == type('str'):
|
||||
f.write("CONFIG_%s=%s\n" % (opt, value))
|
||||
|
||||
print("Generate .config done!")
|
||||
f.close()
|
||||
except:
|
||||
print("Generate .config file failed.")
|
||||
@@ -0,0 +1,4 @@
|
||||
*.py[co]
|
||||
build/
|
||||
*.egg-info/
|
||||
dist/
|
||||
@@ -0,0 +1,5 @@
|
||||
Copyright (c) 2011-2019, Ulf Magnusson <ulfalizer@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -0,0 +1,2 @@
|
||||
# Include the license file in source distributions
|
||||
include LICENSE.txt
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018-2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Writes a configuration file where all symbols are set to their their default
|
||||
values.
|
||||
|
||||
The default output filename is '.config'. A different filename can be passed in
|
||||
the KCONFIG_CONFIG environment variable.
|
||||
|
||||
Usage for the Linux kernel:
|
||||
|
||||
$ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/alldefconfig.py
|
||||
"""
|
||||
import kconfiglib
|
||||
|
||||
|
||||
def main():
|
||||
kconf = kconfiglib.standard_kconfig(__doc__)
|
||||
kconf.load_allconfig("alldef.config")
|
||||
print(kconf.write_config())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018-2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Writes a configuration file where as many symbols as possible are set to 'm'.
|
||||
|
||||
The default output filename is '.config'. A different filename can be passed
|
||||
in the KCONFIG_CONFIG environment variable.
|
||||
|
||||
Usage for the Linux kernel:
|
||||
|
||||
$ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/allmodconfig.py
|
||||
"""
|
||||
import kconfiglib
|
||||
|
||||
|
||||
def main():
|
||||
kconf = kconfiglib.standard_kconfig(__doc__)
|
||||
|
||||
# See allnoconfig.py
|
||||
kconf.warn = False
|
||||
|
||||
for sym in kconf.unique_defined_syms:
|
||||
if sym.orig_type == kconfiglib.BOOL:
|
||||
# 'bool' choice symbols get their default value, as determined by
|
||||
# e.g. 'default's on the choice
|
||||
if not sym.choice:
|
||||
# All other bool symbols get set to 'y', like for allyesconfig
|
||||
sym.set_value(2)
|
||||
elif sym.orig_type == kconfiglib.TRISTATE:
|
||||
sym.set_value(1)
|
||||
|
||||
for choice in kconf.unique_choices:
|
||||
choice.set_value(2 if choice.orig_type == kconfiglib.BOOL else 1)
|
||||
|
||||
kconf.warn = True
|
||||
|
||||
kconf.load_allconfig("allmod.config")
|
||||
|
||||
print(kconf.write_config())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018-2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Writes a configuration file where as many symbols as possible are set to 'n'.
|
||||
|
||||
The default output filename is '.config'. A different filename can be passed
|
||||
in the KCONFIG_CONFIG environment variable.
|
||||
|
||||
Usage for the Linux kernel:
|
||||
|
||||
$ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/allnoconfig.py
|
||||
"""
|
||||
|
||||
# See examples/allnoconfig_walk.py for another way to implement this script
|
||||
|
||||
import kconfiglib
|
||||
|
||||
|
||||
def main():
|
||||
kconf = kconfiglib.standard_kconfig(__doc__)
|
||||
|
||||
# Avoid warnings that would otherwise get printed by Kconfiglib for the
|
||||
# following:
|
||||
#
|
||||
# 1. Assigning a value to a symbol without a prompt, which never has any
|
||||
# effect
|
||||
#
|
||||
# 2. Assigning values invalid for the type (only bool/tristate symbols
|
||||
# accept 0/1/2, for n/m/y). The assignments will be ignored for other
|
||||
# symbol types, which is what we want.
|
||||
kconf.warn = False
|
||||
for sym in kconf.unique_defined_syms:
|
||||
sym.set_value(2 if sym.is_allnoconfig_y else 0)
|
||||
kconf.warn = True
|
||||
|
||||
kconf.load_allconfig("allno.config")
|
||||
|
||||
print(kconf.write_config())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018-2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Writes a configuration file where as many symbols as possible are set to 'y'.
|
||||
|
||||
The default output filename is '.config'. A different filename can be passed
|
||||
in the KCONFIG_CONFIG environment variable.
|
||||
|
||||
Usage for the Linux kernel:
|
||||
|
||||
$ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/allyesconfig.py
|
||||
"""
|
||||
import kconfiglib
|
||||
|
||||
|
||||
def main():
|
||||
kconf = kconfiglib.standard_kconfig(__doc__)
|
||||
|
||||
# See allnoconfig.py
|
||||
kconf.warn = False
|
||||
|
||||
# Try to set all symbols to 'y'. Dependencies might truncate the value down
|
||||
# later, but this will at least give the highest possible value.
|
||||
#
|
||||
# Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex
|
||||
# symbols still take a string, because they preserve formatting).
|
||||
for sym in kconf.unique_defined_syms:
|
||||
# Set choice symbols to 'm'. This value will be ignored for choices in
|
||||
# 'y' mode (the "normal" mode), which will instead just get their
|
||||
# default selection, but will set all symbols in m-mode choices to 'm',
|
||||
# which is as high as they can go.
|
||||
#
|
||||
# Here's a convoluted example of how you might get an m-mode choice
|
||||
# even during allyesconfig:
|
||||
#
|
||||
# choice
|
||||
# tristate "weird choice"
|
||||
# depends on m
|
||||
sym.set_value(1 if sym.choice else 2)
|
||||
|
||||
# Set all choices to the highest possible mode
|
||||
for choice in kconf.unique_choices:
|
||||
choice.set_value(2)
|
||||
|
||||
kconf.warn = True
|
||||
|
||||
kconf.load_allconfig("allyes.config")
|
||||
|
||||
print(kconf.write_config())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
@@ -25,7 +25,7 @@ def main():
|
||||
parser.add_argument(
|
||||
"--kconfig",
|
||||
default="Kconfig",
|
||||
help="Base Kconfig file (default: Kconfig)")
|
||||
help="Top-level Kconfig file (default: Kconfig)")
|
||||
|
||||
parser.add_argument(
|
||||
"config",
|
||||
@@ -34,7 +34,7 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
kconf = kconfiglib.Kconfig(args.kconfig)
|
||||
kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True)
|
||||
print(kconf.load_config(args.config))
|
||||
print(kconf.write_config())
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018-2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Generates a header file with #defines from the configuration, matching the
|
||||
format of include/generated/autoconf.h in the Linux kernel.
|
||||
|
||||
Optionally, also writes the configuration output as a .config file. See
|
||||
--config-out.
|
||||
|
||||
The --sync-deps, --file-list, and --env-list options generate information that
|
||||
can be used to avoid needless rebuilds/reconfigurations.
|
||||
|
||||
Before writing a header or configuration file, Kconfiglib compares the old
|
||||
contents of the file against the new contents. If there's no change, the write
|
||||
is skipped. This avoids updating file metadata like the modification time, and
|
||||
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.
|
||||
|
||||
See https://www.gnu.org/software/make/manual/make.html#Multi_002dLine for a
|
||||
handy way to define multi-line variables in makefiles, for use with custom
|
||||
headers. Remember to export the variable to the environment.
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
import kconfiglib
|
||||
|
||||
|
||||
DEFAULT_SYNC_DEPS_PATH = "deps/"
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description=__doc__)
|
||||
|
||||
parser.add_argument(
|
||||
"--header-path",
|
||||
metavar="HEADER_FILE",
|
||||
help="""
|
||||
Path to write the generated header file to. If not specified, the path in the
|
||||
environment variable KCONFIG_AUTOHEADER is used if it is set, and 'config.h'
|
||||
otherwise.
|
||||
""")
|
||||
|
||||
parser.add_argument(
|
||||
"--config-out",
|
||||
metavar="CONFIG_FILE",
|
||||
help="""
|
||||
Write the configuration to CONFIG_FILE. This is useful if you include .config
|
||||
files in Makefiles, as the generated configuration file will be a full .config
|
||||
file even if .config is outdated. The generated configuration matches what
|
||||
olddefconfig would produce. If you use sync-deps, you can include
|
||||
deps/auto.conf instead. --config-out is meant for cases where incremental build
|
||||
information isn't needed.
|
||||
""")
|
||||
|
||||
parser.add_argument(
|
||||
"--sync-deps",
|
||||
metavar="OUTPUT_DIR",
|
||||
nargs="?",
|
||||
const=DEFAULT_SYNC_DEPS_PATH,
|
||||
help="""
|
||||
Enable generation of symbol dependency information for incremental builds,
|
||||
optionally specifying the output directory (default: {}). See the docstring of
|
||||
Kconfig.sync_deps() in Kconfiglib for more information.
|
||||
""".format(DEFAULT_SYNC_DEPS_PATH))
|
||||
|
||||
parser.add_argument(
|
||||
"--file-list",
|
||||
metavar="OUTPUT_FILE",
|
||||
help="""
|
||||
Write a list of all Kconfig files to OUTPUT_FILE, with one file per line. The
|
||||
paths are relative to $srctree (or to the current directory if $srctree is
|
||||
unset). Files appear in the order they're 'source'd.
|
||||
""")
|
||||
|
||||
parser.add_argument(
|
||||
"--env-list",
|
||||
metavar="OUTPUT_FILE",
|
||||
help="""
|
||||
Write a list of all environment variables referenced in Kconfig files to
|
||||
OUTPUT_FILE, with one variable per line. Each line has the format NAME=VALUE.
|
||||
Only environment variables referenced with the preprocessor $(VAR) syntax are
|
||||
included, and not variables referenced with the older $VAR syntax (which is
|
||||
only supported for backwards compatibility).
|
||||
""")
|
||||
|
||||
parser.add_argument(
|
||||
"kconfig",
|
||||
metavar="KCONFIG",
|
||||
nargs="?",
|
||||
default="Kconfig",
|
||||
help="Top-level Kconfig file (default: Kconfig)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True)
|
||||
kconf.load_config()
|
||||
|
||||
if args.header_path is None:
|
||||
if "KCONFIG_AUTOHEADER" in os.environ:
|
||||
kconf.write_autoconf()
|
||||
else:
|
||||
# Kconfiglib defaults to include/generated/autoconf.h to be
|
||||
# compatible with the C tools. 'config.h' is used here instead for
|
||||
# backwards compatibility. It's probably a saner default for tools
|
||||
# as well.
|
||||
kconf.write_autoconf("config.h")
|
||||
else:
|
||||
kconf.write_autoconf(args.header_path)
|
||||
|
||||
if args.config_out is not None:
|
||||
kconf.write_config(args.config_out, save_old=False)
|
||||
|
||||
if args.sync_deps is not None:
|
||||
kconf.sync_deps(args.sync_deps)
|
||||
|
||||
if args.file_list is not None:
|
||||
with _open_write(args.file_list) as f:
|
||||
for path in kconf.kconfig_filenames:
|
||||
f.write(path + "\n")
|
||||
|
||||
if args.env_list is not None:
|
||||
with _open_write(args.env_list) as f:
|
||||
for env_var in kconf.env_vars:
|
||||
f.write("{}={}\n".format(env_var, os.environ[env_var]))
|
||||
|
||||
|
||||
def _open_write(path):
|
||||
# Python 2/3 compatibility. io.open() is available on both, but makes
|
||||
# write() expect 'unicode' strings on Python 2.
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
return open(path, "w")
|
||||
return open(path, "w", encoding="utf-8")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
@@ -95,7 +95,7 @@ an item will jump to it. Item values can be toggled directly within the dialog.\
|
||||
|
||||
|
||||
def _main():
|
||||
menuconfig(standard_kconfig())
|
||||
menuconfig(standard_kconfig(__doc__))
|
||||
|
||||
|
||||
# Global variables used below:
|
||||
@@ -345,9 +345,9 @@ def _load_images():
|
||||
# Note: Base64 data can be put on the clipboard with
|
||||
# $ base64 -w0 foo.gif | xclip
|
||||
|
||||
load_image("icon", "R0lGODlhIwAjAPcAAAAAAAAAMwA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LAAEIHEiwIIB9CBMqTChwoUOEDR8iJHZjX0SJDS86HGjx4MGFBiJm/IhwxcWRB5WFJNkRosAYGlvuq0dwI0llMV1KXJjzocGfAwMCADs=")
|
||||
load_image("icon", "R0lGODlhMAAwAPEDAAAAAADQAO7u7v///yH5BAUKAAMALAAAAAAwADAAAAL/nI+gy+2Pokyv2jazuZxryQjiSJZmyXxHeLbumH6sEATvW8OLNtf5bfLZRLFITzgEipDJ4mYxYv6A0ubuqYhWk66tVTE4enHer7jcKvt0LLUw6P45lvEprT6c0+v7OBuqhYdHohcoqIbSAHc4ljhDwrh1UlgSydRCWWlp5wiYZvmSuSh4IzrqV6p4cwhkCsmY+nhK6uJ6t1mrOhuJqfu6+WYiCiwl7HtLjNSZZZis/MeM7NY3TaRKS40ooDeoiVqIultsrav92bi9c3a5KkkOsOJZpSS99m4k/0zPng4Gks9JSbB+8DIcoQfnjwpZCHv5W+ip4aQrKrB0uOikYhiMCBw1/uPoQUMBADs=")
|
||||
load_image("n_bool", "R0lGODdhEAAQAPAAAAgICP///ywAAAAAEAAQAAACIISPacHtvp5kcb5qG85hZ2+BkyiRF8BBaEqtrKkqslEAADs=")
|
||||
load_image("y_bool", "R0lGODdhEAAQAPEAAAgICADQAP///wAAACwAAAAAEAAQAAACMoSPacLtvlh4YrIYsst2cV19AvaVF9CUXBNJJoum7ymrsKuCnhiupIWjSSjAFuWhSCIKADs=")
|
||||
load_image("n_tri", "R0lGODlhEAAQAPD/AAEBAf///yH5BAUKAAIALAAAAAAQABAAAAInlI+pBrAKQnCPSUlXvFhznlkfeGwjKZhnJ65h6nrfi6h0st2QXikFADs=")
|
||||
load_image("m_tri", "R0lGODlhEAAQAPEDAAEBAeQMuv///wAAACH5BAUKAAMALAAAAAAQABAAAAI5nI+pBrAWAhPCjYhiAJQCnWmdoElHGVBoiK5M21ofXFpXRIrgiecqxkuNciZIhNOZFRNI24PhfEoLADs=")
|
||||
load_image("y_tri", "R0lGODlhEAAQAPEDAAICAgDQAP///wAAACH5BAUKAAMALAAAAAAQABAAAAI0nI+pBrAYBhDCRRUypfmergmgZ4xjMpmaw2zmxk7cCB+pWiVqp4MzDwn9FhGZ5WFjIZeGAgA7")
|
||||
@@ -355,7 +355,7 @@ def _load_images():
|
||||
load_image("y_my", "R0lGODlhEAAQAPH/AAAAAADQAAPRA////yH5BAUKAAQALAAAAAAQABAAAAM+SArcrhCMSSuIM9Q8rxxBWIXawIBkmWonupLd565Um9G1PIs59fKmzw8WnAlusBYR2SEIN6DmAmqBLBxYSAIAOw==")
|
||||
load_image("n_locked", "R0lGODlhEAAQAPABAAAAAP///yH5BAUKAAEALAAAAAAQABAAAAIgjB8AyKwN04pu0vMutpqqz4Hih4ydlnUpyl2r23pxUAAAOw==")
|
||||
load_image("m_locked", "R0lGODlhEAAQAPD/AAAAAOQMuiH5BAUKAAIALAAAAAAQABAAAAIylC8AyKwN04ohnGcqqlZmfXDWI26iInZoyiore05walolV39ftxsYHgL9QBBMBGFEFAAAOw==")
|
||||
load_image("y_locked", "R0lGODlhDwAPAHAAACH5BAEAAPwALAAAAAAPAA8AhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAg1AAEIHEiwIIB9CBMqTChwoUOEDR8ujCiR4cGKFjFmNFhwX0OOBD1e1EgRY8mKJyWmfAgSZEAAOw==")
|
||||
load_image("y_locked", "R0lGODlhEAAQAPD/AAAAAADQACH5BAUKAAIALAAAAAAQABAAAAIylC8AyKzNgnlCtoDTwvZwrHydIYpQmR3KWq4uK74IOnp0HQPmnD3cOVlUIAgKsShkFAAAOw==")
|
||||
load_image("not_selected", "R0lGODlhEAAQAPD/AAAAAP///yH5BAUKAAIALAAAAAAQABAAAAIrlA2px6IBw2IpWglOvTYhzmUbGD3kNZ5QqrKn2YrqigCxZoMelU6No9gdCgA7")
|
||||
load_image("selected", "R0lGODlhEAAQAPD/AAAAAP///yH5BAUKAAIALAAAAAAQABAAAAIzlA2px6IBw2IpWglOvTah/kTZhimASJomiqonlLov1qptHTsgKSEzh9H8QI0QzNPwmRoFADs=")
|
||||
load_image("edit", "R0lGODlhEAAQAPIFAAAAAKOLAMuuEPvXCvrxvgAAAAAAAAAAACH5BAUKAAUALAAAAAAQABAAAANCWLqw/gqMBp8cszJxcwVC2FEOEIAi5kVBi3IqWZhuCGMyfdpj2e4pnK+WAshmvxeAcETWlsxPkkBtsqBMa8TIBSQAADs=")
|
||||
@@ -403,9 +403,8 @@ def _init_misc_ui():
|
||||
|
||||
# Use the 'clam' theme on *nix if it's available. It looks nicer than the
|
||||
# 'default' theme.
|
||||
style = ttk.Style()
|
||||
style.theme_use("default")
|
||||
if _root.tk.call("tk", "windowingsystem") == "x11":
|
||||
style = ttk.Style()
|
||||
if "clam" in style.theme_names():
|
||||
style.theme_use("clam")
|
||||
|
||||
@@ -556,7 +555,7 @@ def _create_kconfig_tree(parent):
|
||||
tree.tag_configure("y-locked", image=_y_locked_img)
|
||||
tree.tag_configure("not-selected", image=_not_selected_img)
|
||||
tree.tag_configure("selected", image=_selected_img)
|
||||
# tree.tag_configure("edit", image=_edit_img)
|
||||
tree.tag_configure("edit", image=_edit_img)
|
||||
tree.tag_configure("invisible", foreground="red")
|
||||
|
||||
tree.grid(column=0, row=0, sticky="nsew")
|
||||
@@ -1476,9 +1475,8 @@ def _toggle_showall(_):
|
||||
def _do_showall():
|
||||
# Updates the UI for the current show-all setting
|
||||
|
||||
# Don't allow turning off show-all if we're in single-menu mode and the
|
||||
# current menu would become empty
|
||||
if _single_menu and not _shown_menu_nodes(_cur_menu):
|
||||
# Don't allow turning off show-all if we'd end up with no visible nodes
|
||||
if _nothing_shown():
|
||||
_show_all_var.set(True)
|
||||
return
|
||||
|
||||
@@ -1513,6 +1511,17 @@ def _do_showall():
|
||||
_tree.focus_set()
|
||||
|
||||
|
||||
def _nothing_shown():
|
||||
# _do_showall() helper. Returns True if no nodes would get
|
||||
# shown with the current show-all setting. Also handles the
|
||||
# (obscure) case when there are no visible nodes in the entire
|
||||
# tree, meaning guiconfig was automatically started in
|
||||
# show-all mode, which mustn't be turned off.
|
||||
|
||||
return not _shown_menu_nodes(
|
||||
_cur_menu if _single_menu else _kconf.top_node)
|
||||
|
||||
|
||||
def _toggle_tree_mode(_):
|
||||
# Toggles single-menu mode on/off
|
||||
|
||||
@@ -1952,9 +1961,7 @@ def _sorted_sc_nodes(cached_nodes=[]):
|
||||
key=lambda choice: choice.name or "")
|
||||
|
||||
cached_nodes += sorted(
|
||||
[node
|
||||
for choice in choices
|
||||
for node in choice.nodes],
|
||||
[node for choice in choices for node in choice.nodes],
|
||||
key=lambda node: node.prompt[0] if node.prompt else "")
|
||||
|
||||
return cached_nodes
|
||||
@@ -2120,7 +2127,10 @@ def _defaults_info(sc):
|
||||
if not sc.defaults:
|
||||
return ""
|
||||
|
||||
s = "Defaults:\n"
|
||||
s = "Default"
|
||||
if len(sc.defaults) > 1:
|
||||
s += "s"
|
||||
s += ":\n"
|
||||
|
||||
for val, cond in sc.orig_defaults:
|
||||
s += " - "
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018-2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Lists all user-modifiable symbols that are not given a value in the
|
||||
configuration file. Usually, these are new symbols that have been added to the
|
||||
Kconfig files.
|
||||
|
||||
The default configuration filename is '.config'. A different filename can be
|
||||
passed in the KCONFIG_CONFIG environment variable.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from kconfiglib import Kconfig, BOOL, TRISTATE, INT, HEX, STRING, TRI_TO_STR
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description=__doc__)
|
||||
|
||||
parser.add_argument(
|
||||
"--show-help", "-l",
|
||||
action="store_true",
|
||||
help="Show any help texts as well")
|
||||
|
||||
parser.add_argument(
|
||||
"kconfig",
|
||||
metavar="KCONFIG",
|
||||
nargs="?",
|
||||
default="Kconfig",
|
||||
help="Top-level Kconfig file (default: Kconfig)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
kconf = Kconfig(args.kconfig, suppress_traceback=True)
|
||||
# Make it possible to filter this message out
|
||||
print(kconf.load_config(), file=sys.stderr)
|
||||
|
||||
for sym in kconf.unique_defined_syms:
|
||||
# Only show symbols that can be toggled. Choice symbols are a special
|
||||
# case in that sym.assignable will be (2,) (length 1) for visible
|
||||
# symbols in choices in y mode, but they can still be toggled by
|
||||
# selecting some other symbol.
|
||||
if sym.user_value is None and \
|
||||
(len(sym.assignable) > 1 or
|
||||
(sym.visibility and (sym.orig_type in (INT, HEX, STRING) or
|
||||
sym.choice))):
|
||||
|
||||
# Don't reuse the 'config_string' format for bool/tristate symbols,
|
||||
# to show n-valued symbols as 'CONFIG_FOO=n' instead of
|
||||
# '# CONFIG_FOO is not set'. This matches the C tools.
|
||||
if sym.orig_type in (BOOL, TRISTATE):
|
||||
s = "{}{}={}\n".format(kconf.config_prefix, sym.name,
|
||||
TRI_TO_STR[sym.tri_value])
|
||||
else:
|
||||
s = sym.config_string
|
||||
|
||||
print(s, end="")
|
||||
if args.show_help:
|
||||
for node in sym.nodes:
|
||||
if node.help is not None:
|
||||
# Indent by two spaces. textwrap.indent() is not
|
||||
# available in Python 2 (it's 3.3+).
|
||||
print("\n".join(" " + line
|
||||
for line in node.help.split("\n")))
|
||||
break
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,48 @@
|
||||
From 93daf46f309b0c8f86149ef58c4906387d054c22 Mon Sep 17 00:00:00 2001
|
||||
From: Ulf Magnusson <ulfalizer@gmail.com>
|
||||
Date: Tue, 9 Jun 2015 13:01:34 +0200
|
||||
Subject: [PATCH] Kconfiglib scripts/kconfig/Makefile patch
|
||||
|
||||
---
|
||||
scripts/kconfig/Makefile | 29 +++++++++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
|
||||
index 3f327e21f60e..8b7dd1292005 100644
|
||||
--- a/scripts/kconfig/Makefile
|
||||
+++ b/scripts/kconfig/Makefile
|
||||
@@ -27,2 +27,31 @@ gconfig: $(obj)/gconf
|
||||
|
||||
+PHONY += scriptconfig iscriptconfig kmenuconfig guiconfig dumpvarsconfig
|
||||
+
|
||||
+PYTHONCMD ?= python
|
||||
+kpython := PYTHONPATH=$(srctree)/Kconfiglib:$$PYTHONPATH $(PYTHONCMD)
|
||||
+
|
||||
+ifneq ($(filter scriptconfig,$(MAKECMDGOALS)),)
|
||||
+ifndef SCRIPT
|
||||
+$(error Use "make scriptconfig SCRIPT=<path to script> [SCRIPT_ARG=<argument>]")
|
||||
+endif
|
||||
+endif
|
||||
+
|
||||
+scriptconfig:
|
||||
+ $(Q)$(kpython) $(SCRIPT) $(Kconfig) $(if $(SCRIPT_ARG),"$(SCRIPT_ARG)")
|
||||
+
|
||||
+iscriptconfig:
|
||||
+ $(Q)$(kpython) -i -c \
|
||||
+ "import kconfiglib; \
|
||||
+ kconf = kconfiglib.Kconfig('$(Kconfig)'); \
|
||||
+ print('A Kconfig instance \'kconf\' for the architecture $(ARCH) has been created.')"
|
||||
+
|
||||
+kmenuconfig:
|
||||
+ $(Q)$(kpython) $(srctree)/Kconfiglib/menuconfig.py $(Kconfig)
|
||||
+
|
||||
+guiconfig:
|
||||
+ $(Q)$(kpython) $(srctree)/Kconfiglib/guiconfig.py $(Kconfig)
|
||||
+
|
||||
+dumpvarsconfig:
|
||||
+ $(Q)$(kpython) $(srctree)/Kconfiglib/examples/dumpvars.py $(Kconfig)
|
||||
+
|
||||
menuconfig: $(obj)/mconf
|
||||
--
|
||||
2.20.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018-2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Updates an old .config file or creates a new one, by filling in default values
|
||||
for all new symbols. This is the same as picking the default selection for all
|
||||
symbols in oldconfig, or entering the menuconfig interface and immediately
|
||||
saving.
|
||||
|
||||
The default input/output filename is '.config'. A different filename can be
|
||||
passed in the KCONFIG_CONFIG environment variable.
|
||||
|
||||
When overwriting a configuration file, the old version is saved to
|
||||
<filename>.old (e.g. .config.old).
|
||||
"""
|
||||
import kconfiglib
|
||||
|
||||
|
||||
def main():
|
||||
kconf = kconfiglib.standard_kconfig(__doc__)
|
||||
print(kconf.load_config())
|
||||
print(kconf.write_config())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Saves a minimal configuration file that only lists symbols that differ in value
|
||||
from their defaults. Loading such a configuration file is equivalent to loading
|
||||
the "full" configuration file.
|
||||
|
||||
Minimal configuration files are handy to start from when editing configuration
|
||||
files by hand.
|
||||
|
||||
The default input configuration file is '.config'. A different input filename
|
||||
can be passed in the KCONFIG_CONFIG environment variable.
|
||||
|
||||
Note: Minimal configurations can also be generated from within the menuconfig
|
||||
interface.
|
||||
"""
|
||||
import argparse
|
||||
|
||||
import kconfiglib
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description=__doc__)
|
||||
|
||||
parser.add_argument(
|
||||
"--kconfig",
|
||||
default="Kconfig",
|
||||
help="Top-level Kconfig file (default: Kconfig)")
|
||||
|
||||
parser.add_argument(
|
||||
"--out",
|
||||
metavar="MINIMAL_CONFIGURATION",
|
||||
default="defconfig",
|
||||
help="Output filename for minimal configuration (default: defconfig)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True)
|
||||
print(kconf.load_config())
|
||||
print(kconf.write_min_config(args.out))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2019, Ulf Magnusson
|
||||
# SPDX-License-Identifier: ISC
|
||||
|
||||
"""
|
||||
Simple utility for setting configuration values from the command line.
|
||||
|
||||
Sample usage:
|
||||
|
||||
$ setconfig FOO_SUPPORT=y BAR_BITS=8
|
||||
|
||||
Note: Symbol names should not be prefixed with 'CONFIG_'.
|
||||
|
||||
The exit status on errors is 1.
|
||||
|
||||
The default input/output configuration file is '.config'. A different filename
|
||||
can be passed in the KCONFIG_CONFIG environment variable.
|
||||
|
||||
When overwriting a configuration file, the old version is saved to
|
||||
<filename>.old (e.g. .config.old).
|
||||
"""
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
import kconfiglib
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description=__doc__)
|
||||
|
||||
parser.add_argument(
|
||||
"--kconfig",
|
||||
default="Kconfig",
|
||||
help="Top-level Kconfig file (default: Kconfig)")
|
||||
|
||||
parser.add_argument(
|
||||
"--no-check-exists",
|
||||
dest="check_exists",
|
||||
action="store_false",
|
||||
help="Ignore assignments to non-existent symbols instead of erroring "
|
||||
"out")
|
||||
|
||||
parser.add_argument(
|
||||
"--no-check-value",
|
||||
dest="check_value",
|
||||
action="store_false",
|
||||
help="Ignore assignments that didn't \"take\" (where the symbol got a "
|
||||
"different value, e.g. due to unsatisfied dependencies) instead "
|
||||
"of erroring out")
|
||||
|
||||
parser.add_argument(
|
||||
"assignments",
|
||||
metavar="ASSIGNMENT",
|
||||
nargs="*",
|
||||
help="A 'NAME=value' assignment")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True)
|
||||
print(kconf.load_config())
|
||||
|
||||
for arg in args.assignments:
|
||||
if "=" not in arg:
|
||||
sys.exit("error: no '=' in assignment: '{}'".format(arg))
|
||||
name, value = arg.split("=", 1)
|
||||
|
||||
if name not in kconf.syms:
|
||||
if not args.check_exists:
|
||||
continue
|
||||
sys.exit("error: no symbol '{}' in configuration".format(name))
|
||||
|
||||
sym = kconf.syms[name]
|
||||
|
||||
if not sym.set_value(value):
|
||||
sys.exit("error: '{}' is an invalid value for the {} symbol {}"
|
||||
.format(value, kconfiglib.TYPE_TO_STR[sym.orig_type],
|
||||
name))
|
||||
|
||||
if args.check_value and sym.str_value != value:
|
||||
sys.exit("error: {} was assigned the value '{}', but got the "
|
||||
"value '{}'. Check the symbol's dependencies, and make "
|
||||
"sure that it has a prompt."
|
||||
.format(name, value, sym.str_value))
|
||||
|
||||
print(kconf.write_config())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,7 @@
|
||||
[bdist_wheel]
|
||||
# We support both Python 2 and Python 3
|
||||
universal = 1
|
||||
|
||||
[metadata]
|
||||
# Include the license file in wheels
|
||||
license_file = LICENSE.txt
|
||||
@@ -0,0 +1,96 @@
|
||||
import io
|
||||
import os
|
||||
|
||||
import setuptools
|
||||
|
||||
|
||||
setuptools.setup(
|
||||
name="kconfiglib",
|
||||
# MAJOR.MINOR.PATCH, per http://semver.org
|
||||
version="14.1.0",
|
||||
description="A flexible Python Kconfig implementation",
|
||||
|
||||
# Make sure that README.rst decodes on Python 3 in environments that use
|
||||
# the C locale (which implies ASCII), by explicitly giving the encoding.
|
||||
#
|
||||
# io.open() has the 'encoding' parameter on both Python 2 and 3. open()
|
||||
# doesn't have it on Python 2. This lets us use the same code for both.
|
||||
long_description=io.open(
|
||||
os.path.join(os.path.dirname(__file__), "README.rst"),
|
||||
encoding="utf-8"
|
||||
).read(),
|
||||
|
||||
url="https://github.com/ulfalizer/Kconfiglib",
|
||||
author='Ulf "Ulfalizer" Magnusson',
|
||||
author_email="ulfalizer@gmail.com",
|
||||
keywords="kconfig, kbuild, menuconfig, configuration-management",
|
||||
license="ISC",
|
||||
|
||||
py_modules=(
|
||||
"kconfiglib",
|
||||
"menuconfig",
|
||||
"guiconfig",
|
||||
"genconfig",
|
||||
"oldconfig",
|
||||
"olddefconfig",
|
||||
"savedefconfig",
|
||||
"defconfig",
|
||||
"alldefconfig",
|
||||
"allnoconfig",
|
||||
"allmodconfig",
|
||||
"allyesconfig",
|
||||
"listnewconfig",
|
||||
"setconfig",
|
||||
),
|
||||
|
||||
entry_points={
|
||||
"console_scripts": (
|
||||
"menuconfig = menuconfig:_main",
|
||||
"guiconfig = guiconfig:_main",
|
||||
"genconfig = genconfig:main",
|
||||
"oldconfig = oldconfig:_main",
|
||||
"olddefconfig = olddefconfig:main",
|
||||
"savedefconfig = savedefconfig:main",
|
||||
"defconfig = defconfig:main",
|
||||
"alldefconfig = alldefconfig:main",
|
||||
"allnoconfig = allnoconfig:main",
|
||||
"allmodconfig = allmodconfig:main",
|
||||
"allyesconfig = allyesconfig:main",
|
||||
"listnewconfig = listnewconfig:main",
|
||||
"setconfig = setconfig:main",
|
||||
)
|
||||
},
|
||||
|
||||
# Note: windows-curses is not automatically installed on Windows anymore,
|
||||
# because it made Kconfiglib impossible to install on MSYS2 with pip
|
||||
|
||||
# Needs support for unnumbered {} in format() and argparse
|
||||
python_requires=">=2.7,!=3.0.*,!=3.1.*",
|
||||
|
||||
project_urls={
|
||||
"GitHub repository": "https://github.com/ulfalizer/Kconfiglib",
|
||||
"Examples": "https://github.com/ulfalizer/Kconfiglib/tree/master/examples",
|
||||
},
|
||||
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"Topic :: Software Development :: Build Tools",
|
||||
"Topic :: System :: Operating System Kernels :: Linux",
|
||||
"License :: OSI Approved :: ISC License (ISCL)",
|
||||
"Operating System :: POSIX",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.2",
|
||||
"Programming Language :: Python :: 3.3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
]
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -243,16 +243,16 @@ def exclude_utestcases(RTT_ROOT):
|
||||
if line.find('examples/utest/testcases/Kconfig') == -1:
|
||||
f.write(line)
|
||||
|
||||
# menuconfig for Linux
|
||||
# menuconfig for Linux and Windows
|
||||
def menuconfig(RTT_ROOT):
|
||||
import menuconfig
|
||||
|
||||
# Exclude utestcases
|
||||
exclude_utestcases(RTT_ROOT)
|
||||
|
||||
kconfig_dir = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends')
|
||||
os.system('scons -C ' + kconfig_dir)
|
||||
if sys.platform != 'win32':
|
||||
touch_env()
|
||||
|
||||
touch_env()
|
||||
env_dir = get_env_dir()
|
||||
if isinstance(env_dir, str):
|
||||
os.environ['PKGS_ROOT'] = os.path.join(env_dir, 'packages')
|
||||
@@ -260,8 +260,8 @@ def menuconfig(RTT_ROOT):
|
||||
fn = '.config'
|
||||
fn_old = '.config.old'
|
||||
|
||||
kconfig_cmd = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends', 'kconfig-mconf')
|
||||
os.system(kconfig_cmd + ' Kconfig')
|
||||
sys.argv = ['menuconfig', 'Kconfig']
|
||||
menuconfig._main()
|
||||
|
||||
if os.path.isfile(fn):
|
||||
if os.path.isfile(fn_old):
|
||||
@@ -278,7 +278,7 @@ def menuconfig(RTT_ROOT):
|
||||
|
||||
# guiconfig for windows and linux
|
||||
def guiconfig(RTT_ROOT):
|
||||
import pyguiconfig
|
||||
import guiconfig
|
||||
|
||||
# Exclude utestcases
|
||||
exclude_utestcases(RTT_ROOT)
|
||||
@@ -294,7 +294,7 @@ def guiconfig(RTT_ROOT):
|
||||
fn_old = '.config.old'
|
||||
|
||||
sys.argv = ['guiconfig', 'Kconfig']
|
||||
pyguiconfig._main()
|
||||
guiconfig._main()
|
||||
|
||||
if os.path.isfile(fn):
|
||||
if os.path.isfile(fn_old):
|
||||
@@ -331,3 +331,35 @@ def guiconfig_silent(RTT_ROOT):
|
||||
|
||||
# silent mode, force to make rtconfig.h
|
||||
mk_rtconfig(fn)
|
||||
|
||||
|
||||
def genconfig() :
|
||||
from SCons.Script import SCons
|
||||
|
||||
PreProcessor = SCons.cpp.PreProcessor()
|
||||
|
||||
try:
|
||||
f = open('rtconfig.h', 'r')
|
||||
contents = f.read()
|
||||
f.close()
|
||||
except :
|
||||
print("Open rtconfig.h file failed.")
|
||||
|
||||
PreProcessor.process_contents(contents)
|
||||
options = PreProcessor.cpp_namespace
|
||||
|
||||
try:
|
||||
f = open('.config', 'w')
|
||||
for (opt, value) in options.items():
|
||||
if type(value) == type(1):
|
||||
f.write("CONFIG_%s=%d\n" % (opt, value))
|
||||
|
||||
if type(value) == type('') and value == '':
|
||||
f.write("CONFIG_%s=y\n" % opt)
|
||||
elif type(value) == type('str'):
|
||||
f.write("CONFIG_%s=%s\n" % (opt, value))
|
||||
|
||||
print("Generate .config done!")
|
||||
f.close()
|
||||
except:
|
||||
print("Generate .config file failed.")
|
||||
+7
-8
@@ -121,19 +121,18 @@ def AddOptions():
|
||||
action = 'store_true',
|
||||
default = False,
|
||||
help = 'reset the project configurations to default')
|
||||
AddOption('--pyconfig',
|
||||
AddOption('--pyconfig', '--guiconfig',
|
||||
dest = 'pyconfig',
|
||||
action = 'store_true',
|
||||
default = False,
|
||||
help = 'Python GUI menuconfig for RT-Thread BSP')
|
||||
AddOption('--pyconfig-silent',
|
||||
AddOption('--pyconfig-silent', '--defconfig',
|
||||
dest = 'pyconfig-silent',
|
||||
action = 'store_true',
|
||||
default = False,
|
||||
help = 'Don`t show pyconfig window')
|
||||
if platform.system() != 'Windows':
|
||||
AddOption('--menuconfig',
|
||||
dest = 'menuconfig',
|
||||
action = 'store_true',
|
||||
default = False,
|
||||
help = 'make menuconfig for RT-Thread BSP')
|
||||
AddOption('--menuconfig',
|
||||
dest = 'menuconfig',
|
||||
action = 'store_true',
|
||||
default = False,
|
||||
help = 'make menuconfig for RT-Thread BSP')
|
||||
|
||||
Reference in New Issue
Block a user