Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/3] Introduce esetuppy setup.py wrapper.
Date: Sun, 28 Oct 2012 15:58:27
Message-Id: 1351439877-9025-1-git-send-email-mgorny@gentoo.org
1 ---
2 gx86/eclass/distutils-r1.eclass | 52 ++++++++++++++++++++++++++++++-----------
3 1 file changed, 39 insertions(+), 13 deletions(-)
4
5 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
6 index 8dfe6bb..b991ab4 100644
7 --- a/gx86/eclass/distutils-r1.eclass
8 +++ b/gx86/eclass/distutils-r1.eclass
9 @@ -105,6 +105,38 @@ DEPEND=${PYTHON_DEPS}
10 # HTML_DOCS=( doc/html/ )
11 # @CODE
12
13 +# @ECLASS-VARIABLE: myesetuppyargs
14 +# @DEFAULT_UNSET
15 +# @DESCRIPTION:
16 +# An array containing options to be passed to setup.py.
17 +#
18 +# Example:
19 +# @CODE
20 +# python_configure_all() {
21 +# myesetuppyargs=( --enable-my-hidden-option )
22 +# }
23 +# @CODE
24 +
25 +# @FUNCTION: esetuppy
26 +# @USAGE: [<args>...]
27 +# @DESCRIPTION:
28 +# Run the setup.py using currently selected Python interpreter
29 +# (if ${PYTHON} is set; fallback 'python' otherwise). The setup.py will
30 +# be passed default command-line arguments, then ${myesetuppyargs[@]},
31 +# then any parameters passed to this command.
32 +#
33 +# This command will die on failure in EAPI 4 and newer, and just return
34 +# the exit code in earlier EAPIs.
35 +esetuppy() {
36 + debug-print-function ${FUNCNAME} "${@}"
37 +
38 + set -- "${PYTHON:-python}" setup.py \
39 + "${myesetuppyargs[@]}" "${@}"
40 +
41 + echo "${@}" >&2
42 + "${@}" || die
43 +}
44 +
45 # @FUNCTION: distutils-r1_python_prepare_all
46 # @DESCRIPTION:
47 # The default python_prepare_all(). It applies the patches from PATCHES
48 @@ -147,16 +179,13 @@ distutils-r1_python_configure() {
49 # @FUNCTION: distutils-r1_python_compile
50 # @USAGE: [additional-args...]
51 # @DESCRIPTION:
52 -# The default python_compile(). Runs 'setup.py build' using the correct
53 -# Python implementation. Any parameters passed to this function will be
54 -# passed to setup.py.
55 +# The default python_compile(). Runs 'esetuppy build'. Any parameters
56 +# passed to this function will be passed to setup.py.
57 distutils-r1_python_compile() {
58 debug-print-function ${FUNCNAME} "${@}"
59
60 cd "${BUILD_DIR}" || die
61 - set -- "${PYTHON}" setup.py build "${@}"
62 - echo "${@}"
63 - "${@}" || die
64 + esetuppy build "${@}"
65 }
66
67 # @FUNCTION: distutils-r1_python_test
68 @@ -198,10 +227,9 @@ distutils-r1_rename_scripts() {
69 # @FUNCTION: distutils-r1_python_install
70 # @USAGE: [additional-args...]
71 # @DESCRIPTION:
72 -# The default python_install(). Runs 'setup.py install' using
73 -# the correct Python implementation, and appending the optimization
74 -# flags. Then calls distutils-r1_rename_scripts. Any parameters passed
75 -# to this function will be passed to setup.py.
76 +# The default python_install(). Runs 'esetuppy install', appending
77 +# the optimization flags. Then calls distutils-r1_rename_scripts.
78 +# Any parameters passed to this function will be passed to setup.py.
79 distutils-r1_python_install() {
80 debug-print-function ${FUNCNAME} "${@}"
81
82 @@ -218,9 +246,7 @@ distutils-r1_python_install() {
83 unset PYTHONDONTWRITEBYTECODE
84
85 cd "${BUILD_DIR}" || die
86 - set -- "${PYTHON}" setup.py install "${flags[@]}" --root="${D}" "${@}"
87 - echo "${@}"
88 - "${@}" || die
89 + esetuppy install "${flags[@]}" --root="${D}" "${@}"
90
91 distutils-r1_rename_scripts
92 }
93 --
94 1.7.12.4