Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 29/30] dev-libs/libwacom: Use python_has_version for verbose output
Date: Tue, 08 Feb 2022 23:54:55
Message-Id: f63a7e4b8762b444ba68aa6647cec8b9e8aaf46e.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH 29/30] dev-libs/libwacom: Use python_has_version for verbose output by Matt Turner
1 On Tue, 2022-02-08 at 15:00 -0800, Matt Turner wrote:
2 > On Sun, Feb 6, 2022 at 4:57 AM Michał Górny <mgorny@g.o> wrote:
3 > >
4 > > Signed-off-by: Michał Górny <mgorny@g.o>
5 > > ---
6 > > dev-libs/libwacom/libwacom-1.11.ebuild | 6 +++---
7 > > dev-libs/libwacom/libwacom-1.12.ebuild | 6 +++---
8 > > 2 files changed, 6 insertions(+), 6 deletions(-)
9 > >
10 > > diff --git a/dev-libs/libwacom/libwacom-1.11.ebuild b/dev-libs/libwacom/libwacom-1.11.ebuild
11 > > index acfda32d8405..3e406d573b91 100644
12 > > --- a/dev-libs/libwacom/libwacom-1.11.ebuild
13 > > +++ b/dev-libs/libwacom/libwacom-1.11.ebuild
14 > > @@ -35,9 +35,9 @@ BDEPEND="
15 > > "
16 > >
17 > > python_check_deps() {
18 > > - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
19 > > - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
20 > > - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
21 > > + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
22 > > + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
23 > > + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
24 > > }
25 > >
26 > > pkg_setup() {
27 > > diff --git a/dev-libs/libwacom/libwacom-1.12.ebuild b/dev-libs/libwacom/libwacom-1.12.ebuild
28 > > index acfda32d8405..3e406d573b91 100644
29 > > --- a/dev-libs/libwacom/libwacom-1.12.ebuild
30 > > +++ b/dev-libs/libwacom/libwacom-1.12.ebuild
31 > > @@ -35,9 +35,9 @@ BDEPEND="
32 > > "
33 > >
34 > > python_check_deps() {
35 > > - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
36 > > - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
37 > > - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
38 > > + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
39 > > + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
40 > > + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
41 > > }
42 > >
43 >
44 > I like this, but just a question -- is this patch just an example of
45 > how we can transition other ebuilds, or are you planning a
46 > larger-scale replacement?
47
48 I'm not planning to do this proactively, at least at this time. Though
49 maybe it would be a good idea.
50
51 >
52 > Also, I've always felt a little uncomfortable with the
53 > python_check_deps() functions because of how easy it is to mess them
54 > up. E.g., app-emulation/spice/spice-0.15.0.ebuild contains:
55 >
56 > python_check_deps() {
57 > has_version -b ">=dev-python/pyparsing-1.5.6-r2[${PYTHON_USEDEP}]"
58 > has_version -b "dev-python/six[${PYTHON_USEDEP}]"
59 > }
60 >
61 > It should have a &&, right? There are many more instances of this in ::gentoo.
62
63 Yes. Though I think the "more common" mistake is not using "-b" while
64 it's the correct option most of the time.
65
66 >
67 > I wonder if this wouldn't be a good opportunity to change the API a
68 > little. Could we make python_has_version take multiple arguments and
69 > return true iff all are satisfied? Maybe like this?
70 >
71 > python_check_deps() {
72 > has_version \
73 > -b ">=dev-python/pyparsing-1.5.6-r2[${PYTHON_USEDEP}]" \
74 > -b "dev-python/six[${PYTHON_USEDEP}]"
75 > }
76 >
77 > What do you think?
78
79 I suppose it could make sense, as well as defaulting to "-b". However,
80 I need to think about it. Maybe I'll defer the addition of
81 python_has_version to get the API cleared out and merge the rest
82 ~tomorrow.
83
84 --
85 Best regards,
86 Michał Górny