Re: [PATCH] meson: port python bindings to build natively via meson and meson-python

Eli Schwartz <[email protected]>
Newsgroups org.kernel.vger.devicetree-compiler
Message-ID <[email protected]>
On 3/18/25 10:15 AM, Rob Herring wrote:
> On Sun, Mar 16, 2025 at 7:42 PM Eli Schwartz <[email protected]> wrote:
>>
>> We get full build parallelism and fewer confusing ancient distutils
>> paths. The python wheels build fully standalone, including linking
>> libfdt as a static library.
>>
>> For convenience, when running pip install a meson option is passed that g
>> prevents building tools or installing headers/pkgconfig files.
>> meson-python would otherwise include them in the wheel itself, in case
>> they are needed, but this is essentially a bit useless so don't bother.
> 
> This is great as building a sdist that can be uploaded to pypi works.
> I've been maintaining a separate repo solely for that purpose.


Interestingly, the one you uploaded to PyPI seems to be called something
different from the name in setup.py and which I reused for pyproject.toml :)


>> Signed-off-by: Eli Schwartz <[email protected]>
>> ---
>>  MANIFEST.in          | 12 ------
>>  libfdt/meson.build   | 32 ++++++++-------
>>  meson.build          |  3 +-
>>  meson_options.txt    |  2 +
>>  pylibfdt/meson.build | 28 ++++++++-----
>>  pyproject.toml       | 25 ++++++++++++
>>  setup.py             | 97 --------------------------------------------
> 
> Isn't removing this going to break make based builds as that calls
> setup.py directly? Personally, I think that's fine because I think
> python things should be built "the Python way", rather than trying to
> wrap them in make or meson. David didn't agree though. I think the
> only somewhat sane path is making the make support purely a wrapper to
> call meson so we're not maintaining 2 parallel build systems.


Ah yes, that's true.

Meson *is* "the python way", for what it's worth, as it's a genuine
python build system, no wrapper :) but I do think it's not worth
supporting make as a route for the python bindings since Make can't
actually build the python code at all. Also, if you're interested in
python bindings you can afford to have python installed, and
consequently, to invoke a build system (meson) written in python.

I have no strong opinions about whether to maintain Makefile rules for
building pure C code.

I'm not really sure that people building python bindings will need a
Make rule that just runs meson...



-- 
Eli Schwartz
OpenPGP_signature.asc (application/pgp-signature, 236 B)
-----BEGIN PGP SIGNATURE-----

wnsEABYIACMWIQTnFNnmK0TPZHnXm3qEp9ErcA0vVwUCZ9mFBwUDAAAAAAAKCRCEp9ErcA0vV3I3
AQD8I7zdzbihOBIQS0pf8WEaZuk7eYgQK0MlnVuap8YcmAD/Ryl5j2Wmi2spP+HaiR5udbaSGUZU
SdphrX6StGFy4AI=
=r14j
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.