Gentoo Archives: gentoo-commits

From: "Michal Gorny (mgorny)" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog distutils-r1.eclass
Date: Sun, 24 Aug 2014 13:23:54
Message-Id: 20140824132348.E1BBE3CCC@oystercatcher.gentoo.org
1 mgorny 14/08/24 13:23:48
2
3 Modified: ChangeLog distutils-r1.eclass
4 Log:
5 Pass install paths to distutils via setup.cfg.
6
7 Revision Changes Path
8 1.1356 eclass/ChangeLog
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1356&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1356&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1355&r2=1.1356
13
14 Index: ChangeLog
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
17 retrieving revision 1.1355
18 retrieving revision 1.1356
19 diff -u -r1.1355 -r1.1356
20 --- ChangeLog 23 Aug 2014 10:37:18 -0000 1.1355
21 +++ ChangeLog 24 Aug 2014 13:23:48 -0000 1.1356
22 @@ -1,6 +1,9 @@
23 # ChangeLog for eclass directory
24 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1355 2014/08/23 10:37:18 swift Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1356 2014/08/24 13:23:48 mgorny Exp $
27 +
28 + 24 Aug 2014; Michał Górny <mgorny@g.o> distutils-r1.eclass:
29 + Pass install paths to distutils via setup.cfg.
30
31 23 Aug 2014; Sven Vermeulen <swift@g.o> selinux-policy-2.eclass:
32 Adding relabeling support for SELinux depending packages
33
34
35
36 1.102 eclass/distutils-r1.eclass
37
38 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.102&view=markup
39 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.102&content-type=text/plain
40 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.101&r2=1.102
41
42 Index: distutils-r1.eclass
43 ===================================================================
44 RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v
45 retrieving revision 1.101
46 retrieving revision 1.102
47 diff -u -r1.101 -r1.102
48 --- distutils-r1.eclass 8 Jul 2014 08:49:10 -0000 1.101
49 +++ distutils-r1.eclass 24 Aug 2014 13:23:48 -0000 1.102
50 @@ -1,6 +1,6 @@
51 # Copyright 1999-2014 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.101 2014/07/08 08:49:10 mgorny Exp $
54 +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.102 2014/08/24 13:23:48 mgorny Exp $
55
56 # @ECLASS: distutils-r1
57 # @MAINTAINER:
58 @@ -217,6 +217,10 @@
59 # 1. ${mydistutilsargs[@]}
60 # 2. additional arguments passed to the esetup.py function.
61 #
62 +# Please note that setup.py will respect defaults (unless overriden
63 +# via command-line options) from setup.cfg that is created
64 +# in distutils-r1_python_compile and in distutils-r1_python_install.
65 +#
66 # This command dies on failure.
67 esetup.py() {
68 debug-print-function ${FUNCNAME} "${@}"
69 @@ -338,7 +342,7 @@
70 # @INTERNAL
71 # @DESCRIPTION:
72 # Create implementation-specific configuration file for distutils,
73 -# setting proper build-dir paths.
74 +# setting proper build-dir (and install-dir) paths.
75 _distutils-r1_create_setup_cfg() {
76 cat > "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
77 [build]
78 @@ -365,6 +369,25 @@
79 [bdist_egg]
80 dist-dir = ${BUILD_DIR}/dist
81 _EOF_
82 +
83 + # we can't refer to ${D} before src_install()
84 + if [[ ${EBUILD_PHASE} == install ]]; then
85 + cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
86 +
87 + # installation paths -- allow calling extra install targets
88 + # without the default 'install'
89 + [install]
90 + compile = True
91 + optimize = 2
92 + root = ${D}
93 + _EOF_
94 +
95 + if [[ ! ${DISTUTILS_SINGLE_IMPL} ]] && _python_want_python_exec2; then
96 + cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
97 + install-scripts = $(python_get_scriptdir)
98 + _EOF_
99 + fi
100 + fi
101 }
102
103 # @FUNCTION: _distutils-r1_copy_egg_info
104 @@ -385,6 +408,9 @@
105 # The default python_compile(). Runs 'esetup.py build'. Any parameters
106 # passed to this function will be appended to setup.py invocation,
107 # i.e. passed as options to the 'build' command.
108 +#
109 +# This phase also sets up initial setup.cfg with build directories
110 +# and copies upstream egg-info files if supplied.
111 distutils-r1_python_compile() {
112 debug-print-function ${FUNCNAME} "${@}"
113
114 @@ -406,8 +432,11 @@
115 local path=${1}
116 local bindir=${2}
117
118 - if ! _python_want_python_exec2; then
119 - local PYTHON_SCRIPTDIR=${bindir}
120 + local PYTHON_SCRIPTDIR
121 + if _python_want_python_exec2; then
122 + python_export PYTHON_SCRIPTDIR
123 + else
124 + PYTHON_SCRIPTDIR=${bindir}
125 fi
126
127 local f python_files=() non_python_files=()
128 @@ -457,37 +486,29 @@
129 # @FUNCTION: distutils-r1_python_install
130 # @USAGE: [additional-args...]
131 # @DESCRIPTION:
132 -# The default python_install(). Runs 'esetup.py install', appending
133 -# the optimization flags. Then renames the installed scripts.
134 +# The default python_install(). Runs 'esetup.py install', doing
135 +# intermediate root install and handling script wrapping afterwards.
136 # Any parameters passed to this function will be appended
137 # to the setup.py invocation (i.e. as options to the 'install' command).
138 +#
139 +# This phase updates the setup.cfg file with install directories.
140 distutils-r1_python_install() {
141 debug-print-function ${FUNCNAME} "${@}"
142
143 local args=( "${@}" )
144 - local flags
145 -
146 - case "${EPYTHON}" in
147 - jython*)
148 - flags=(--compile);;
149 - *)
150 - flags=(--compile -O2);;
151 - esac
152 - debug-print "${FUNCNAME}: [${EPYTHON}] flags: ${flags}"
153
154 # enable compilation for the install phase.
155 local -x PYTHONDONTWRITEBYTECODE=
156
157 + # re-create setup.cfg with install paths
158 + _distutils-r1_create_setup_cfg
159 +
160 # python likes to compile any module it sees, which triggers sandbox
161 # failures if some packages haven't compiled their modules yet.
162 addpredict "$(python_get_sitedir)"
163 addpredict /usr/lib/portage/pym
164 addpredict /usr/local # bug 498232
165
166 - local root=${D}/_${EPYTHON}
167 - [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
168 - flags+=( --root="${root}" )
169 -
170 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
171 # user may override --install-scripts
172 # note: this is poor but distutils argv parsing is dumb
173 @@ -525,15 +546,12 @@
174 ;;
175 esac
176 done
177 -
178 - if _python_want_python_exec2; then
179 - local PYTHON_SCRIPTDIR
180 - python_export PYTHON_SCRIPTDIR
181 - flags+=( --install-scripts="${PYTHON_SCRIPTDIR}" )
182 - fi
183 fi
184
185 - esetup.py install "${flags[@]}" "${args[@]}"
186 + local root=${D}/_${EPYTHON}
187 + [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
188 +
189 + esetup.py install --root="${root}" "${args[@]}"
190
191 if [[ -d ${root}$(python_get_sitedir)/tests ]]; then
192 die "Package installs 'tests' package, file collisions likely."