diff options
author | Michał Górny <mgorny@gentoo.org> | 2014-11-09 22:27:58 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2014-11-09 22:27:58 +0000 |
commit | 05f736f32bb64db0b1fa37d1ef9c2d34e0180196 (patch) | |
tree | 1cbf2da3b4a63005420764648389e197e43fd674 /eclass | |
parent | Replace perlinfo with perl_set_version (diff) | |
download | historical-05f736f32bb64db0b1fa37d1ef9c2d34e0180196.tar.gz historical-05f736f32bb64db0b1fa37d1ef9c2d34e0180196.tar.bz2 historical-05f736f32bb64db0b1fa37d1ef9c2d34e0180196.zip |
Move the has_version checks on installed implementations to python_is_installed() function. Accept PyPy when the implementation is installed, even if the virtual is not.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 8 | ||||
-rw-r--r-- | eclass/python-any-r1.eclass | 6 | ||||
-rw-r--r-- | eclass/python-utils-r1.eclass | 34 |
3 files changed, 42 insertions, 6 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index c2bfbcaa891f..ac124807284d 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for eclass directory # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1411 2014/11/09 21:34:29 dilfridge Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1412 2014/11/09 22:27:58 mgorny Exp $ + + 09 Nov 2014; Michał Górny <mgorny@gentoo.org> python-any-r1.eclass, + python-utils-r1.eclass: + Move the has_version checks on installed implementations to + python_is_installed() function. Accept PyPy when the implementation is + installed, even if the virtual is not. 09 Nov 2014; Andreas K. Huettel <dilfridge@gentoo.org> perl-module.eclass: Add docs and deprecate perlinfo and fixlocalpod diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass index 76a82710d1b3..42fd3c7f57e8 100644 --- a/eclass/python-any-r1.eclass +++ b/eclass/python-any-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2014 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.17 2014/04/08 16:05:30 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v 1.18 2014/11/09 22:27:58 mgorny Exp $ # @ECLASS: python-any-r1 # @MAINTAINER: @@ -239,9 +239,7 @@ _python_EPYTHON_supported() { esac if has "${i}" "${PYTHON_COMPAT[@]}"; then - local PYTHON_PKG_DEP - python_export "${i}" PYTHON_PKG_DEP - if ROOT=/ has_version "${PYTHON_PKG_DEP}"; then + if python_is_installed "${i}"; then if declare -f python_check_deps >/dev/null; then local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)" python_check_deps diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 82419c630a4e..e517ca1eec18 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.63 2014/11/05 23:03:01 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.64 2014/11/09 22:27:58 mgorny Exp $ # @ECLASS: python-utils-r1 # @MAINTAINER: @@ -919,6 +919,38 @@ python_is_python3() { [[ ${impl} == python3* || ${impl} == pypy3 ]] } +# @FUNCTION: python_is_installed +# @USAGE: [<impl>] +# @DESCRIPTION: +# Check whether the interpreter for <impl> (or ${EPYTHON}) is installed. +# Uses has_version with a proper dependency string. +# +# Returns 0 (true) if it is, 1 (false) otherwise. +python_is_installed() { + local impl=${1:-${EPYTHON}} + [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON" + + # for has_version + local -x ROOT=/ + case "${impl}" in + pypy|pypy3) + local append= + if [[ ${PYTHON_REQ_USE} ]]; then + append=[${PYTHON_REQ_USE}] + fi + + # be happy with just the interpeter, no need for the virtual + has_version "dev-python/${impl}${append}" \ + || has_version "dev-python/${impl}-bin${append}" + ;; + *) + local PYTHON_PKG_DEP + python_export "${impl}" PYTHON_PKG_DEP + has_version "${PYTHON_PKG_DEP}" + ;; + esac +} + # @FUNCTION: python_fix_shebang # @USAGE: [-f|--force] [-q|--quiet] <path>... # @DESCRIPTION: |