• Building python extensions with meson

    From Enrico Zini@21:1/5 to All on Sat Dec 17 23:00:01 2022
    Hello,

    I maintain wreport[1], which is a simple C++ library with Python
    bindings.

    The package builds fine on bullseye and bookworm, but fails to build on
    sid. On sid, meson tries to install the Python extension under
    /usr/local instead of /usr.

    I do not understand what has changed, nor how to fix it. I looked on sources.debian.net[3] for other packages containing `python.get_install_dir(pure : false)
    but I only found pycairo and pygobject, which however can also use
    setup.py to build.

    Or xraylib. xraylib doesn't build the python bindings in Debian, but if
    I try to make it do that, as I'm supposed to, I get in the same
    situation as wreport.

    Did something break between bookworm and sid, in the interaction between
    meson and Python?

    Adding --buildsystem=pybuild to wreport's debian/rules didn't help, and
    indeed, at least according to grep, pybuild doesn't seem to know about
    meson.

    This[3] meson issue has a lot of discussion, but I can't tell how much
    of it is relevant.

    Can anyone help me understand what is going on?


    [1] https://tracker.debian.org/pkg/wreport
    [2] https://codesearch.debian.net/search?q=python.get_install_dir
    [3] https://github.com/mesonbuild/meson/issues/8739

    Enrico

    --
    GPG key: 4096R/634F4BD1E7AD5568 2009-05-08 Enrico Zini <enrico@enricozini.org>

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCAAdFiEEJJAhGtA2CH5tHZqS0P9Jy+P0+2gFAmOeOJMACgkQ0P9Jy+P0 +2jahxAAwvBL+dd98r5cckfO770L5UUquTNAIc2r9SfVDzIdpVn+Yo+mH65Ylru1 451V3/Y5/3V1Oh8nPEY7mr3ZwE5RxkWIF9Pgua7sQNVlCRldn+tjBasoVmzbedD9 WHaoJAIA50kK6J9/TLoJRevIKaEiqKIDr8yZPYoUXy1Y3ai9Li52txlaNWfMv2rJ WX8qEeGdwhmSbtoAEHMu6YLYXrPGG71RRCVyBt3450DhA9rOl2D+V3twtGsnVMDx foBHUmq3uOvz+2bC1pKvdEYJwOK0ChmmzwuWD7YrFZyeCBKVz42as5TDYQbE/a8l mPHZr3Dv28RL7h3q3TKyDAaVszWt3ogL6ZwTxLyAK505jh0JYh5hSP6+tCCpk+nv +1BZc+s9hMKh/w+c5t8wGynqm8mJYBnO2ni23NgEko96p0AaCudhifIliz/RfGM6 hzCMqhKaxmYhRKJP9R2sOiul4JJDtpSgRRbSdvrTK1a+eQoMraWet0SNYcBeCy/K r0eGkR4me01k1OqXnbfOjubQUyMr6BDtj4xENb4dKzuBSkAGkPiDxenhHe1jg17Z LL9Im/mj1VkohMzGezUtr2kR78qKg+VXdNEk1IcJa5zLpwPBKsmItK49jb8MS8MY Qd4wrPIWx1Zaez8Dm+s431Q06AjFIgsfp+bQkv18fKfLgfdXy+8=
    =zVtL
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Cyril Brulebois@21:1/5 to All on Sun Dec 18 02:30:01 2022
    Ciao,

    Enrico Zini <enrico@enricozini.org> (2022-12-17):
    The package builds fine on bullseye and bookworm, but fails to build
    on sid. On sid, meson tries to install the Python extension under
    /usr/local instead of /usr.

    I do not understand what has changed, nor how to fix it.
    […]
    Did something break between bookworm and sid, in the interaction
    between meson and Python?

    As far as I know, get_path()'s implemented in meson's python.py module
    (not the python3.py one), and the code path is the same there (no if
    branch taken, value returned via the last return statement); also, both
    have the same install_env (prefix).

    The main difference is that in testing:

    rel_path: lib/python3/dist-packages

    while in unstable:

    rel_path: local/lib/python3.10/dist-packages

    This comes from setuptools 65.5.0-1.1 (NMUer cc'd):

    * Install distutils-precedence.pth, to avoid packages need to hack import
    order in setup.py. Closes: #1025216

    which is consistent with the aforementioned rel_path's being derived
    from a specific item in a list:
    https://sources.debian.org/src/meson/0.64.1-1.1/mesonbuild/modules/python.py/#L452-L453

    No idea how to best fix or work around this though. Good luck.


    Cheers,
    --
    Cyril Brulebois (kibi@debian.org) <https://debamax.com/>
    D-I release manager -- Release team member -- Freelance Consultant

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEtg6/KYRFPHDXTPR4/5FK8MKzVSAFAmOea8IACgkQ/5FK8MKz VSB+0RAAioYNTx5sk9b6E6D83nQSL7cYqxXGAjZtaWGqAe+7NnP1WfyJpS/D6vUO mw1IspCNB4maS2OIGkmPNiIglVneOTAZ8K/Pt5A+yMKzx/Fe4GvibzQb80Khm5oX 3THDxg6sPtyDy/D+pKJcMkUJzo0NeMlYoJHU3FkUbRyhSU5BHkvsPBb3+LY60RKK TTabtc5+2JF6IJkbtGsn+qypZN3XsHuDvg3ir/h+3H8nc2Yb0MeEMYNRU4jzD36y 0O9sNNbO/QHuWaLtbq74qcPfmmjR/WyUPiVAZWZio7C3mluF01UUEgqvTPpMRzVJ UOVUI/zdAoI1f807cmcH4PyHpmwHq5ZJJKOGB2yuljqqbWWQna+cUKac0NohUPPy rfKXO4xoiReSCVnTgdZMaM23zHGtwSl/2XeVjKwyOMGJIL2rmlPBkkAZ23dZzKbH C4f0GqKRfzX21WUz6TNRj11PH7aeDbncojsaX+wHks3nQV1r/YFeCINsGC41tTK+ H/up1OBzsZh472QeG5xv59jCBKkr1OWt12sGaJqDtilI0JgqD4MEQOUG75ZZoBQy 7MArIF+u1T3AIAM0h9whEdVJOSrmcMOXdJEUmGU6Q9aDOAhyO6DDSxZVfMxumV1C xOsEUT6p57d1F4Ex8dVt/etzw4Ugy0RT0uSJC77GOh8Hz17MewU=
    =7SyR
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    *