Re: [gentoo-user] ebuild : how to check for python version

2020-08-11 Thread Mike Gilbert
On Tue, Aug 11, 2020 at 9:38 AM Helmut Jarausch  wrote:
>
> On 08/11/2020 03:08:16 PM, Mike Gilbert wrote:
> > On Sun, Aug 2, 2020 at 10:47 AM Helmut Jarausch
> > <_ j_ a_ r_ a_ u_ s_ c_ h_ @_ s_ k_ y_ n_ e_ t_ ._ b_ e> wrote:
> >  Hi,
> >  in an ebuild I have to apply a patch only if this package is
> >  installed
> >  for python3.9.
> >  The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )
> >
> >  How can I check for Pythons version in src_prepare or similar
> >  functions.
> >
> >  Many thanks for a hint,
> >  Helmut
> >
> > I would suggest creating a patch that can be applied unconditionally
> > instead.
> >
>
> That would imply different function definitions within an 'if / else'
> clause.
> I don't like this.
>

What will you do when someone wants/needs to install it for both
python3.8 and python3.9 simultaneously?

If you want to support both versions, it's better to have code that
actually works with both of them.



Re: [gentoo-user] ebuild : how to check for python version

2020-08-11 Thread Helmut Jarausch

On 08/11/2020 03:08:16 PM, Mike Gilbert wrote:
On Sun, Aug 2, 2020 at 10:47 AM Helmut Jarausch  
<_j_a_r_a_u_s_c_h_@_s_k_y_n_e_t_._b_e> wrote:

 Hi,
 in an ebuild I have to apply a patch only if this package is
 installed  
 for python3.9.
 The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )

 How can I check for Pythons version in src_prepare or similar
 functions.

 Many thanks for a hint,
 Helmut

I would suggest creating a patch that can be applied unconditionally  
instead.  




That would imply different function definitions within an 'if / else'  
clause.

I don't like this.



Re: [gentoo-user] ebuild : how to check for python version

2020-08-11 Thread Mike Gilbert
On Sun, Aug 2, 2020 at 10:47 AM Helmut Jarausch  wrote:

> Hi,
> in an ebuild I have to apply a patch only if this package is installed
> for python3.9.
> The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )
>
> How can I check for Pythons version in src_prepare or similar functions.
>
> Many thanks for a hint,
> Helmut
>
> I would suggest creating a patch that can be applied unconditionally
instead.


Re: [gentoo-user] ebuild : how to check for python version

2020-08-03 Thread Alexey Mishustin
пн, 3 авг. 2020 г. в 11:05, Neil Bothwick :
>
> On Mon, 3 Aug 2020 02:44:43 +0300, Alexey Mishustin wrote:
>
> > This should check if 3.9 is installed:
> > if has_version '=dev-lang/python-3.9'; then
>
> Shouldn't that be has_version 'dev-lang/python:3.9' to check for any
> version of 3.9?

Sure! My fault.

> However, that only checks for which python versions are installed before
> the ebuild is invoked. Would it make more sense to check PYTHON_TARGETS
> instead? That can also cover the situation of the package being
> installed without 3.9 but then 3.9 being installed later as a rebuild
> would be triggered by --changed-use.

Looks like it's what Helmut was looking for.

-- 
Best regards,
Alex



Re: [gentoo-user] ebuild : how to check for python version

2020-08-03 Thread Neil Bothwick
On Mon, 3 Aug 2020 02:44:43 +0300, Alexey Mishustin wrote:

> > in an ebuild I have to apply a patch only if this package is installed
> > for python3.9.
> > The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )
> >
> > How can I check for Pythons version in src_prepare or similar
> > functions.  
> 
> This should check if 3.9 is installed:
> if has_version '=dev-lang/python-3.9'; then

Shouldn't that be has_version 'dev-lang/python:3.9' to check for any
version of 3.9?

However, that only checks for which python versions are installed before
the ebuild is invoked. Would it make more sense to check PYTHON_TARGETS
instead? That can also cover the situation of the package being
installed without 3.9 but then 3.9 being installed later as a rebuild
would be triggered by --changed-use.


-- 
Neil Bothwick

"We can't solve problems by using the same kind of thinking we used when
we created them." (Albert Einstein)


pgpniucbj4Dip.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] ebuild : how to check for python version

2020-08-02 Thread Alexey Mishustin
вс, 2 авг. 2020 г. в 17:48, Helmut Jarausch :
>
> Hi,
> in an ebuild I have to apply a patch only if this package is installed
> for python3.9.
> The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )
>
> How can I check for Pythons version in src_prepare or similar functions.

Hi,

This should check if 3.9 is installed:
if has_version '=dev-lang/python-3.9'; then

But for which python version will the package be installed - isn't it
another question? (still learning too)

-- 
Best regards,
Alex



Re: [gentoo-user] ebuild : how to check for python version

2020-08-02 Thread james

On 8/2/20 1:34 PM, Helmut Jarausch wrote:

On 08/02/2020 06:15:12 PM, Ramon Fischer wrote:

Hi Helmut,

maybe "python_is_python3"[1] will help? I am still new to creating
ebuilds. :)

-Ramon


Thanks Ramon for this hint.
I need to know which version of Python3 ( Python3.8 or Python3.9)
and I could see how python_is_python3 helps here.

Helmut



editing

/usr/portage/profiles/base/use.stable.mask

might give you the granularity of control you see, BUT
I have not tested it yet, related to python3_9, so I'd recommend deep 
research and change packages one at a time, regardless of how you choose 
to use  version 3_9.



https://docs.python.org/3.9/whatsnew/3.9.html

just because it is (?) release, does not mean it is stable and ready for 
gentoo beta testing (my speculation).



hth,

James



Re: [gentoo-user] ebuild : how to check for python version

2020-08-02 Thread Helmut Jarausch

On 08/02/2020 06:15:12 PM, Ramon Fischer wrote:

Hi Helmut,

maybe "python_is_python3"[1] will help? I am still new to creating
ebuilds. :)

-Ramon


Thanks Ramon for this hint.
I need to know which version of Python3 ( Python3.8 or Python3.9)
and I could see how python_is_python3 helps here.

Helmut



Re: [gentoo-user] ebuild : how to check for python version

2020-08-02 Thread Ramon Fischer

Hi Helmut,

maybe "python_is_python3"[1] will help? I am still new to creating 
ebuilds. :)


-Ramon

[1] 
https://devmanual.gentoo.org/eclass-reference/python-utils-r1.eclass/index.html


On 02/08/2020 16:47, Helmut Jarausch wrote:

Hi,
in an ebuild I have to apply a patch only if this package is installed 
for python3.9.

The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )

How can I check for Pythons version in src_prepare or similar functions.

Many thanks for a hint,
Helmut






[gentoo-user] ebuild : how to check for python version

2020-08-02 Thread Helmut Jarausch

Hi,
in an ebuild I have to apply a patch only if this package is installed  
for python3.9.

The ebuild should work for PYTHON_COMPAT=( python3_{8,9} )

How can I check for Pythons version in src_prepare or similar functions.

Many thanks for a hint,
Helmut