rename unstable-kconfig to unstable-keyval

Discussions in #6524 have shown that there are various possible uses of the
kconfig module and even disagreements in the exact file format between
Python-based kconfiglib and the tools in Linux.  Instead of trying to
reconcile them, just rename the module to something less suggestive and
leave any policy to meson.build files.

In the future it may be possible to add some kind of parsing through
keyword arguments such as bool_true, quoted_strings, etc. and possibly
creation of key-value lists too.  For now, configuration_data objects
provide an easy way to access quoted strings.  Note that Kconfig stores
false as "absent" so it was already necessary to write "x.has_key('abc')"
rather than the more compact "x['abc']".  Therefore, having to use
configuration_data does not make things much more verbose.
pull/7115/head
Paolo Bonzini 5 years ago committed by Jussi Pakkanen
parent a535ef6719
commit 7e15295018
  1. 27
      docs/markdown/Keyval-module.md
  2. 6
      docs/markdown/snippets/keyval_kobject.md
  3. 2
      docs/sitemap.txt
  4. 2
      docs/theme/extra/templates/navbar_links.html
  5. 10
      mesonbuild/modules/unstable_keyval.py
  6. 4
      run_project_tests.py
  7. 6
      test cases/common/222 source set realistic example/meson.build
  8. 0
      test cases/keyval/1 basic/.config
  9. 4
      test cases/keyval/1 basic/meson.build
  10. 0
      test cases/keyval/2 subdir/.config
  11. 2
      test cases/keyval/2 subdir/dir/meson.build
  12. 2
      test cases/keyval/2 subdir/meson.build
  13. 0
      test cases/keyval/3 load_config files/dir/config
  14. 2
      test cases/keyval/3 load_config files/dir/meson.build
  15. 2
      test cases/keyval/3 load_config files/meson.build
  16. 0
      test cases/keyval/4 load_config builddir/config
  17. 4
      test cases/keyval/4 load_config builddir/meson.build

@ -1,15 +1,15 @@
---
short-description: Unstable kconfig module
short-description: Unstable keyval module
authors:
- name: Mark Schulte, Paolo Bonzini
years: [2017, 2019]
has-copyright: false
...
# Unstable kconfig module
# keyval module
This module parses Kconfig output files to allow use of kconfig
configurations in meson projects.
This module parses files consisting of a series of `key=value` lines. One use
of this module is to load kconfig configurations in meson projects.
**Note**: this does not provide kconfig frontend tooling to generate a
configuration. You still need something such as kconfig frontends (see
@ -23,20 +23,23 @@ chosen the configuration options), output a ".config" file.
The module may be imported as follows:
``` meson
kconfig = import('unstable-kconfig')
keyval = import('unstable-keyval')
```
The following functions will then be available as methods on the object
with the name `kconfig`. You can, of course, replace the name
`kconfig` with anything else.
with the name `keyval`. You can, of course, replace the name
`keyval` with anything else.
### kconfig.load()
### keyval.load()
This function loads a kconfig output file and returns a dictionary object.
This function loads a file consisting of a series of `key=value` lines
and returns a dictionary object.
`kconfig.load()` makes no attempt at parsing the values in the
file. Therefore, true boolean values will be represented as the string "y"
and integer values will have to be converted with `.to_int()`.
`keyval.load()` makes no attempt at parsing the values in the file.
In particular boolean and integer values will be represented as strings,
and strings will keep any quoting that is present in the input file. It
can be useful to create a [`configuration_data()`](#configuration_data)
object from the dictionary and use methods such as `get_unquoted()`.
Kconfig frontends usually have ".config" as the default name for the
configuration file. However, placing the configuration file in the source

@ -0,0 +1,6 @@
## `unstable-kconfig` module renamed to `unstable-keyval`
The `unstable-kconfig` module is now renamed to `unstable-keyval`.
We expect this module to become stable once it has some usage experience,
specifically in the next or the following release

@ -48,7 +48,7 @@ index.md
SourceSet-module.md
Windows-module.md
Cuda-module.md
Kconfig-module.md
Keyval-module.md
Java.md
Vala.md
D.md

@ -14,7 +14,7 @@
("Hotdoc-module.html","Hotdoc"), \
("i18n-module.html","i18n"), \
("Icestorm-module.html","Icestorm"), \
("Kconfig-module.html","kconfig"), \
("Keyval-module.html","Keyval"), \
("Pkgconfig-module.html","Pkgconfig"), \
("Python-module.html","Python"), \
("Python-3-module.html","Python 3"), \

@ -21,9 +21,9 @@ from ..interpreter import InvalidCode
import os
class KconfigModule(ExtensionModule):
class KeyvalModule(ExtensionModule):
@FeatureNew('Kconfig Module', '0.51.0')
@FeatureNew('Keyval Module', '0.55.0')
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.snippets.add('load')
@ -56,9 +56,7 @@ class KconfigModule(ExtensionModule):
s = sources[0]
is_built = False
if isinstance(s, mesonlib.File):
if s.is_built:
FeatureNew('kconfig.load() of built files', '0.52.0').use(state.subproject)
is_built = True
is_built = is_built or s.is_built
s = s.absolute_path(interpreter.environment.source_dir, interpreter.environment.build_dir)
else:
s = os.path.join(interpreter.environment.source_dir, s)
@ -70,4 +68,4 @@ class KconfigModule(ExtensionModule):
def initialize(*args, **kwargs):
return KconfigModule(*args, **kwargs)
return KeyvalModule(*args, **kwargs)

@ -50,7 +50,7 @@ from run_tests import ensure_backend_detects_changes
from run_tests import guess_backend
ALL_TESTS = ['cmake', 'common', 'warning-meson', 'failing-meson', 'failing-build', 'failing-test',
'kconfig', 'platform-osx', 'platform-windows', 'platform-linux',
'keyval', 'platform-osx', 'platform-windows', 'platform-linux',
'java', 'C#', 'vala', 'rust', 'd', 'objective c', 'objective c++',
'fortran', 'swift', 'cuda', 'python3', 'python', 'fpga', 'frameworks', 'nasm', 'wasm'
]
@ -845,7 +845,7 @@ def detect_tests_to_run(only: T.List[str], use_tmp: bool) -> T.List[T.Tuple[str,
('failing-meson', 'failing', False),
('failing-build', 'failing build', False),
('failing-test', 'failing test', False),
('kconfig', 'kconfig', False),
('keyval', 'keyval', False),
('platform-osx', 'osx', not mesonlib.is_osx()),
('platform-windows', 'windows', not mesonlib.is_windows() and not mesonlib.is_cygwin()),

@ -1,4 +1,4 @@
# a sort-of realistic example that combines the sourceset and kconfig
# a sort-of realistic example that combines the sourceset and keyval
# modules, inspired by QEMU's build system
project('sourceset-example', 'cpp', default_options: ['cpp_std=c++11'])
@ -9,7 +9,7 @@ if cppid == 'pgi'
endif
ss = import('sourceset')
kconfig = import('unstable-kconfig')
keyval = import('unstable-keyval')
zlib = declare_dependency(compile_args: '-DZLIB=1')
another = declare_dependency(compile_args: '-DANOTHER=1')
@ -39,7 +39,7 @@ targets = [ 'arm', 'aarch64', 'x86' ]
target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' }
foreach x : targets
config = kconfig.load('config' / x)
config = keyval.load('config' / x)
target_specific = specific.apply(config, strict: false)
target_common = common.apply(config, strict: false)
target_deps = target_specific.dependencies() + target_common.dependencies()

@ -1,6 +1,6 @@
project('kconfig basic test')
project('keyval basic test')
k = import('unstable-kconfig')
k = import('unstable-keyval')
conf = k.load('.config')
if not conf.has_key('CONFIG_VAL1')

@ -1,5 +1,5 @@
k = import('unstable-kconfig')
k = import('unstable-keyval')
conf = k.load(meson.source_root() / '.config')

@ -1,4 +1,4 @@
project('kconfig subdir test')
project('keyval subdir test')
# Test into sub directory
subdir('dir')

@ -1,5 +1,5 @@
k = import('unstable-kconfig')
k = import('unstable-keyval')
conf = k.load(files('config'))

@ -1,4 +1,4 @@
project('kconfig subdir test')
project('keyval subdir test')
# Test into sub directory
subdir('dir')

@ -1,6 +1,6 @@
project('kconfig builddir test')
project('keyval builddir test')
k = import('unstable-kconfig')
k = import('unstable-keyval')
out_conf = configure_file(input: 'config', output: 'out-config', copy: true)
conf = k.load(out_conf)
Loading…
Cancel
Save