Gentoo Archives: gentoo-dev

From: Alex Turbov <i.zaufi@×××××.com>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] Should Sphinx really depends on PYTHON_COMPAT/PYTHON_USEDEP for `dev-python/*` ebuilds?
Date: Thu, 11 May 2017 04:47:39
Message-Id: CANktQtuZSzxceyjPxJd2eb2GVovP_V8_ZzF-W8RoyM0y_eBBLA@mail.gmail.com
1 Hi Gentoo devs,
2
3 I'd like to discuss one thing I've concernted for a long time already.
4 Recently I've done some `dev-python` ebuild. And as most Python packages
5 it also uses `dev-python/sphinx` to produce documentation. I want to note
6 that my primary (and default) Python version is 3.5 and I have some 2.7
7 packages
8 (ebuilds) only because they required by something else (really important to
9 me).
10 or when it is dependency of some other Python2-only package.
11
12 Unfortunately most of `dev-python/*` packages, to produce docs from RST
13 files,
14 have `DEPEND` on `dev-python/sphinx[${PYTHON_USEDEP}]`! However, being a
15 standalone application (just processing a bunch of RST files to HTMLs),
16 `/usr/bin/sphinx-build` **do not** actually depeds on `PYTHON_COMPAT` of
17 the ebuild it used inside! It just needs some/any interpreter it (Sphinx)
18 was "build" with!
19
20 So, nowadays Gentoo has some reeally weired IMO behaviour: to build docs for
21 some package from `dev-python/*` with `PYTHON_TARGETS` set to (for example)
22 2.7 and
23 3.5 Python versions, I have to build Sphinx also **for all enabled Python
24 versions**
25 of that package, meanwhile **only one** is needed (and really used)! This
26 is my
27 real concern: why I have to waste my disk+time to build `dev-python/*`
28 packages
29 with `PYTHON_TARGETS` I'll never use? Some of that packages are actually
30 dependencies
31 of other Python2-only packages. In other words, to build docs using Python
32 **3**
33 version/build of Sphinx, which is work pretty fine already, for Python2
34 enabled package,
35 I have to install a lot of Python-2 packages, dependencies of Sphinx to be
36 built w/ Python 2,
37 and enable `python2_7` for packages I've already have as Python3-only,
38 which in turn could
39 bring even more strange dependencies into scope.
40
41 Thus generally specking, Sphinx dependencies have no relations to `DEPEND`
42 of particular
43 `dev-python/*` ebuilds! So, in simple case there is should be enough to
44 specify
45
46 DEPEND=( doc? ( dev-python/sphinx ) )
47
48 for that ebuilds. In some rare cases (like
49 https://bugs.gentoo.org/show_bug.cgi?id=618162)
50 Sphinx could use some extensions (plugins) and they also have no any
51 relation to `PYTHON_COMPAT`
52 of particular `dev-python/*` ebuild! That plugins to work need just the
53 same `PYTHON_TARGETS`
54 as used to build Sphinx. Unfortunately I can't find appropriate helper
55 function(s) in any
56 currently present Python reelated eclasses (or am I miss smth?), so I used
57 the following
58 dependency spec:
59
60 DEPEND=( doc?
61 || (
62 (
63 dev-python/sphinx[python_targets_python2_7]
64 # NOTE This packages provide extensions for Sphinx
65 dev-python/rst-linker[python_targets_python2_7]
66 dev-python/jaraco-packaging[python_targets_python2_7]
67 )
68 (
69 dev-python/sphinx[python_targets_python3_5]
70 dev-python/rst-linker[python_targets_python3_5]
71 dev-python/jaraco-packaging[python_targets_python3_5]
72 )
73 (
74 dev-python/sphinx[python_targets_python3_6]
75 dev-python/rst-linker[python_targets_python3_6]
76 dev-python/jaraco-packaging[python_targets_python3_6]
77 )
78 )
79 )
80
81 So, my questions are:
82
83 0. am I missed smth? (and there are some other cases, I don't know about)
84 1. am I missed smth? (and there are some helper functions exist in eclasses
85 to expess that kind
86 of dependencies)
87 2. I think it would be nice to have some support for Sphinx in eclasses to
88 simplify ebuilds writing
89 (if #1 is false)
90
91 Ideas/comments/opinions are really welcome...

Replies