Browse Source

Update single-r1 docs to use PYTHON_USEDEP over MULTI_USEDEP

Signed-off-by: Michał Górny <mgorny@gentoo.org>
pull/2/head
Michał Górny 1 year ago
parent
commit
6226c9c89e
No known key found for this signature in database GPG Key ID: 639ADAE2329E240E
  1. 26
      buildsys.rst
  2. 9
      depend.rst
  3. 6
      distutils.rst
  4. 32
      migration.rst
  5. 16
      single.rst

26
buildsys.rst

@ -230,22 +230,22 @@ package.
RDEPEND="
${PYTHON_DEPS}
$(python_gen_cond_dep "
dev-python/Numdifftools[\${PYTHON_MULTI_USEDEP}]
dev-python/Numdifftools[\${PYTHON_USEDEP}]
|| (
dev-python/matplotlib-python2[\${PYTHON_MULTI_USEDEP}]
dev-python/matplotlib[\${PYTHON_MULTI_USEDEP}]
dev-python/matplotlib-python2[\${PYTHON_USEDEP}]
dev-python/matplotlib[\${PYTHON_USEDEP}]
)
|| (
dev-python/numpy-python2[\${PYTHON_MULTI_USEDEP}]
dev-python/numpy[\${PYTHON_MULTI_USEDEP}]
dev-python/numpy-python2[\${PYTHON_USEDEP}]
dev-python/numpy[\${PYTHON_USEDEP}]
)
dev-python/wxpython:${WX_GTK_VER}[\${PYTHON_MULTI_USEDEP}]
sci-chemistry/pymol[\${PYTHON_MULTI_USEDEP}]
>=sci-libs/bmrblib-1.0.3[\${PYTHON_MULTI_USEDEP}]
>=sci-libs/minfx-1.0.11[\${PYTHON_MULTI_USEDEP}]
dev-python/wxpython:${WX_GTK_VER}[\${PYTHON_USEDEP}]
sci-chemistry/pymol[\${PYTHON_USEDEP}]
>=sci-libs/bmrblib-1.0.3[\${PYTHON_USEDEP}]
>=sci-libs/minfx-1.0.11[\${PYTHON_USEDEP}]
|| (
sci-libs/scipy-python2[\${PYTHON_MULTI_USEDEP}]
sci-libs/scipy[\${PYTHON_MULTI_USEDEP}]
sci-libs/scipy-python2[\${PYTHON_USEDEP}]
sci-libs/scipy[\${PYTHON_USEDEP}]
)
")
sci-chemistry/molmol
@ -310,7 +310,7 @@ unconditionally.
python? (
${PYTHON_DEPS}
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_MULTI_USEDEP}]
dev-python/numpy[${PYTHON_USEDEP}]
')
)
<sci-libs/sundials-5.1.0:0=
@ -323,7 +323,7 @@ unconditionally.
dev-libs/libfmt
python? (
$(python_gen_cond_dep '
dev-python/cython[${PYTHON_MULTI_USEDEP}]
dev-python/cython[${PYTHON_USEDEP}]
')
)
"

9
depend.rst

@ -137,11 +137,10 @@ it only with older versions of Python::
Please note that the first argument is a template containing literal
(escaped through use of single quotes) ``${PYTHON_USEDEP}`` that will
be substituted with partial USE dependency by the eclass function
(when using ``python-single-r1``, this will be either
``${PYTHON_SINGLE_USEDEP}`` or ``${PYTHON_MULTI_USEDEP}``). It is
followed by a list of implementations that are *not* quoted.
The example is using bash brace expansion to express ``python3_6
python3_7`` shorter.
(``${PYTHON_SINGLE_USEDEP}`` is also permitted when using
``python-single-r1``). It is followed by a list of implementations that
are *not* quoted. The example is using bash brace expansion to express
``python3_6 python3_7`` shorter.
Since ``pypy3`` can refer to any version of PyPy3, the dependency will
eventually become outdated as PyPy3 upgrades to Python 3.8

6
distutils.rst

@ -127,9 +127,9 @@ to be rewritten.
sci-physics/root:=[${PYTHON_SINGLE_USEDEP}]
dev-python/root_numpy[${PYTHON_SINGLE_USEDEP}]
$(python_gen_cond_dep '
dev-python/matplotlib[${PYTHON_MULTI_USEDEP}]
dev-python/pytables[${PYTHON_MULTI_USEDEP}]
dev-python/termcolor[${PYTHON_MULTI_USEDEP}]
dev-python/matplotlib[${PYTHON_USEDEP}]
dev-python/pytables[${PYTHON_USEDEP}]
dev-python/termcolor[${PYTHON_USEDEP}]
')"
DEPEND="

32
migration.rst

@ -3,29 +3,33 @@ Migration guides
================
.. index:: PYTHON_USEDEP; python-single-r1
.. index:: PYTHON_MULTI_USEDEP
Migrating from PYTHON_USEDEP in python-single-r1
================================================
Prior to February 2020, ``python-single-r1`` used to provide
Migrating from old PYTHON_USEDEP syntax in python-single-r1
===========================================================
Prior to February 2020, ``python-single-r1`` used to provide a single
``PYTHON_USEDEP`` variable alike the two other eclasses. However,
getting it to work correctly both on single-impl and multi-impl packages
required a gross hack.
The current eclass API requires using ``python_gen_cond_dep`` with
``PYTHON_MULTI_USEDEP`` placeholder for multi-impl deps. Single-impl
deps can be expressed with ``PYTHON_SINGLE_USEDEP`` that can be used
either as placeholder, or directly as a variable.
The current eclass API requires using ``python_gen_cond_dep`` function
to generate multi-impl deps instead, with ``PYTHON_USEDEP`` serving
as a placeholder. Single-impl deps can be expressed with
``PYTHON_SINGLE_USEDEP`` that can be used either as placeholder,
or directly as a variable.
During a transitional period, ``PYTHON_USEDEP`` was banned entirely
and ``PYTHON_MULTI_USEDEP`` was used instead. Today both are permitted
and the former is recommended.
The recommended rule of thumb for migrating old ebuilds is to:
1. Replace all instances of ``${PYTHON_USEDEP}`` with
``${PYTHON_MULTI_USEDEP}`` for multi-impl deps
or ``${PYTHON_SINGLE_USEDEP}`` for single-impl deps. If you don't
know the type of given dep, you can choose arbitrarily and deptree
check will tell you if you chose wrong.
1. Replace all instances of ``${PYTHON_USEDEP}`` for simple-impl deps
with ``${PYTHON_SINGLE_USEDEP}``. If you don't know the type
of given dep, dependency check (repoman, pkgcheck) will tell you
if you chose wrong.
2. Wrap the dependencies using ``${PYTHON_MULTI_USEDEP}`` in a single
2. Wrap the dependencies using ``${PYTHON_USEDEP}`` in a single
``python_gen_cond_dep`` block (reordering may be desirable).
3. Run ``pkgcheck scan`` or ``repoman full``. If you get syntax errors,

16
single.rst

@ -57,7 +57,7 @@ the implicitly exported ``pkg_setup`` phase.
.. index:: PYTHON_SINGLE_USEDEP
.. index:: PYTHON_MULTI_USEDEP
.. index:: PYTHON_USEDEP; python-single-r1
.. index:: python_gen_cond_dep; for python-single-r1
Dependencies
@ -80,13 +80,13 @@ USE dependency::
When depending on multi-impl packages, a more complex construct must
be used. The ``python_gen_cond_dep`` generator function is used
to copy the specified dependency template for all supported
implementations, and substitute ``${PYTHON_MULTI_USEDEP}`` template
inside it::
implementations, and substitute ``${PYTHON_USEDEP}`` template inside
it::
RDEPEND="
...
$(python_gen_cond_dep '
dev-python/matplotlib-python2[gtk2,${PYTHON_MULTI_USEDEP}]
dev-python/matplotlib-python2[gtk2,${PYTHON_USEDEP}]
')
"
@ -99,13 +99,13 @@ with explicit escapes have to be used::
RDEPEND="
...
$(python_gen_cond_dep "
dev-python/wxpython:${WX_GTK_VER}[\${PYTHON_MULTI_USEDEP}]
dev-python/wxpython:${WX_GTK_VER}[\${PYTHON_USEDEP}]
")"
As demonstrated above, the USE dependency string can be combined with
other USE dependencies. ``PYTHON_SINGLE_USEDEP`` can be used both
inside and outside ``python_gen_cond_dep``, while
``PYTHON_MULTI_USEDEP`` only inside it.
inside and outside ``python_gen_cond_dep``, while ``PYTHON_USEDEP`` only
inside it.
Conditional Python use
@ -142,7 +142,7 @@ needs to be rewritten to call the default implementation conditionally:
DEPEND="${RDEPEND}
python? (
$(python_gen_cond_dep '
dev-python/cython[${PYTHON_MULTI_USEDEP}]
dev-python/cython[${PYTHON_USEDEP}]
')
)"

Loading…
Cancel
Save