README: Use meson in the Python section The Python section of README.md assumes a make build. It installs with 'make install', disables the library with NO_PYTHON, and runs its examples from the source tree, where make puts the built module. With meson the module is in the build directory instead, so the help example quietly imports whatever libfdt is installed, and the coverage example fails. Use meson to install and to disable the Python library, and run the examples from the build directory. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Herve Codina <herve.codina@bootlin.com> Message-ID: <20261028112007.3980089-2-sjg@chromium.org>
diff --git a/README.md b/README.md index ed9039d..fcfc2e5 100644 --- a/README.md +++ b/README.md
@@ -37,7 +37,8 @@ $ sudo apt-get install swig python3-dev ``` -The library provides an `Fdt` class which you can use like this: +The library provides an `Fdt` class which you can use like this, from +`build/tests` after running the tests: ``` $ PYTHONPATH=../pylibfdt python3 @@ -59,7 +60,7 @@ method. Help is available using the Python help command, e.g.: ``` -$ cd pylibfdt +$ cd build/pylibfdt $ python3 -c "import libfdt; help(libfdt)" ``` @@ -67,9 +68,9 @@ ``` $ sudo apt-get install python3-coverage -$ cd tests +$ cd build/tests # It's just 'coverage' on most other distributions -$ python3-coverage run pylibfdt_tests.py +$ python3-coverage run ../../tests/pylibfdt_tests.py $ python3-coverage html # Open 'htmlcov/index.html' in your browser ``` @@ -91,20 +92,21 @@ necessary and pip will use the default location for the Python installation which varies if the user is root or not. -You can also install everything via make if you like, but pip is +You can also install everything with meson if you like, but pip is recommended. To install both libfdt and pylibfdt you can use: ``` -$ make install [PREFIX=/path/to/install_dir] +$ meson setup [--prefix=/path/to/install_dir] build +$ meson install -C build ``` To disable building the python library, even if swig and Python are available, use: ``` -$ make NO_PYTHON=1 +$ meson setup -Dpython=disabled build ``` More work remains to support all of libfdt, including access to numeric