Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 394307

Summary: RESTRICT_PYTHON_ABIS should respect PYTHON_DEPEND
Product: Gentoo Linux Reporter: Ryan Hill (RETIRED) <rhill>
Component: EclassesAssignee: Python Gentoo Team <python>
Status: RESOLVED INVALID    
Severity: normal CC: tomka
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 393581    

Description Ryan Hill (RETIRED) gentoo-dev 2011-12-11 10:10:12 UTC
If I emerge a package that sets PYTHON_DEPEND="2:2.6" and USE_PYTHON is set to something like "2.5 2.6 2.7", then we still attempt to build with python-2.5.  To prevent this 2.5 must be explicitly added to RESTRICT_PYTHON_ABIS.  This makes no sense.  If a particular version of python cannot satisfy the dependency then it shouldn't be used, period.  Any restrictions the maintainer puts on PYTHON_DEPEND should be propagated into RESTRICT_PYTHON_ABIS automatically.
Comment 1 Arfrever Frehtes Taifersar Arahesis 2011-12-11 12:22:45 UTC
Fixed differently in Progress Overlay on 2011-06-28 (with minor fixes later).
The fix was incompatible, so it is used only in EAPI >=4.
The behavior remains unchanged in EAPI <=3.
In EAPI >=4:
 - In packages not supporting installation for multiple Python ABIs:
     PYTHON_DEPEND is used to specify conditions of dependency on Python,
     range of versions of Python and USE dependencies.
 - In packages supporting installation for multiple Python ABIs:
     PYTHON_DEPEND is used to specify conditions of dependency on Python
     and USE dependencies. If dependency on Python is unconditional and without
     USE dependencies, then default value is sufficient, so ebuilds don't need
     to set PYTHON_DEPEND.
     PYTHON_RESTRICTED_ABIS (previously named RESTRICT_PYTHON_ABIS) is used to
     specify accepted versions of Python.
     Example 1:
       EAPI="4"
       PYTHON_MULTIPLE_ABIS="1"
       PYTHON_RESTRICTED_ABIS="2.4 2.5 *-jython *-pypy-*"
       Generated DEPEND/RDEPEND contains:
|| ( dev-lang/python:3.3 dev-lang/python:3.2 dev-lang/python:3.1 dev-lang/python:2.7 dev-lang/python:2.6 )
     Example 2:
       EAPI="4"
       PYTHON_DEPEND="A? ( B? ( <<[ncurses,xml]>> ) )"
       PYTHON_MULTIPLE_ABIS="1"
       PYTHON_RESTRICTED_ABIS="2.4 2.5 *-jython *-pypy-*"
       Generated DEPEND/RDEPEND contains:
A? ( B? ( || ( dev-lang/python:3.3[ncurses,xml] dev-lang/python:3.2[ncurses,xml] dev-lang/python:3.1[ncurses,xml] dev-lang/python:2.7[ncurses,xml] dev-lang/python:2.6[ncurses,xml] ) ) )
Comment 2 Ryan Hill (RETIRED) gentoo-dev 2011-12-11 18:07:22 UTC
That looks even more complicated and unintuitive than the current situation.  So now we need to set both PYTHON_DEPEND and RESTRICT_PYTHON_ABIS, except when we use EAPI 4, in which case we need to remember to set a different variable named PYTHON_RESTRICTED_ABIS and only use PYTHON_DEPEND to set USE dependencies using some newly invented arcane syntax?  That is the opposite of fixed.

This is what needs to happen (assume multiple ABIS for all):

---
EAPI="2"
PYTHON_DEPEND="2:2.6"

inherit python
---
Package is built with python 2.6 and 2.7.


---
EAPI="4"
PYTHON_DEPEND="2:2.6"

inherit python
---
Package is built with python 2.6 and 2.7.

---
EAPI="4"
PYTHON_DEPEND="2:2.6 3:3.1"

inherit python
---
Package is built with python 2.6, 2.7, 3.1 and 3.2.

---
EAPI="4"
PYTHON_DEPEND="2:2.6 3:3.1"

inherit python
---
USE_PYTHON="2.5 2.6 2.7 3.2". Package is built with python 2.6, 2.7, and 3.2.


That's it.  More complicated situations will require a more complicated syntax, but the easy stuff should be easy.  I shouldn't need to keep a reference manual handy to figure out how to write a simple dependency.
Comment 3 Johan Bergström 2011-12-11 18:13:32 UTC
Since this bug thread is somewhat moving into a discussion, I'd like to chip in.

Some of the python herd (and hobbyists such as myself) has been collaborating on a document that collects ideas in a similar fashion. You can read this document here: http://piratepad.net/gxpXCcNNvv

In there there's a suggestion on PYTHON_TARGETS that moves from a restrict an allow point of view. Not sure what the greater goal is with this ticket - if this indeed is a bug, please disregard above.
Comment 4 Arfrever Frehtes Taifersar Arahesis 2012-01-22 20:58:30 UTC
(In reply to comment #2)
> That looks even more complicated and unintuitive than the current situation.

Read SPECIFICATION OF DEPENDENCIES section in:
http://people.apache.org/~Arfrever/Gentoo_Python_Supplementary_Guide_for_Developers
(If you want additional help in learning of the new syntax, then you can ask for help in #gentoo-progress IRC channel.)
 
> to set a different variable named PYTHON_RESTRICTED_ABIS

It is easy to support both old and new name of this variable.
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2012-01-23 23:24:01 UTC
Okay, that's nice, but that doesn't address the bug I filed.

Version not in PYTHON_DEPEND, don't build with version.  This seems like common sense.
Comment 6 Arfrever Frehtes Taifersar Arahesis 2012-01-23 23:52:30 UTC
(In reply to comment #5)

PYTHON_DEPEND="2:2.6" doesn't inform if given package supports e.g. PyPy 1.7.
In packages supporting installation for multiple Python ABIs, the list of supported Python ABIs should be specified only by patterns of unsupported Python ABIs in RESTRICT_PYTHON_ABIS/PYTHON_RESTRICTED_ABIS. RESTRICT_PYTHON_ABIS/PYTHON_RESTRICTED_ABIS allows to restrict Python ABIs of CPython, Jython and PyPy. E.g. RESTRICT_PYTHON_ABIS="2.*-jython" restricts Python ABIs of Jython 2.*.
In packages supporting installation for multiple Python ABIs, PYTHON_DEPEND should be used only to specify USE conditionals and USE dependencies, so many ebuilds wouldn't set PYTHON_DEPEND at all.
Comment 7 Ryan Hill (RETIRED) gentoo-dev 2012-01-24 02:41:50 UTC
All right then.  So much for interfaces being easy to use and hard to use wrong.