• Re: [gentoo-dev] [PATCH] install-qa-check.d: Add namespace package chec

    From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Eli Schwartz on Thu May 29 09:00:01 2025
    On Thu, 2025-05-29 at 02:41 -0400, Eli Schwartz wrote:
    The eclass handled the most common
    case of installing them via the deprecated `namespace_packages`
    setuptools key, but it does not handle packages that worked around
    the deprecation warning by installing the file manually.


    Projects don't always "install the file manually". Sometimes they have
    code which needs to run in __init__.py but *also* need to expose the namespace to other code.


    Do you have a single valid use case in ::gentoo? I.e. a package that
    actually:

    1) installs a top-level __init__.py with namespace support and other
    code,

    2) actually has subpackages that would require namespace support.

    Because I dare say catching them is better than ignoring them
    and waiting for the file collisions because of a potentially valid use
    case that wouldn't be relevant to Gentoo installs anyway.

    --
    Best regards,
    Michał Górny


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

    iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAmg4A98SHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQOPxoIANTqEfLHaVaKJjko+N9207965zBCPiPw t4+r2txgVWirvv/fYqq0gErtRdT+0wq/23WMNsXLlktVlcs9OLPa8P7Ty1AZbiWF xZQf2IidqVnVw7v3bfYh0Kyzn49CBDVb5iqfyQKNW95G2WHIRwP9Mbtdy/psimMQ E2PeDxq3n6Jpgx2BoqWBECRx8hpMnr8rB9Ow8a4M1lEQZJeVn/tuNFSxVQK+08Xd 1bVwqQJWZAX/G+LkP02qxQ/1A4YgbHQk6eu/9N8jnc8nR1yi1SEMsm/6OcYkhGgs ixX2Q6h0xhNdIupMohJ4GUplYHs+AsYp1joTvByXyQaFVXFFsoUqEDk=
    =MBkE
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli Schwartz@21:1/5 to All on Thu May 29 08:50:01 2025
    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------NPxQ90wEwhJ7ILLbATDXPERY
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: quoted-printable

    On 5/29/25 2:16 AM, Michał Górny wrote:
    Add an explicit check for namespace packages (both pkg_resources
    and pkgutil) to 60python-site.


    pkgutil is stdlib and also not really deprecated.



    The eclass handled the most common
    case of installing them via the deprecated `namespace_packages`
    setuptools key, but it does not handle packages that worked around
    the deprecation warning by installing the file manually.


    Projects don't always "install the file manually". Sometimes they have
    code which needs to run in __init__.py but *also* need to expose the
    namespace to other code.

    Since pkgutil is compatible with implicit namespaces, the answer is to
    have subpackages use implicit and the main package use pkgutil + custom
    code.

    It's not a bug or a QA issue unless the subpackage also installs its own __init__.py.

    We should not report pkgutil. I agree catching manual pkg_resources
    usage makes sense.


    Signed-off-by: Michał Górny <[email protected]>
    ---
    metadata/install-qa-check.d/60python-site | 24 +++++++++++++++++++++++
    1 file changed, 24 insertions(+)



    --
    Eli Schwartz

    --------------NPxQ90wEwhJ7ILLbATDXPERY--

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

    wnsEABYIACMWIQTnFNnmK0TPZHnXm3qEp9ErcA0vVwUCaDgBqwUDAAAAAAAKCRCEp9ErcA0vV4ac AQCgR0aujIuNVUhr+UCMfdO//BNPygaF78XBHmh00k+z4AEA4HsKSGgsVIpXKdhgyiScftndNYa8 GShuK6IqTg1DLgA=
    =hTMF
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)