Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Cc: floppym@g.o, chewi@g.o
Subject: Re: [gentoo-dev] [PATCH 1/3] dev-util/meson: install meson-array script
Date: Sat, 12 Dec 2020 20:48:47
Message-Id: X9Usp3+cMTx5qQ6y@linux1.home
In Reply to: [gentoo-dev] [PATCH 1/3] dev-util/meson: install meson-array script by Mike Gilbert
1 On Fri, Dec 11, 2020 at 06:17:42PM -0500, Mike Gilbert wrote:
2 > Bug: https://bugs.gentoo.org/759433
3 > Signed-off-by: Mike Gilbert <floppym@g.o>
4 > ---
5 > dev-util/meson/files/meson-array | 18 ++++++++++++++++++
6 > ...on-0.55.3.ebuild => meson-0.55.3-r1.ebuild} | 5 +++++
7 > dev-util/meson/meson-9999.ebuild | 5 +++++
8 > 3 files changed, 28 insertions(+)
9 > create mode 100644 dev-util/meson/files/meson-array
10 > rename dev-util/meson/{meson-0.55.3.ebuild => meson-0.55.3-r1.ebuild} (96%)
11 >
12 > diff --git a/dev-util/meson/files/meson-array b/dev-util/meson/files/meson-array
13 > new file mode 100644
14 > index 000000000000..0f4e8c7c6389
15 > --- /dev/null
16 > +++ b/dev-util/meson/files/meson-array
17 > @@ -0,0 +1,18 @@
18 > +#!/usr/bin/env python
19 > +
20 > +import itertools
21 > +import shlex
22 > +import sys
23 > +
24 > +def quote(s):
25 > + return "'" + s.replace("\\", "\\\\").replace("'", "\\'") + "'"
26 > +
27 > +def main():
28 > + args = sys.argv[1:]
29 > + args = (shlex.split(x) for x in args)
30 > + args = itertools.chain.from_iterable(args)
31 > + args = (quote(x) for x in args)
32 > + print("[" + ", ".join(args) + "]")
33 > +
34 > +if __name__ == "__main__":
35 > + main()
36 > diff --git a/dev-util/meson/meson-0.55.3.ebuild b/dev-util/meson/meson-0.55.3-r1.ebuild
37 > similarity index 96%
38 > rename from dev-util/meson/meson-0.55.3.ebuild
39 > rename to dev-util/meson/meson-0.55.3-r1.ebuild
40 > index ddf27ccdc725..4708a46b324f 100644
41 > --- a/dev-util/meson/meson-0.55.3.ebuild
42 > +++ b/dev-util/meson/meson-0.55.3-r1.ebuild
43 > @@ -82,6 +82,11 @@ python_test() {
44 > ) || die "Testing failed with ${EPYTHON}"
45 > }
46 >
47 > +python_install() {
48 > + distutils-r1_python_install
49 > + python_doscript "${FILESDIR}/meson-array"
50 > +}
51 > +
52 > python_install_all() {
53 > distutils-r1_python_install_all
54 >
55 > diff --git a/dev-util/meson/meson-9999.ebuild b/dev-util/meson/meson-9999.ebuild
56 > index 38ccf9179e21..1cdd142a3f79 100644
57 > --- a/dev-util/meson/meson-9999.ebuild
58 > +++ b/dev-util/meson/meson-9999.ebuild
59 > @@ -82,6 +82,11 @@ python_test() {
60 > ) || die "Testing failed with ${EPYTHON}"
61 > }
62 >
63 > +python_install() {
64 > + distutils-r1_python_install
65 > + python_doscript "${FILESDIR}/meson-array"
66 > +}
67 > +
68 > python_install_all() {
69 > distutils-r1_python_install_all
70 >
71 > --
72 > 2.29.2
73
74 I am fully aware I don't have full context for this, so fill me in if I
75 am missing something.
76
77 Reading this patch series and the bug linked in this message, it looks
78 like we are trying to make meson.eclass work if /usr/bin/python is missing.
79
80 My question is why? as far as I know /usr/bin/python is standard
81 like /bin/sh; when a version of python is installed this link is
82 always available.
83
84 If /usr/bin/python is going away, it is going to break not only this but
85 every python script that has "#!/usr/bin/python" or
86 "#!/usr/bin/env python" as a shebang line.
87
88 If /usr/bin/python is going away, what about /usr/bin/python3? If that
89 isn't going away, the easier thing to do is to tweak the eclass to call
90 it instead.
91
92 If both /usr/bin/python and /usr/bin/python3 are going away, the best
93 choice would be to add functionality to python-exec or eselect python to tell us
94 the path to the default python interpretor. Once we know that we call it
95 directly.
96
97 Please do not apply this patch to meson; I think we can figure something
98 out that is better.
99
100 Also, see my comments on the third patch in the series for more context.
101
102 Thanks,
103
104 William

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies