Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-dev] [PATCH 12/12] distutils-r1.eclass: Make distutils-r1_create_setup_cfg external
Date: Thu, 03 Jan 2019 21:44:44
Message-Id: 20190103213924.22835-13-chewi@gentoo.org
In Reply to: [gentoo-dev] [PATCH] Eclass changes for cross-compiling Python modules by James Le Cuirot
1 It is useful on its own when the build system calls setup.py for us,
2 from a Makefile, for example. ${BUILD_DIR} is unlikely to be set in
3 this instance so it falls back to ${PWD}.
4
5 Signed-off-by: James Le Cuirot <chewi@g.o>
6 ---
7 eclass/distutils-r1.eclass | 15 ++++++++-------
8 1 file changed, 8 insertions(+), 7 deletions(-)
9
10 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
11 index ff7792f11a87..2e969e205b16 100644
12 --- a/eclass/distutils-r1.eclass
13 +++ b/eclass/distutils-r1.eclass
14 @@ -250,7 +250,7 @@ esetup.py() {
15 local die_args=()
16 [[ ${EAPI} != [45] ]] && die_args+=( -n )
17
18 - [[ ${BUILD_DIR} ]] && _distutils-r1_create_setup_cfg
19 + [[ ${BUILD_DIR} ]] && distutils-r1_create_setup_cfg
20
21 set -- "${EPYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}"
22
23 @@ -288,7 +288,7 @@ distutils_install_for_testing() {
24 # so we need to set it properly and mkdir them,
25 # 4) it runs a bunch of commands which write random files to cwd,
26 # in order to avoid that, we add the necessary path overrides
27 - # in _distutils-r1_create_setup_cfg.
28 + # in distutils-r1_create_setup_cfg.
29
30 TEST_DIR=${BUILD_DIR}/test
31 local bindir=${TEST_DIR}/scripts
32 @@ -377,15 +377,16 @@ distutils-r1_python_configure() {
33 [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)"
34 }
35
36 -# @FUNCTION: _distutils-r1_create_setup_cfg
37 -# @INTERNAL
38 +# @FUNCTION: distutils-r1_create_setup_cfg
39 # @DESCRIPTION:
40 # Create implementation-specific configuration file for distutils,
41 # setting proper build-dir (and install-dir) paths.
42 -_distutils-r1_create_setup_cfg() {
43 +distutils-r1_create_setup_cfg() {
44 + local build_base=${BUILD_DIR:-${PWD}}
45 +
46 cat > "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
47 [build]
48 - build-base = ${BUILD_DIR}
49 + build-base = ${build_base}
50
51 # using a single directory for them helps us export
52 # ${PYTHONPATH} and ebuilds find the sources independently
53 @@ -403,7 +404,7 @@ _distutils-r1_create_setup_cfg() {
54 # this is needed by distutils_install_for_testing since
55 # setuptools like to create .egg files for install --home.
56 [bdist_egg]
57 - dist-dir = ${BUILD_DIR}/dist
58 + dist-dir = ${build_base}/dist
59
60 # this is needed when cross-compiling
61 [build_ext]
62 --
63 2.19.2