Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Should Sphinx really depends on PYTHON_COMPAT/PYTHON_USEDEP for `dev-python/*` ebuilds?
Date: Fri, 12 May 2017 18:33:16
Message-Id: 1494613973.1885.4.camel@gentoo.org
In Reply to: [gentoo-dev] Should Sphinx really depends on PYTHON_COMPAT/PYTHON_USEDEP for `dev-python/*` ebuilds? by Alex Turbov
1 On czw, 2017-05-11 at 11:47 +0700, Alex Turbov wrote:
2 > DEPEND=( doc?
3 > || (
4 > (
5 > dev-python/sphinx[python_targets_python2_7]
6 > # NOTE This packages provide extensions for Sphinx
7 > dev-python/rst-linker[python_targets_python2_7]
8 > dev-python/jaraco-packaging[python_targets_python2_7]
9 > )
10 > (
11 > dev-python/sphinx[python_targets_python3_5]
12 > dev-python/rst-linker[python_targets_python3_5]
13 > dev-python/jaraco-packaging[python_targets_python3_5]
14 > )
15 > (
16 > dev-python/sphinx[python_targets_python3_6]
17 > dev-python/rst-linker[python_targets_python3_6]
18 > dev-python/jaraco-packaging[python_targets_python3_6]
19 > )
20 > )
21 > )
22 >
23
24 One more thing I've missed in my initial mail. The other problem with
25 this solution (alone) is that it doesn't enforce the implementation that
26 satisfied the dependency.
27
28 Let's take a simple example. You've built sphinx for 2.7+3.5 but rst-
29 linker and jaraco-packaging for 3.5 only. The dependency is satisfied
30 because the 3.5 branch matches. However, you have no rule to enforce
31 3.5, so sphinx could be actually called with 2.7 and fail.
32
33 This is a generic problem that was pretty much solved by python-any-r1.
34 I think we should be able to copy the most important pieces of the API
35 to python-r1 to achieve something similar, i.e. add python_gen_any_dep
36 to generate the depstrings and make python_setup aware of
37 python_check_deps(). Then the above would be written alike:
38
39 DEPEND="doc? ( $(python_gen_any_dep '
40 dev-python/sphinx[${PYTHON_USEDEP}]
41 dev-python/rst-linker[${PYTHON_USEDEP}]
42      dev-python/jaraco-packaging[${PYTHON_USEDEP}]
43 ') )"
44
45 python_check_deps() {
46 has_version "dev-python/sphinx[${PYTHON_USEDEP}]" &&
47 has_version "dev-python/rst-linker[${PYTHON_USEDEP}]" &&
48 has_version "dev-python/jaraco-packaging[${PYTHON_USEDEP}]"
49 }
50
51 python_setup would verify which implementation has the dependencies
52 satisfied, and set it for the common code building docs.
53
54 However:
55
56 1. I think it would work. However, I can't be sure until I implement it,
57 and even then I might miss something.
58
59 2. It's a significant extension to the API, and kinda goes against
60 the goal of making the eclass simpler. However, it mostly fits what is
61 in python-any-r1 already, so at least it doesn't introduce a new API.
62
63 So I'd like others to chime in and let me know whether they consider
64 this a worthwhile addition before I start working on it.
65
66 --
67 Best regards,
68 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies