[gentoo-dev] [PATCH v3 5/5] dev-python/jinja: Use distutils_enable_sphinx

2019-11-21 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 dev-python/jinja/jinja-2.10.3-r1.ebuild | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/dev-python/jinja/jinja-2.10.3-r1.ebuild 
b/dev-python/jinja/jinja-2.10.3-r1.ebuild
index 39131f10d5a9..f021773e3385 100644
--- a/dev-python/jinja/jinja-2.10.3-r1.ebuild
+++ b/dev-python/jinja/jinja-2.10.3-r1.ebuild
@@ -17,20 +17,18 @@ 
SRC_URI="https://github.com/pallets/jinja/archive/${PV}.tar.gz -> ${P}.tar.gz"
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh 
~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris 
~sparc64-solaris ~x64-solaris"
-IUSE="doc examples test"
+IUSE="examples test"
 RESTRICT="!test? ( test )"
 
 CDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
!dev-python/jinja:compat"
 RDEPEND="${CDEPEND}
dev-python/markupsafe[${PYTHON_USEDEP}]"
-BDEPEND="${CDEPEND}
-   doc? (
-   dev-python/sphinx
-   dev-python/sphinx-issues
-   dev-python/pallets-sphinx-themes
-   )"
+BDEPEND="${CDEPEND}"
 
+distutils_enable_sphinx docs \
+   dev-python/sphinx-issues \
+   dev-python/pallets-sphinx-themes
 distutils_enable_tests pytest
 
 # XXX: handle Babel better?
@@ -64,12 +62,7 @@ python_compile() {
wrap_opts distutils-r1_python_compile
 }
 
-python_compile_all() {
-   use doc && emake -C docs html
-}
-
 python_install_all() {
-   use doc && local HTML_DOCS=( docs/_build/html/. )
if use examples ; then
docinto examples
dodoc -r examples/.
-- 
2.24.0




[gentoo-dev] [PATCH v3 3/5] dev-python/cssselect: Use distutils_enable_sphinx

2019-11-21 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 dev-python/cssselect/cssselect-1.0.3.ebuild | 26 ++---
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/dev-python/cssselect/cssselect-1.0.3.ebuild 
b/dev-python/cssselect/cssselect-1.0.3.ebuild
index 80aef78e55b9..eb7e80a7db75 100644
--- a/dev-python/cssselect/cssselect-1.0.3.ebuild
+++ b/dev-python/cssselect/cssselect-1.0.3.ebuild
@@ -16,34 +16,12 @@ 
SRC_URI="https://github.com/scrapy/cssselect/archive/v${PV}.tar.gz -> ${P}.tar.g
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh 
~sparc ~x86"
-IUSE="doc test"
+IUSE="test"
 RESTRICT="!test? ( test )"
 
 DEPEND="
dev-python/setuptools[${PYTHON_USEDEP}]
-   doc? ( $(python_gen_any_dep 'dev-python/sphinx[${PYTHON_USEDEP}]') )
test? ( dev-python/lxml[${PYTHON_USEDEP}] )"
 
+distutils_enable_sphinx docs
 distutils_enable_tests unittest
-
-python_check_deps() {
-   use doc || return 0
-   has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
-}
-
-python_prepare_all() {
-   # prevent non essential d'load of files in doc build
-   sed -e 's:intersphinx_:#&:' -i docs/conf.py || die
-   distutils-r1_python_prepare_all
-}
-
-python_compile_all() {
-   if use doc ; then
-   esetup.py build_sphinx
-   fi
-}
-
-python_install_all() {
-   use doc && local HTML_DOCS=( docs/_build/html/. )
-   distutils-r1_python_install_all
-}
-- 
2.24.0




[gentoo-dev] [PATCH v3 4/5] dev-python/future: Use distutils_enable_sphinx

2019-11-21 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 dev-python/future/future-0.18.2.ebuild | 23 +++
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/dev-python/future/future-0.18.2.ebuild 
b/dev-python/future/future-0.18.2.ebuild
index d5b55ddea8d2..91b1a6a29af8 100644
--- a/dev-python/future/future-0.18.2.ebuild
+++ b/dev-python/future/future-0.18.2.ebuild
@@ -17,16 +17,12 @@ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc 
~ppc64 ~s390 ~sparc ~
 IUSE="doc"
 
 distutils_enable_tests pytest
+distutils_enable_sphinx docs \
+   dev-python/sphinx-bootstrap-theme
 
 # TODO: make numpy unconditional when it supports py3.8
-BDEPEND="
+BDEPEND+="
dev-python/setuptools[${PYTHON_USEDEP}]
-   doc? (
-   $(python_gen_any_dep '
-   dev-python/sphinx[${PYTHON_USEDEP}]
-   dev-python/sphinx-bootstrap-theme[${PYTHON_USEDEP}]
-   ')
-   )
test? (
$(python_gen_cond_dep 'dev-python/numpy[${PYTHON_USEDEP}]' \
python{2_7,3_{5,6,7}})
@@ -37,12 +33,6 @@ PATCHES=(
"${FILESDIR}"/${P}-tests.patch
 )
 
-python_check_deps() {
-   use doc || return 0
-   has_version "dev-python/sphinx[${PYTHON_USEDEP}]" &&
-   has_version 
"dev-python/sphinx-bootstrap-theme[${PYTHON_USEDEP}]"
-}
-
 python_prepare_all() {
sed -i "/'sphinx.ext.intersphinx'/d" docs/conf.py || die
# tests requiring network access
@@ -52,10 +42,3 @@ python_prepare_all() {
 
distutils-r1_python_prepare_all
 }
-
-python_compile_all() {
-   if use doc; then
-   sphinx-build docs/ docs/_build/html || die
-   HTML_DOCS=( docs/_build/html/. )
-   fi
-}
-- 
2.24.0




[gentoo-dev] [PATCH v3 1/5] python-utils-r1.eclass: Introduce build_sphins() helper

2019-11-21 Thread Michał Górny
Introduce a helper to build HTML docs using Sphinx, providing for
Intersphinx cleanup and HTML_DOCS appending.

Signed-off-by: Michał Górny 
---
 eclass/python-utils-r1.eclass | 25 +
 1 file changed, 25 insertions(+)

(changes in PATCH 2)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 647eb04344d2..f507b28ca90c 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1344,6 +1344,31 @@ python_export_utf8_locale() {
return 0
 }
 
+# @FUNCTION: build_sphinx
+# @USAGE: 
+# @DESCRIPTION:
+# Build HTML documentation using dev-python/sphinx in the specified
+# .  Takes care of disabling Intersphinx and appending
+# to HTML_DOCS.
+#
+# If  is relative to the current directory, care needs
+# to be taken to run einstalldocs from the same directory
+# (usually ${S}).
+build_sphinx() {
+   debug-print-function ${FUNCNAME} "${@}"
+   [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: "
+
+   local dir=${1}
+
+   sed -i -e 's:^intersphinx_mapping:disabled_&:' \
+   "${dir}"/conf.py || die
+   # not all packages include the Makefile in pypi tarball
+   sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
+   "${dir}"/_build/html || die
+
+   HTML_DOCS+=( "${dir}/_build/html/." )
+}
+
 # -- python.eclass functions --
 
 _python_check_dead_variables() {
-- 
2.24.0




[gentoo-dev] [PATCH v3 2/5] distutils-r1.eclass: Add distutils_enable_sphinx helper function

2019-11-21 Thread Michał Górny
Add a helper function to easily take care of the most common
dev-python/sphinx usage for HTML doc building.

Signed-off-by: Michał Górny 
---
 eclass/distutils-r1.eclass | 96 ++
 1 file changed, 96 insertions(+)

Changed in v3:
- move the impl from python_compile_all to sphinx_compile_all, to make
  it possible to override it easily.

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 63e77bf014c1..6e75a3a79914 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -232,6 +232,102 @@ fi
 # }
 # @CODE
 
+# @FUNCTION: distutils_enable_sphinx
+# @USAGE:  [--no-autodoc | ...]
+# @DESCRIPTION:
+# Set up IUSE, BDEPEND, python_check_deps() and python_compile_all() for
+# building HTML docs via dev-python/sphinx.  python_compile_all() will
+# append to HTML_DOCS if docs are enabled.
+#
+# This helper is meant for the most common case, that is a single Sphinx
+# subdirectory with standard layout, building and installing HTML docs
+# behind USE=doc.  It assumes it's the only consumer of the three
+# aforementioned functions.  If you need to use a custom implemention,
+# you can't use it.
+#
+# If your package uses additional Sphinx plugins, they should be passed
+# (without PYTHON_USEDEP) as .  The function will take care
+# of setting appropriate any-of dep and python_check_deps().
+#
+# If no plugin packages are specified, the eclass will still utilize
+# any-r1 API to support autodoc (documenting source code).
+# If the package uses neither autodoc nor additional plugins, you should
+# pass --no-autodoc to disable this API and simplify the resulting code.
+#
+# This function must be called in global scope.  Take care not to
+# overwrite the variables set by it.  If you need to extend
+# python_compile_all(), you can call the original implementation
+# as sphinx_compile_all.
+distutils_enable_sphinx() {
+   debug-print-function ${FUNCNAME} "${@}"
+   [[ ${#} -ge 1 ]] || die "${FUNCNAME} takes at least one arg: "
+
+   _DISTUTILS_SPHINX_SUBDIR=${1}
+   shift
+   _DISTUTILS_SPHINX_PLUGINS=( "${@}" )
+
+   local deps autodoc=1 d
+   for d; do
+   if [[ ${d} == --no-autodoc ]]; then
+   autodoc=
+   else
+   deps+="
+   ${d}[\${PYTHON_USEDEP}]"
+   fi
+   done
+
+   if [[ ! ${autodoc} && -n ${deps} ]]; then
+   die "${FUNCNAME}: do not pass --no-autodoc if external plugins 
are used"
+   fi
+   if [[ ${autodoc} ]]; then
+   deps="$(python_gen_any_dep "
+   dev-python/sphinx[\${PYTHON_USEDEP}]
+   ${deps}")"
+
+   python_check_deps() {
+   use doc || return 0
+   local p
+   for p in "${_DISTUTILS_SPHINX_PLUGINS[@]}"; do
+   has_version "${p}[${PYTHON_USEDEP}]" || return 1
+   done
+   }
+   else
+   deps="dev-python/sphinx"
+   fi
+
+   sphinx_compile_all() {
+   use doc || return
+
+   local confpy=${_DISTUTILS_SPHINX_SUBDIR}/conf.py
+   [[ -f ${confpy} ]] ||
+   die "${confpy} not found, distutils_enable_sphinx call 
wrong"
+
+   if [[ ${_DISTUTILS_SPHINX_PLUGINS[0]} == --no-autodoc ]]; then
+   if grep -F -q 'sphinx.ext.autodoc' "${confpy}"; then
+   die "distutils_enable_sphinx: --no-autodoc 
passed but sphinx.ext.autodoc found in ${confpy}"
+   fi
+   else
+   if ! grep -F -q 'sphinx.ext.autodoc' "${confpy}"; then
+   die "distutils_enable_sphinx: 
sphinx.ext.autodoc not found in ${confpy}, pass --no-autodoc"
+   fi
+   fi
+
+   build_sphinx "${_DISTUTILS_SPHINX_SUBDIR}"
+   }
+   python_compile_all() { sphinx_compile_all; }
+
+   IUSE+=" doc"
+   if [[ ${EAPI} == [56] ]]; then
+   DEPEND+=" doc? ( ${deps} )"
+   else
+   BDEPEND+=" doc? ( ${deps} )"
+   fi
+
+   # we need to ensure successful return in case we're called last,
+   # otherwise Portage may wrongly assume sourcing failed
+   return 0
+}
+
 # @FUNCTION: distutils_enable_tests
 # @USAGE: 
 # @DESCRIPTION:
-- 
2.24.0




Re: [gentoo-dev] Addressing split usage of USE=gles[123]

2019-11-21 Thread Matt Turner
On Thu, Nov 21, 2019 at 4:54 PM Dennis Schridde  wrote:
>
> On Donnerstag, 21. November 2019 09:11:46 CET Mart Raudsepp wrote:
> > See also this related old thread:
> > https://archives.gentoo.org/gentoo-dev/message/e04f6d321e424a237af62721d1d09
> > 211
>
> I think tackling the triad of opengl/gles, egl/glx, X/wayland is also a good
> idea.  Generally, all these probably have to distinguish between "support for
> XYZ" and "use only XYZ", the latter hopefully being the exception, so that the
> former can take the shorter use-flag.  That's what I don't like about the
> proposal from 2018: Globally enabling USE=gles will have different effects on
> different packages.  That's also what I like about the recent proposal: The
> flags are more explicit.

Totally agree. FWIW, we have bugs filed about this for USE=wayland [0]
and USE=USE={egl,gles{,1,2,3}}.

I would be happy to see someone take up this project. I'll be happy to help.

[0] https://bugs.gentoo.org/627714
[1] https://bugs.gentoo.org/627758



Re: [gentoo-dev] Addressing split usage of USE=gles[123]

2019-11-21 Thread Michael 'veremitz' Everitt
On 21/11/19 21:53, Dennis Schridde wrote:
> On Donnerstag, 21. November 2019 09:11:46 CET Mart Raudsepp wrote:
>> See also this related old thread:
>> https://archives.gentoo.org/gentoo-dev/message/e04f6d321e424a237af62721d1d09
>> 211
> I think tackling the triad of opengl/gles, egl/glx, X/wayland is also a good
> idea.  Generally, all these probably have to distinguish between "support for
> XYZ" and "use only XYZ", the latter hopefully being the exception, so that the
> former can take the shorter use-flag.  That's what I don't like about the
> proposal from 2018: Globally enabling USE=gles will have different effects on
> different packages.  That's also what I like about the recent proposal: The
> flags are more explicit.
>
> --Dennis
I don't think the problem is so much in the principle of making a change,
or even the specifics of any particular permutation of change, it's who
gets to manage and implement the change in a maintainable fashion, and who
has to deal with the fallout of any changes occurring where a particular
scenario 'slips through the net'

If you can convince the latter people that there is no problem arising from
making said changes, and you ensure that there genuinely *is* minimal
impact (by whatever means) then you stand a much better chance of this
change actually being implemented ..



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] Addressing split usage of USE=gles[123]

2019-11-21 Thread Dennis Schridde
On Donnerstag, 21. November 2019 09:11:46 CET Mart Raudsepp wrote:
> See also this related old thread:
> https://archives.gentoo.org/gentoo-dev/message/e04f6d321e424a237af62721d1d09
> 211

I think tackling the triad of opengl/gles, egl/glx, X/wayland is also a good
idea.  Generally, all these probably have to distinguish between "support for
XYZ" and "use only XYZ", the latter hopefully being the exception, so that the
former can take the shorter use-flag.  That's what I don't like about the
proposal from 2018: Globally enabling USE=gles will have different effects on
different packages.  That's also what I like about the recent proposal: The
flags are more explicit.

--Dennis


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-dev] Addressing split usage of USE=gles[123]

2019-11-21 Thread Matt Turner
On Wed, Nov 20, 2019 at 10:32 PM Haelwenn (lanodan) Monnier
 wrote:
>
> Hello gentoo-dev,
>
> First proposition on this list so hopefully not missing some kind of
> netiquette/policy.
>
> I noticed for some time that there seems to be two use cases for the
> gles[123] family of USE flags in gentoo repo:
> 1. enabling support of OpenGL ES, which seems interesting to have for
> more runtime choices, probably better usage of the drivers and better
> binary-compat support.
> 2. switching from OpenGL (so the full API) to Open GL ES (reduced API),
> which is an entirely different kind of action as that reduces it quite
> significantly but might be useful for machines where the drivers do not
> provide (good) OpenGL.
>
> To reflect this I think the "gles[123]" USE flags should be renamed,
> first kind to "gles[123]support" and second kind to "gles[123]only".
> Might also be the time to globalize them? I'm not sure but I think that
> would help in signalling which USE flags are to be used in packages.
> (and I'm probably not the only one which tends to only put global USE
> flags in make.conf, this kind of USE flags being the reason)

I think this is a good idea. I would suggest gles[123] and
gles[123]-only to avoid some of the churn. Changing gles[123] to
gles[123]-support would mean changing a ton of reverse dependencies of
Mesa, and I think that's a bad idea.

> ## Second kind, switch from OpenGL to OpenGL ES (20 packages)
> dev-libs/weston:gles2 - Use GLESv2 cairo instead of full GL
> dev-python/PyQt5:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qt3d:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtdatavis3d:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtdeclarative:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtgui:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtmultimedia:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtopengl:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtprintsupport:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtwebkit:gles2 - Use GLES 2.0 or later instead of full OpenGL
> dev-qt/qtwidgets:gles2 - Use GLES 2.0 or later instead of full OpenGL
> games-emulation/mupen64plus-core:gles2 - Use GLES2 instead of OpenGL
> games-emulation/mupen64plus-video-glide64mk2:gles2 - Use GLES2 instead of 
> OpenGL
> games-emulation/mupen64plus-video-rice:gles2 - Use GLES2 instead of OpenGL
> kde-apps/kdenlive:gles2 - Use GLES 2.0 or later instead of full OpenGL
> kde-frameworks/plasma:gles2 - Use GLES 2.0 or later instead of full OpenGL
> kde-plasma/kwin:gles2 - Use OpenGL ES 2 instead of full GL
> sci-libs/opencascade:gles2 - Use OpenGL ES 2.0
> www-plugins/freshplayerplugin:gles2 - Use system GLESv2 libraries instead of 
> ANGLE for shader translation
> www-plugins/lightspark:gles - Replace default OpenGL renderer with GLESv2

Making a pull request to change these seems like a great plan. I'll be
happy to help or review.



Re: [gentoo-dev] Addressing split usage of USE=gles[123]

2019-11-21 Thread Michael Orlitzky
On 11/20/19 10:32 PM, Haelwenn (lanodan) Monnier wrote:
> 
> To reflect this I think the "gles[123]" USE flags should be renamed,
> first kind to "gles[123]support" and second kind to "gles[123]only".
> Might also be the time to globalize them? I'm not sure but I think that 
> would help in signalling which USE flags are to be used in packages.
> (and I'm probably not the only one which tends to only put global USE 
> flags in make.conf, this kind of USE flags being the reason)
> 

+1 for making them consistent, but...

Setting USE flags globally has never worked, despite portage encouraging
you to do it. Better to set them in package.use, because whether we
admit it or not, the meaning of every USE flag is local.



[gentoo-dev] RFC: UID/GID assignment for graylog (478)

2019-11-21 Thread Tomas Mozes
Hello,
I'd like to reserve gid/uid 478 for graylog. Haven't found in other
databases, this seems like the next free id.

https://github.com/gentoo/gentoo/pull/13727

Thanks,
Tomas


[gentoo-dev] [PATCH v2 5/5] dev-python/jinja: Use distutils_enable_sphinx

2019-11-21 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 dev-python/jinja/jinja-2.10.3-r1.ebuild | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/dev-python/jinja/jinja-2.10.3-r1.ebuild 
b/dev-python/jinja/jinja-2.10.3-r1.ebuild
index 39131f10d5a9..f021773e3385 100644
--- a/dev-python/jinja/jinja-2.10.3-r1.ebuild
+++ b/dev-python/jinja/jinja-2.10.3-r1.ebuild
@@ -17,20 +17,18 @@ 
SRC_URI="https://github.com/pallets/jinja/archive/${PV}.tar.gz -> ${P}.tar.gz"
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh 
~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris 
~sparc64-solaris ~x64-solaris"
-IUSE="doc examples test"
+IUSE="examples test"
 RESTRICT="!test? ( test )"
 
 CDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
!dev-python/jinja:compat"
 RDEPEND="${CDEPEND}
dev-python/markupsafe[${PYTHON_USEDEP}]"
-BDEPEND="${CDEPEND}
-   doc? (
-   dev-python/sphinx
-   dev-python/sphinx-issues
-   dev-python/pallets-sphinx-themes
-   )"
+BDEPEND="${CDEPEND}"
 
+distutils_enable_sphinx docs \
+   dev-python/sphinx-issues \
+   dev-python/pallets-sphinx-themes
 distutils_enable_tests pytest
 
 # XXX: handle Babel better?
@@ -64,12 +62,7 @@ python_compile() {
wrap_opts distutils-r1_python_compile
 }
 
-python_compile_all() {
-   use doc && emake -C docs html
-}
-
 python_install_all() {
-   use doc && local HTML_DOCS=( docs/_build/html/. )
if use examples ; then
docinto examples
dodoc -r examples/.
-- 
2.24.0




[gentoo-dev] [PATCH v2 4/5] dev-python/future: Use distutils_enable_sphinx

2019-11-21 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 dev-python/future/future-0.18.2.ebuild | 23 +++
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/dev-python/future/future-0.18.2.ebuild 
b/dev-python/future/future-0.18.2.ebuild
index d5b55ddea8d2..91b1a6a29af8 100644
--- a/dev-python/future/future-0.18.2.ebuild
+++ b/dev-python/future/future-0.18.2.ebuild
@@ -17,16 +17,12 @@ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc 
~ppc64 ~s390 ~sparc ~
 IUSE="doc"
 
 distutils_enable_tests pytest
+distutils_enable_sphinx docs \
+   dev-python/sphinx-bootstrap-theme
 
 # TODO: make numpy unconditional when it supports py3.8
-BDEPEND="
+BDEPEND+="
dev-python/setuptools[${PYTHON_USEDEP}]
-   doc? (
-   $(python_gen_any_dep '
-   dev-python/sphinx[${PYTHON_USEDEP}]
-   dev-python/sphinx-bootstrap-theme[${PYTHON_USEDEP}]
-   ')
-   )
test? (
$(python_gen_cond_dep 'dev-python/numpy[${PYTHON_USEDEP}]' \
python{2_7,3_{5,6,7}})
@@ -37,12 +33,6 @@ PATCHES=(
"${FILESDIR}"/${P}-tests.patch
 )
 
-python_check_deps() {
-   use doc || return 0
-   has_version "dev-python/sphinx[${PYTHON_USEDEP}]" &&
-   has_version 
"dev-python/sphinx-bootstrap-theme[${PYTHON_USEDEP}]"
-}
-
 python_prepare_all() {
sed -i "/'sphinx.ext.intersphinx'/d" docs/conf.py || die
# tests requiring network access
@@ -52,10 +42,3 @@ python_prepare_all() {
 
distutils-r1_python_prepare_all
 }
-
-python_compile_all() {
-   if use doc; then
-   sphinx-build docs/ docs/_build/html || die
-   HTML_DOCS=( docs/_build/html/. )
-   fi
-}
-- 
2.24.0




[gentoo-dev] [PATCH v2 3/5] dev-python/cssselect: Use distutils_enable_sphinx

2019-11-21 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 dev-python/cssselect/cssselect-1.0.3.ebuild | 26 ++---
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/dev-python/cssselect/cssselect-1.0.3.ebuild 
b/dev-python/cssselect/cssselect-1.0.3.ebuild
index 80aef78e55b9..eb7e80a7db75 100644
--- a/dev-python/cssselect/cssselect-1.0.3.ebuild
+++ b/dev-python/cssselect/cssselect-1.0.3.ebuild
@@ -16,34 +16,12 @@ 
SRC_URI="https://github.com/scrapy/cssselect/archive/v${PV}.tar.gz -> ${P}.tar.g
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh 
~sparc ~x86"
-IUSE="doc test"
+IUSE="test"
 RESTRICT="!test? ( test )"
 
 DEPEND="
dev-python/setuptools[${PYTHON_USEDEP}]
-   doc? ( $(python_gen_any_dep 'dev-python/sphinx[${PYTHON_USEDEP}]') )
test? ( dev-python/lxml[${PYTHON_USEDEP}] )"
 
+distutils_enable_sphinx docs
 distutils_enable_tests unittest
-
-python_check_deps() {
-   use doc || return 0
-   has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
-}
-
-python_prepare_all() {
-   # prevent non essential d'load of files in doc build
-   sed -e 's:intersphinx_:#&:' -i docs/conf.py || die
-   distutils-r1_python_prepare_all
-}
-
-python_compile_all() {
-   if use doc ; then
-   esetup.py build_sphinx
-   fi
-}
-
-python_install_all() {
-   use doc && local HTML_DOCS=( docs/_build/html/. )
-   distutils-r1_python_install_all
-}
-- 
2.24.0




[gentoo-dev] [PATCH v2 2/5] distutils-r1.eclass: Add distutils_enable_sphinx helper function

2019-11-21 Thread Michał Górny
Add a helper function to easily take care of the most common
dev-python/sphinx usage for HTML doc building.

Signed-off-by: Michał Górny 
---
 eclass/distutils-r1.eclass | 93 ++
 1 file changed, 93 insertions(+)

Changes in v2:
- building code is split out into python-utils-r1
- grep -F is used

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 63e77bf014c1..5ac061e43bcf 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -232,6 +232,99 @@ fi
 # }
 # @CODE
 
+# @FUNCTION: distutils_enable_sphinx
+# @USAGE:  [--no-autodoc | ...]
+# @DESCRIPTION:
+# Set up IUSE, BDEPEND, python_check_deps() and python_compile_all() for
+# building HTML docs via dev-python/sphinx.  python_compile_all() will
+# append to HTML_DOCS if docs are enabled.
+#
+# This helper is meant for the most common case, that is a single Sphinx
+# subdirectory with standard layout, building and installing HTML docs
+# behind USE=doc.  It assumes it's the only consumer of the three
+# aforementioned functions.  If you need to use a custom implemention,
+# you can't use it.
+#
+# If your package uses additional Sphinx plugins, they should be passed
+# (without PYTHON_USEDEP) as .  The function will take care
+# of setting appropriate any-of dep and python_check_deps().
+#
+# If no plugin packages are specified, the eclass will still utilize
+# any-r1 API to support autodoc (documenting source code).
+# If the package uses neither autodoc nor additional plugins, you should
+# pass --no-autodoc to disable this API and simplify the resulting code.
+#
+# This function must be called in global scope.  Take care not to
+# overwrite the variables set by it.
+distutils_enable_sphinx() {
+   debug-print-function ${FUNCNAME} "${@}"
+   [[ ${#} -ge 1 ]] || die "${FUNCNAME} takes at least one arg: "
+
+   _DISTUTILS_SPHINX_SUBDIR=${1}
+   shift
+   _DISTUTILS_SPHINX_PLUGINS=( "${@}" )
+
+   local deps autodoc=1 d
+   for d; do
+   if [[ ${d} == --no-autodoc ]]; then
+   autodoc=
+   else
+   deps+="
+   ${d}[\${PYTHON_USEDEP}]"
+   fi
+   done
+
+   if [[ ! ${autodoc} && -n ${deps} ]]; then
+   die "${FUNCNAME}: do not pass --no-autodoc if external plugins 
are used"
+   fi
+   if [[ ${autodoc} ]]; then
+   deps="$(python_gen_any_dep "
+   dev-python/sphinx[\${PYTHON_USEDEP}]
+   ${deps}")"
+
+   python_check_deps() {
+   use doc || return 0
+   local p
+   for p in "${_DISTUTILS_SPHINX_PLUGINS[@]}"; do
+   has_version "${p}[${PYTHON_USEDEP}]" || return 1
+   done
+   }
+   else
+   deps="dev-python/sphinx"
+   fi
+
+   python_compile_all() {
+   use doc || return
+
+   local confpy=${_DISTUTILS_SPHINX_SUBDIR}/conf.py
+   [[ -f ${confpy} ]] ||
+   die "${confpy} not found, distutils_enable_sphinx call 
wrong"
+
+   if [[ ${_DISTUTILS_SPHINX_PLUGINS[0]} == --no-autodoc ]]; then
+   if grep -F -q 'sphinx.ext.autodoc' "${confpy}"; then
+   die "distutils_enable_sphinx: --no-autodoc 
passed but sphinx.ext.autodoc found in ${confpy}"
+   fi
+   else
+   if ! grep -F -q 'sphinx.ext.autodoc' "${confpy}"; then
+   die "distutils_enable_sphinx: 
sphinx.ext.autodoc not found in ${confpy}, pass --no-autodoc"
+   fi
+   fi
+
+   build_sphinx "${_DISTUTILS_SPHINX_SUBDIR}"
+   }
+
+   IUSE+=" doc"
+   if [[ ${EAPI} == [56] ]]; then
+   DEPEND+=" doc? ( ${deps} )"
+   else
+   BDEPEND+=" doc? ( ${deps} )"
+   fi
+
+   # we need to ensure successful return in case we're called last,
+   # otherwise Portage may wrongly assume sourcing failed
+   return 0
+}
+
 # @FUNCTION: distutils_enable_tests
 # @USAGE: 
 # @DESCRIPTION:
-- 
2.24.0




[gentoo-dev] [PATCH v2 1/5] python-utils-r1.eclass: Introduce build_sphins() helper

2019-11-21 Thread Michał Górny
Introduce a helper to build HTML docs using Sphinx, providing for
Intersphinx cleanup and HTML_DOCS appending.

Signed-off-by: Michał Górny 
---
 eclass/python-utils-r1.eclass | 25 +
 1 file changed, 25 insertions(+)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 647eb04344d2..f507b28ca90c 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1344,6 +1344,31 @@ python_export_utf8_locale() {
return 0
 }
 
+# @FUNCTION: build_sphinx
+# @USAGE: 
+# @DESCRIPTION:
+# Build HTML documentation using dev-python/sphinx in the specified
+# .  Takes care of disabling Intersphinx and appending
+# to HTML_DOCS.
+#
+# If  is relative to the current directory, care needs
+# to be taken to run einstalldocs from the same directory
+# (usually ${S}).
+build_sphinx() {
+   debug-print-function ${FUNCNAME} "${@}"
+   [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: "
+
+   local dir=${1}
+
+   sed -i -e 's:^intersphinx_mapping:disabled_&:' \
+   "${dir}"/conf.py || die
+   # not all packages include the Makefile in pypi tarball
+   sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
+   "${dir}"/_build/html || die
+
+   HTML_DOCS+=( "${dir}/_build/html/." )
+}
+
 # -- python.eclass functions --
 
 _python_check_dead_variables() {
-- 
2.24.0




Re: [gentoo-dev] Addressing split usage of USE=gles[123]

2019-11-21 Thread Mart Raudsepp
See also this related old thread:
https://archives.gentoo.org/gentoo-dev/message/e04f6d321e424a237af62721d1d09211





Re: [gentoo-dev] Addressing split usage of USE=gles[123]

2019-11-21 Thread Dennis Schridde
Hello everyone!

On Donnerstag, 21. November 2019 04:32:34 CET Haelwenn (lanodan) Monnier
wrote:
> I noticed for some time that there seems to be two use cases for the
> gles[123] family of USE flags in gentoo repo:
> 1. enabling support of OpenGL ES, which seems interesting to have for
> more runtime choices, probably better usage of the drivers and better
> binary-compat support.
> 2. switching from OpenGL (so the full API) to Open GL ES (reduced API),
> which is an entirely different kind of action as that reduces it quite
> significantly but might be useful for machines where the drivers do not
> provide (good) OpenGL.

I just recently ran into this, putting USE=gles2 in make.conf, thinking that
only the first kind of flags existed.  Thus I second this proposal.

We could start bikeshedding about the naming (e.g. 1. gles2, 2. only-gles2, to
keep it shorter), but I don't think that will lead us anywhere and will just
delay the execution of this plan.

Thanks for proposing this!
--Dennis


signature.asc
Description: This is a digitally signed message part.