Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o
Subject: [gentoo-dev] [PATCH 2/3] distutils-r1.eclass: Move creation of .pydistutils.cfg to esetup.py
Date: Sun, 29 May 2016 13:26:08
Message-Id: 20160529132532.24694-2-floppym@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/3] distutils-r1.eclass: Strip the trailing slash from D by Mike Gilbert
1 Also remove .pydistutils.cfg from HOME before returning.
2
3 This config should only be needed when we are invoking setup.py. The
4 esetup.py wrapper provides a normalized way for doing this; if ebuilds
5 call setup.py without the wrapper, they are now also responsible for
6 setting the build directory if necessary.
7
8 This change allows us to stop overriding the HOME variable, and prevents
9 leakage of eclass-specifc configuration to the general ebuild
10 environment.
11 ---
12 eclass/distutils-r1.eclass | 15 ++++++++++-----
13 1 file changed, 10 insertions(+), 5 deletions(-)
14
15 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
16 index 171762c..334ce73 100644
17 --- a/eclass/distutils-r1.eclass
18 +++ b/eclass/distutils-r1.eclass
19 @@ -242,10 +242,19 @@ esetup.py() {
20 local die_args=()
21 [[ ${EAPI} != [45] ]] && die_args+=( -n )
22
23 + [[ ${BUILD_DIR} ]] && _distutils-r1_create_setup_cfg
24 +
25 set -- "${PYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}"
26
27 echo "${@}" >&2
28 - "${@}" || die "${die_args[@]}" || return ${?}
29 + "${@}" || die "${die_args[@]}"
30 + local ret=${?}
31 +
32 + if [[ ${BUILD_DIR} ]]; then
33 + rm "${HOME}"/.pydistutils.cfg || die "${die_args[@]}"
34 + fi
35 +
36 + return ${ret}
37 }
38
39 # @FUNCTION: distutils_install_for_testing
40 @@ -436,7 +445,6 @@ _distutils-r1_copy_egg_info() {
41 distutils-r1_python_compile() {
42 debug-print-function ${FUNCNAME} "${@}"
43
44 - _distutils-r1_create_setup_cfg
45 _distutils-r1_copy_egg_info
46
47 esetup.py build "${@}"
48 @@ -511,9 +519,6 @@ distutils-r1_python_install() {
49 # enable compilation for the install phase.
50 local -x PYTHONDONTWRITEBYTECODE=
51
52 - # re-create setup.cfg with install paths
53 - _distutils-r1_create_setup_cfg
54 -
55 # python likes to compile any module it sees, which triggers sandbox
56 # failures if some packages haven't compiled their modules yet.
57 addpredict "${EPREFIX}/usr/$(get_libdir)/${EPYTHON}"
58 --
59 2.8.3