summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-10-29 13:30:48 +0000
committerMichał Górny <mgorny@gentoo.org>2012-10-29 13:30:48 +0000
commit3303020998329925cd0e86354c3e139d77257816 (patch)
treec1a4ba22d416f3ccc30c014981a24941ed8afd3a /eclass/distutils-r1.eclass
parentVersion bump (diff)
downloadhistorical-3303020998329925cd0e86354c3e139d77257816.tar.gz
historical-3303020998329925cd0e86354c3e139d77257816.tar.bz2
historical-3303020998329925cd0e86354c3e139d77257816.zip
Introduce an esetup.py wrapper function and mydistutilsargs=() for it.
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass53
1 files changed, 39 insertions, 14 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index ba936d17641d..9b427f669a6e 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.12 2012/10/29 09:54:50 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.13 2012/10/29 13:30:48 mgorny Exp $
# @ECLASS: distutils-r1
# @MAINTAINER:
@@ -105,6 +105,37 @@ DEPEND=${PYTHON_DEPS}
# HTML_DOCS=( doc/html/ )
# @CODE
+# @ECLASS-VARIABLE: mydistutilsargs
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array containing options to be passed to setup.py.
+#
+# Example:
+# @CODE
+# python_configure_all() {
+# mydistutilsargs=( --enable-my-hidden-option )
+# }
+# @CODE
+
+# @FUNCTION: esetup.py
+# @USAGE: [<args>...]
+# @DESCRIPTION:
+# Run the setup.py using currently selected Python interpreter
+# (if ${PYTHON} is set; fallback 'python' otherwise). The setup.py will
+# be passed default command-line arguments, then ${mydistutilsargs[@]},
+# then any parameters passed to this command.
+#
+# This command dies on failure.
+esetup.py() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ set -- "${PYTHON:-python}" setup.py \
+ "${mydistutilsargs[@]}" "${@}"
+
+ echo "${@}" >&2
+ "${@}" || die
+}
+
# @FUNCTION: distutils-r1_python_prepare_all
# @DESCRIPTION:
# The default python_prepare_all(). It applies the patches from PATCHES
@@ -147,15 +178,12 @@ distutils-r1_python_configure() {
# @FUNCTION: distutils-r1_python_compile
# @USAGE: [additional-args...]
# @DESCRIPTION:
-# The default python_compile(). Runs 'setup.py build' using the correct
-# Python implementation. Any parameters passed to this function will be
-# passed to setup.py.
+# The default python_compile(). Runs 'esetup.py build'. Any parameters
+# passed to this function will be passed to setup.py.
distutils-r1_python_compile() {
debug-print-function ${FUNCNAME} "${@}"
- set -- "${PYTHON}" setup.py build "${@}"
- echo "${@}"
- "${@}" || die
+ esetup.py build "${@}"
}
# @FUNCTION: distutils-r1_python_test
@@ -197,10 +225,9 @@ distutils-r1_rename_scripts() {
# @FUNCTION: distutils-r1_python_install
# @USAGE: [additional-args...]
# @DESCRIPTION:
-# The default python_install(). Runs 'setup.py install' using
-# the correct Python implementation, and appending the optimization
-# flags. Then calls distutils-r1_rename_scripts. Any parameters passed
-# to this function will be passed to setup.py.
+# The default python_install(). Runs 'esetup.py install', appending
+# the optimization flags. Then calls distutils-r1_rename_scripts.
+# Any parameters passed to this function will be passed to setup.py.
distutils-r1_python_install() {
debug-print-function ${FUNCNAME} "${@}"
@@ -216,9 +243,7 @@ distutils-r1_python_install() {
unset PYTHONDONTWRITEBYTECODE
- set -- "${PYTHON}" setup.py install "${flags[@]}" --root="${D}" "${@}"
- echo "${@}"
- "${@}" || die
+ esetup.py install "${flags[@]}" --root="${D}" "${@}"
distutils-r1_rename_scripts
}