diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-10-22 15:16:56 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-10-22 15:16:56 +0000 |
commit | 1815e2d197d4e04f6d9b512d3d327ca48304e546 (patch) | |
tree | 332a2ca213e1e1b5bb4323d32546e6d285bb4fc9 /eclass | |
parent | Support installing Python scripts with custom --install-scripts argument. Bug... (diff) | |
download | gentoo-2-1815e2d197d4e04f6d9b512d3d327ca48304e546.tar.gz gentoo-2-1815e2d197d4e04f6d9b512d3d327ca48304e546.tar.bz2 gentoo-2-1815e2d197d4e04f6d9b512d3d327ca48304e546.zip |
Introduce a "common" python_setup function to set up Python for use in outer scope.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 7 | ||||
-rw-r--r-- | eclass/python-any-r1.eclass | 26 | ||||
-rw-r--r-- | eclass/python-r1.eclass | 17 | ||||
-rw-r--r-- | eclass/python-single-r1.eclass | 19 |
4 files changed, 54 insertions, 15 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 0c12a512c8aa..4dfac4421043 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for eclass directory # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1031 2013/10/22 15:15:51 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1032 2013/10/22 15:16:56 mgorny Exp $ + + 22 Oct 2013; Michał Górny <mgorny@gentoo.org> python-any-r1.eclass, + python-r1.eclass, python-single-r1.eclass: + Introduce a "common" python_setup function to set up Python for use in outer + scope. 22 Oct 2013; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass: Support installing Python scripts with custom --install-scripts argument. Bug diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass index 760e8e758c72..46506d3e1d32 100644 --- a/eclass/python-any-r1.eclass +++ b/eclass/python-any-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v 1.15 2013/10/12 11:08:12 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v 1.16 2013/10/22 15:16:56 mgorny Exp $ # @ECLASS: python-any-r1 # @MAINTAINER: @@ -259,17 +259,15 @@ _python_EPYTHON_supported() { return 1 } -# @FUNCTION: python-any-r1_pkg_setup +# @FUNCTION: python_setup # @DESCRIPTION: # Determine what the best installed (and supported) Python -# implementation is and set EPYTHON and PYTHON accordingly. -python-any-r1_pkg_setup() { +# implementation is, and set the Python build environment up for it. +# +# This function will call python_check_deps() if defined. +python_setup() { debug-print-function ${FUNCNAME} "${@}" - # avoid looking up Python for binary package install. - # if you need Python during pkg_preinst/_postinst, please let us know. - [[ ${MERGE_TYPE} == binary ]] && return 0 - # first, try ${EPYTHON}... maybe it's good enough for us. if [[ ${EPYTHON} ]]; then if _python_EPYTHON_supported "${EPYTHON}"; then @@ -317,5 +315,17 @@ python-any-r1_pkg_setup() { die "No supported Python implementation installed." } +# @FUNCTION: python-any-r1_pkg_setup +# @DESCRIPTION: +# Runs python_setup during from-source installs. +# +# In a binary package installs is a no-op. If you need Python in pkg_* +# phases of a binary package, call python_setup directly. +python-any-r1_pkg_setup() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${MERGE_TYPE} != binary ]] && python_setup +} + _PYTHON_ANY_R1=1 fi diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass index 750fa910254b..41bf7f9d4f8c 100644 --- a/eclass/python-r1.eclass +++ b/eclass/python-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.62 2013/09/26 11:24:30 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.63 2013/10/22 15:16:56 mgorny Exp $ # @ECLASS: python-r1 # @MAINTAINER: @@ -712,6 +712,21 @@ python_parallel_foreach_impl() { multibuild_parallel_foreach_variant _python_multibuild_wrapper "${@}" } +# @FUNCTION: python_setup +# @DESCRIPTION: +# Find the best (most preferred) Python implementation enabled +# and set the Python build environment up for it. +# +# This function needs to be used when Python is being called outside +# of python_foreach_impl calls (e.g. for shared processes like doc +# building). python_foreach_impl sets up the build environment itself. +python_setup() { + debug-print-function ${FUNCNAME} "${@}" + + python_export_best + python_wrapper_setup +} + # @FUNCTION: python_export_best # @USAGE: [<variable>...] # @DESCRIPTION: diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass index 30bbab45c162..435f6c6eb535 100644 --- a/eclass/python-single-r1.eclass +++ b/eclass/python-single-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.22 2013/09/26 11:24:30 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.23 2013/10/22 15:16:56 mgorny Exp $ # @ECLASS: python-single-r1 # @MAINTAINER: @@ -202,11 +202,11 @@ _python_single_set_globals() { } _python_single_set_globals -# @FUNCTION: python-single-r1_pkg_setup +# @FUNCTION: python_setup # @DESCRIPTION: -# Determine what the selected Python implementation is and set EPYTHON -# and PYTHON accordingly. -python-single-r1_pkg_setup() { +# Determine what the selected Python implementation is and set +# the Python build environment up for it. +python_setup() { debug-print-function ${FUNCNAME} "${@}" unset EPYTHON @@ -250,6 +250,15 @@ python-single-r1_pkg_setup() { fi } +# @FUNCTION: python-single-r1_pkg_setup +# @DESCRIPTION: +# Runs python_setup. +python-single-r1_pkg_setup() { + debug-print-function ${FUNCNAME} "${@}" + + python_setup +} + # @FUNCTION: python_fix_shebang # @USAGE: <path>... # @DESCRIPTION: |