Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Check]: Check for direct python_targets* / python_single_target* use #699

Open
1 task done
mgorny opened this issue Sep 12, 2024 · 0 comments
Open
1 task done
Labels

Comments

@mgorny
Copy link
Contributor

mgorny commented Sep 12, 2024

Is there an existing such new check request for this?

  • I have searched the existing issues

Explain

We should check for people using Python target flags directly, rather than the abstraction provided by eclasses. Stuff like that is going to suddenly explode when we disable old targets, especially direct use python_targets* calls, since these won't be caught by pkgcheck.

Examples

https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-lang/python-exec/python-exec-2.4.10.ebuild?id=7f5d4c75a6e10b7ec7d7f371940f342c10b5a7b1#n42 (technically, this is a false positive but I think it should be reported)

https://gitweb.gentoo.org/repo/gentoo.git/tree/media-gfx/blender/blender-4.2.1.ebuild?id=7f5d4c75a6e10b7ec7d7f371940f342c10b5a7b1#n584

https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-python/QtPy/QtPy-2.4.1-r1.ebuild?id=7f5d4c75a6e10b7ec7d7f371940f342c10b5a7b1#n32

https://gitweb.gentoo.org/repo/gentoo.git/tree/media-gfx/freecad/freecad-0.21.2-r3.ebuild?id=7f5d4c75a6e10b7ec7d7f371940f342c10b5a7b1#n162

https://gitweb.gentoo.org/repo/gentoo.git/tree/x11-wm/xpra/xpra-4.4.6-r2.ebuild?id=7f5d4c75a6e10b7ec7d7f371940f342c10b5a7b1#n26

Output message

Python target flags must not be directly queried, use X instead.

Documentation

The Python eclasses provide abstraction over querying target flags, that facilitates transparently disabling targets when they become obsolete. Directly querying PYTHON_TARGETS or PYTHON_SINGLE_TARGET flags does not account for that properly, and will cause the ebuilds to break when old targets are disabled in the eclass, and in some cases the breakage won't be caught by pkgcheck.

The alternatives are [put them for X in message]:

  • python_foreach_impl for querying enabled PYTHON_TARGETS
  • ${EPYTHON} for checking the currently selected PYTHON_SINGLE_TARGET
  • python_gen_cond_dep to generate conditional dependencies

Result level

warning

@mgorny mgorny added the check label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant