Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o
Subject: [gentoo-dev] [PATCHES] distutils-r1: support 'edefault' in sub-phase functions
Date: Wed, 01 May 2013 20:43:48
Message-Id: 20130501224205.374ae039@gentoo.org
1 Hi, everyone.
2
3 This one goes to gentoo-dev since it's a potentially wider idea
4 and I'd like to get other developers opinion on.
5
6 As you most likely already know, distutils-r1 allows ebuilds to define
7 sub-phase functions like:
8
9 python_compile() {
10 # commands which will be run for each impl
11 do_something_magical
12 }
13
14 Often, ebuilds do not want to override the sub-phases completely
15 but instead call the default implementation:
16
17 python_install_all() {
18 use doc && local HTML_DOCS=( doc/html/. )
19 distutils-r1_python_install_all
20 }
21
22 So the behavior is quite similar to the regular phase functions.
23 However, the function names ended up quite verbose.
24
25 To make this more friendly, I would likely to locally introduce
26 'edefault' function in the eclass (name can change). The function would
27 -- similarly to 'default' in regular phase functions -- call
28 the default code for the sub-phase.
29
30 For example, the above would change to:
31
32 python_install_all() {
33 use doc && local HTML_DOCS=( doc/html/. )
34 edefault
35 }
36
37 I will send in reply a patch adding the described magic to the eclass,
38 and a second one showing how an example ebuild can be changed
39 (dev-python/setuptools).
40
41 What are your thoughts?
42
43 --
44 Best regards,
45 Michał Górny

Attachments

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

Replies