mgorny 14/08/24 13:23:48 Modified: ChangeLog distutils-r1.eclass Log: Pass install paths to distutils via setup.cfg.
Revision Changes Path 1.1356 eclass/ChangeLog file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1356&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1356&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1355&r2=1.1356 Index: ChangeLog =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v retrieving revision 1.1355 retrieving revision 1.1356 diff -u -r1.1355 -r1.1356 --- ChangeLog 23 Aug 2014 10:37:18 -0000 1.1355 +++ ChangeLog 24 Aug 2014 13:23:48 -0000 1.1356 @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1355 2014/08/23 10:37:18 swift Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1356 2014/08/24 13:23:48 mgorny Exp $ + + 24 Aug 2014; Michał Górny <[email protected]> distutils-r1.eclass: + Pass install paths to distutils via setup.cfg. 23 Aug 2014; Sven Vermeulen <[email protected]> selinux-policy-2.eclass: Adding relabeling support for SELinux depending packages 1.102 eclass/distutils-r1.eclass file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.102&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.102&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.101&r2=1.102 Index: distutils-r1.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- distutils-r1.eclass 8 Jul 2014 08:49:10 -0000 1.101 +++ distutils-r1.eclass 24 Aug 2014 13:23:48 -0000 1.102 @@ -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/distutils-r1.eclass,v 1.101 2014/07/08 08:49:10 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.102 2014/08/24 13:23:48 mgorny Exp $ # @ECLASS: distutils-r1 # @MAINTAINER: @@ -217,6 +217,10 @@ # 1. ${mydistutilsargs[@]} # 2. additional arguments passed to the esetup.py function. # +# Please note that setup.py will respect defaults (unless overriden +# via command-line options) from setup.cfg that is created +# in distutils-r1_python_compile and in distutils-r1_python_install. +# # This command dies on failure. esetup.py() { debug-print-function ${FUNCNAME} "${@}" @@ -338,7 +342,7 @@ # @INTERNAL # @DESCRIPTION: # Create implementation-specific configuration file for distutils, -# setting proper build-dir paths. +# setting proper build-dir (and install-dir) paths. _distutils-r1_create_setup_cfg() { cat > "${HOME}"/.pydistutils.cfg <<-_EOF_ || die [build] @@ -365,6 +369,25 @@ [bdist_egg] dist-dir = ${BUILD_DIR}/dist _EOF_ + + # we can't refer to ${D} before src_install() + if [[ ${EBUILD_PHASE} == install ]]; then + cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die + + # installation paths -- allow calling extra install targets + # without the default 'install' + [install] + compile = True + optimize = 2 + root = ${D} + _EOF_ + + if [[ ! ${DISTUTILS_SINGLE_IMPL} ]] && _python_want_python_exec2; then + cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die + install-scripts = $(python_get_scriptdir) + _EOF_ + fi + fi } # @FUNCTION: _distutils-r1_copy_egg_info @@ -385,6 +408,9 @@ # The default python_compile(). Runs 'esetup.py build'. Any parameters # passed to this function will be appended to setup.py invocation, # i.e. passed as options to the 'build' command. +# +# This phase also sets up initial setup.cfg with build directories +# and copies upstream egg-info files if supplied. distutils-r1_python_compile() { debug-print-function ${FUNCNAME} "${@}" @@ -406,8 +432,11 @@ local path=${1} local bindir=${2} - if ! _python_want_python_exec2; then - local PYTHON_SCRIPTDIR=${bindir} + local PYTHON_SCRIPTDIR + if _python_want_python_exec2; then + python_export PYTHON_SCRIPTDIR + else + PYTHON_SCRIPTDIR=${bindir} fi local f python_files=() non_python_files=() @@ -457,37 +486,29 @@ # @FUNCTION: distutils-r1_python_install # @USAGE: [additional-args...] # @DESCRIPTION: -# The default python_install(). Runs 'esetup.py install', appending -# the optimization flags. Then renames the installed scripts. +# The default python_install(). Runs 'esetup.py install', doing +# intermediate root install and handling script wrapping afterwards. # Any parameters passed to this function will be appended # to the setup.py invocation (i.e. as options to the 'install' command). +# +# This phase updates the setup.cfg file with install directories. distutils-r1_python_install() { debug-print-function ${FUNCNAME} "${@}" local args=( "${@}" ) - local flags - - case "${EPYTHON}" in - jython*) - flags=(--compile);; - *) - flags=(--compile -O2);; - esac - debug-print "${FUNCNAME}: [${EPYTHON}] flags: ${flags}" # enable compilation for the install phase. local -x PYTHONDONTWRITEBYTECODE= + # re-create setup.cfg with install paths + _distutils-r1_create_setup_cfg + # python likes to compile any module it sees, which triggers sandbox # failures if some packages haven't compiled their modules yet. addpredict "$(python_get_sitedir)" addpredict /usr/lib/portage/pym addpredict /usr/local # bug 498232 - local root=${D}/_${EPYTHON} - [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D} - flags+=( --root="${root}" ) - if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then # user may override --install-scripts # note: this is poor but distutils argv parsing is dumb @@ -525,15 +546,12 @@ ;; esac done - - if _python_want_python_exec2; then - local PYTHON_SCRIPTDIR - python_export PYTHON_SCRIPTDIR - flags+=( --install-scripts="${PYTHON_SCRIPTDIR}" ) - fi fi - esetup.py install "${flags[@]}" "${args[@]}" + local root=${D}/_${EPYTHON} + [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D} + + esetup.py install --root="${root}" "${args[@]}" if [[ -d ${root}$(python_get_sitedir)/tests ]]; then die "Package installs 'tests' package, file collisions likely."
