Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Understanding multiple targets USE Expand
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
SDD701
n00b
n00b


Joined: 18 Feb 2023
Posts: 20

PostPosted: Tue Jul 23, 2024 2:01 pm    Post subject: Understanding multiple targets USE Expand Reply with quote

Hi. Can anyone explain what exacly is PYTHON_TARGETS actually mean? As far as I get it I can launch a program using marked versions. For example if I emerge qtile with -python3_10 python3_11 python3_12 I can start it using python 11 and 12 but not 10. Is that correct? How can I switch versions?
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1908

PostPosted: Tue Jul 23, 2024 2:19 pm    Post subject: Reply with quote

Any executable python script installed with PYTHON_TARGETS set will be put behind python-exec2 (from dev-lang/python-exec) which figures out what version to call.

python-exec2 determines what version to run through a few factors in this order:

  • First, if the EPYTHON environment variable is set, use that to determine which version to start.
  • Next, if /etc/python-exec/$command.conf exists (where $command is what is called in the shell), use that file to determine which version to start.
  • Finally, use the generic settings of /etc/python-exec/python-exec.conf defaults to determine what version to start. (In modern times, this should be controlled by dev-lang/python-exec-conf unless there's a good reason)

All of the above is considered for validity of supported version strings and availability by what the script was installed with. Each step falls through until a valid configuration is found or just flat out fails.

Using the example provided, EPYTHON="python3.11" qtile would be run under python 3.11 exclusively.

Packages which provide libraries for other python modules often need PYTHON_TARGETS to ensure multiple versions are available.

For simple scripts, it is more advantageous to consider using PYTHON_SINGLE_TARGET instead particularly for leaf packages. This only allows for a single version and is installed directly with its bangpath fixed.
Back to top
View user's profile Send private message
SDD701
n00b
n00b


Joined: 18 Feb 2023
Posts: 20

PostPosted: Tue Jul 23, 2024 4:16 pm    Post subject: Reply with quote

Thank you, now I understand the concept
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2397

PostPosted: Tue Jul 23, 2024 4:26 pm    Post subject: Reply with quote

Some more explanations:

https://projects.gentoo.org/python/guide/eclass.html#single-impl-vs-multi-impl

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum