Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] ebuild : how to check for python version
Date: Mon, 03 Aug 2020 08:05:33
Message-Id: 20200803090515.61fa1219@digimed.co.uk
In Reply to: Re: [gentoo-user] ebuild : how to check for python version by Alexey Mishustin
1 On Mon, 3 Aug 2020 02:44:43 +0300, Alexey Mishustin wrote:
2
3 > > in an ebuild I have to apply a patch only if this package is installed
4 > > for python3.9.
5 > > The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )
6 > >
7 > > How can I check for Pythons version in src_prepare or similar
8 > > functions.
9 >
10 > This should check if 3.9 is installed:
11 > if has_version '=dev-lang/python-3.9'; then
12
13 Shouldn't that be has_version 'dev-lang/python:3.9' to check for any
14 version of 3.9?
15
16 However, that only checks for which python versions are installed before
17 the ebuild is invoked. Would it make more sense to check PYTHON_TARGETS
18 instead? That can also cover the situation of the package being
19 installed without 3.9 but then 3.9 being installed later as a rebuild
20 would be triggered by --changed-use.
21
22
23 --
24 Neil Bothwick
25
26 "We can't solve problems by using the same kind of thinking we used when
27 we created them." (Albert Einstein)

Replies

Subject Author
Re: [gentoo-user] ebuild : how to check for python version Alexey Mishustin <shumkar@×××××××.ru>