summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-08-24 13:23:48 +0000
committerMichał Górny <mgorny@gentoo.org>2014-08-24 13:23:48 +0000
commit036fca87ae9d95fe48e5077377474e0ff40669f7 (patch)
tree82060c67792cd10ea32c80e6ba22d1b417aac3c1 /eclass
parentbumped EAPI to 5; committed directly to stable as no other changes present an... (diff)
downloadgentoo-2-036fca87ae9d95fe48e5077377474e0ff40669f7.tar.gz
gentoo-2-036fca87ae9d95fe48e5077377474e0ff40669f7.tar.bz2
gentoo-2-036fca87ae9d95fe48e5077377474e0ff40669f7.zip
Pass install paths to distutils via setup.cfg.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/distutils-r1.eclass70
2 files changed, 48 insertions, 27 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 7d964aca0784..65bb4edbfa7a 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -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 <mgorny@gentoo.org> distutils-r1.eclass:
+ Pass install paths to distutils via setup.cfg.
23 Aug 2014; Sven Vermeulen <swift@gentoo.org> selinux-policy-2.eclass:
Adding relabeling support for SELinux depending packages
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 19d51b72d590..a3183e69ad4b 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-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/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 @@ fi
# 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 @@ distutils-r1_python_configure() {
# @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 @@ _distutils-r1_create_setup_cfg() {
[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 @@ _distutils-r1_copy_egg_info() {
# 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 @@ _distutils-r1_wrap_scripts() {
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 @@ _distutils-r1_wrap_scripts() {
# @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 @@ distutils-r1_python_install() {
;;
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."