Gentoo Archives: gentoo-commits

From: "Dirkjan Ochtman (djc)" <djc@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/python: ChangeLog python-3.3.0.ebuild
Date: Sun, 30 Sep 2012 15:18:40
Message-Id: 20120930151829.9F8C521600@flycatcher.gentoo.org
1 djc 12/09/30 15:18:29
2
3 Modified: ChangeLog
4 Added: python-3.3.0.ebuild
5 Log:
6 Add tentative python-3.3 ebuild.
7
8 (Portage version: 2.1.11.23/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.613 dev-lang/python/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.613&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.613&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?r1=1.612&r2=1.613
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v
20 retrieving revision 1.612
21 retrieving revision 1.613
22 diff -u -r1.612 -r1.613
23 --- ChangeLog 27 Sep 2012 03:08:40 -0000 1.612
24 +++ ChangeLog 30 Sep 2012 15:18:29 -0000 1.613
25 @@ -1,6 +1,11 @@
26 # ChangeLog for dev-lang/python
27 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.612 2012/09/27 03:08:40 mattst88 Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.613 2012/09/30 15:18:29 djc Exp $
30 +
31 +*python-3.3.0 (30 Sep 2012)
32 +
33 + 30 Sep 2012; Dirkjan Ochtman <djc@g.o> +python-3.3.0.ebuild:
34 + Add tentative python-3.3 ebuild. Some tests still fail.
35
36 27 Sep 2012; Matt Turner <mattst88@g.o> python-3.1.5.ebuild,
37 python-3.2.3-r1.ebuild:
38
39
40
41 1.1 dev-lang/python/python-3.3.0.ebuild
42
43 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.3.0.ebuild?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.3.0.ebuild?rev=1.1&content-type=text/plain
45
46 Index: python-3.3.0.ebuild
47 ===================================================================
48 # Copyright 1999-2012 Gentoo Foundation
49 # Distributed under the terms of the GNU General Public License v2
50 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.3.0.ebuild,v 1.1 2012/09/30 15:18:29 djc Exp $
51
52 EAPI="3"
53 WANT_AUTOMAKE="none"
54 WANT_LIBTOOL="none"
55
56 inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
57
58 MY_P="Python-${PV}"
59 PATCHSET_REVISION="0"
60
61 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
62 HOMEPAGE="http://www.python.org/"
63 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
64 mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
65
66 LICENSE="PSF-2"
67 SLOT="3.2"
68 PYTHON_ABI="${SLOT}"
69 KEYWORDS=""
70 IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
71
72 RDEPEND="app-arch/bzip2
73 >=sys-libs/zlib-1.1.3
74 virtual/libffi
75 virtual/libintl
76 !build? (
77 gdbm? ( sys-libs/gdbm[berkdb] )
78 ncurses? (
79 >=sys-libs/ncurses-5.2
80 readline? ( >=sys-libs/readline-4.1 )
81 )
82 sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] )
83 ssl? ( dev-libs/openssl )
84 tk? (
85 >=dev-lang/tk-8.0
86 dev-tcltk/blt
87 )
88 xml? ( >=dev-libs/expat-2.1 )
89 )"
90 DEPEND="${RDEPEND}
91 virtual/pkgconfig
92 >=sys-devel/autoconf-2.65
93 !sys-devel/gcc[libffi]"
94 RDEPEND+=" !build? ( app-misc/mime-types )
95 doc? ( dev-python/python-docs:${SLOT} )"
96
97 S="${WORKDIR}/${MY_P}"
98
99 src_prepare() {
100 # Ensure that internal copies of expat, libffi and zlib are not used.
101 rm -fr Modules/expat
102 rm -fr Modules/_ctypes/libffi*
103 rm -fr Modules/zlib
104
105 local excluded_patches
106 if ! tc-is-cross-compiler; then
107 excluded_patches="*_all_crosscompile.patch"
108 fi
109
110 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
111 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
112
113 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
114 Lib/distutils/command/install.py \
115 Lib/distutils/sysconfig.py \
116 Lib/site.py \
117 Lib/sysconfig.py \
118 Lib/test/test_site.py \
119 Makefile.pre.in \
120 Modules/Setup.dist \
121 Modules/getpath.c \
122 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
123
124 # Disable ABI flags.
125 sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed failed"
126
127 eautoconf
128 eautoheader
129 }
130
131 src_configure() {
132 if use build; then
133 # Disable extraneous modules with extra dependencies.
134 export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
135 export PYTHON_DISABLE_SSL="1"
136 else
137 local disable
138 use gdbm || disable+=" gdbm"
139 use ncurses || disable+=" _curses _curses_panel"
140 use readline || disable+=" readline"
141 use sqlite || disable+=" _sqlite3"
142 use ssl || export PYTHON_DISABLE_SSL="1"
143 use tk || disable+=" _tkinter"
144 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
145 export PYTHON_DISABLE_MODULES="${disable}"
146
147 if ! use xml; then
148 ewarn "You have configured Python without XML support."
149 ewarn "This is NOT a recommended configuration as you"
150 ewarn "may face problems parsing any XML documents."
151 fi
152 fi
153
154 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
155 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
156 fi
157
158 if [[ "$(gcc-major-version)" -ge 4 ]]; then
159 append-flags -fwrapv
160 fi
161
162 filter-flags -malign-double
163
164 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
165
166 # https://bugs.gentoo.org/show_bug.cgi?id=50309
167 if is-flagq -O3; then
168 is-flagq -fstack-protector-all && replace-flags -O3 -O2
169 use hardened && replace-flags -O3 -O2
170 fi
171
172 if tc-is-cross-compiler; then
173 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
174 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
175 emake python Parser/pgen || die "cross-make failed"
176 mv python hostpython
177 mv Parser/pgen Parser/hostpgen
178 make distclean
179 sed -i \
180 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
181 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
182 Makefile.pre.in || die "sed failed"
183 fi
184
185 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
186 tc-export CXX
187 # The configure script fails to use pkg-config correctly.
188 # http://bugs.python.org/issue15506
189 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
190
191 # Set LDFLAGS so we link modules with -lpython3.2 correctly.
192 # Needed on FreeBSD unless Python 3.2 is already installed.
193 # Please query BSD team before removing this!
194 append-ldflags "-L."
195
196 local dbmliborder
197 if use gdbm; then
198 dbmliborder+="${dbmliborder:+:}gdbm"
199 fi
200
201 OPT="" econf \
202 --with-fpectl \
203 --enable-shared \
204 $(use_enable ipv6) \
205 $(use_with threads) \
206 $(use_with wide-unicode) \
207 --infodir='${prefix}/share/info' \
208 --mandir='${prefix}/share/man' \
209 --with-computed-gotos \
210 --with-dbmliborder="${dbmliborder}" \
211 --with-libc="" \
212 --enable-loadable-sqlite-extensions \
213 --with-system-expat \
214 --with-system-ffi
215 }
216
217 src_compile() {
218 emake CPPFLAGS="" CFLAGS="" LDFLAGS="" || die "emake failed"
219
220 # Work around bug 329499. See also bug 413751.
221 pax-mark m python
222 }
223
224 src_test() {
225 # Tests will not work when cross compiling.
226 if tc-is-cross-compiler; then
227 elog "Disabling tests due to crosscompiling."
228 return
229 fi
230
231 # Byte compiling should be enabled here.
232 # Otherwise test_import fails.
233 python_enable_pyc
234
235 # Skip failing tests.
236 local skipped_tests="gdb"
237
238 for test in ${skipped_tests}; do
239 mv Lib/test/test_${test}.py "${T}"
240 done
241
242 # Rerun failed tests in verbose mode (regrtest -w).
243 emake test EXTRATESTOPTS="-w" CPPFLAGS="" CFLAGS="" LDFLAGS="" < /dev/tty
244 local result="$?"
245
246 for test in ${skipped_tests}; do
247 mv "${T}/test_${test}.py" Lib/test
248 done
249
250 elog "The following tests have been skipped:"
251 for test in ${skipped_tests}; do
252 elog "test_${test}.py"
253 done
254
255 elog "If you would like to run them, you may:"
256 elog "cd '${EPREFIX}$(python_get_libdir)/test'"
257 elog "and run the tests separately."
258
259 python_disable_pyc
260
261 if [[ "${result}" -ne 0 ]]; then
262 die "emake test failed"
263 fi
264 }
265
266 src_install() {
267 emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
268 python_clean_installation_image -q
269
270 sed \
271 -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
272 -e "s/\(PY_LDFLAGS=\).*/\1/" \
273 -i "${ED}$(python_get_libdir)/config-${SLOT}/Makefile" || die "sed failed"
274
275 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
276
277 # Fix collisions between different slots of Python.
278 rm -f "${ED}usr/$(get_libdir)/libpython3.so"
279
280 if use build; then
281 rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,sqlite3,test,tkinter}
282 else
283 use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/test"
284 use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
285 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,tkinter,test/test_tk*}
286 fi
287
288 use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
289 use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe
290
291 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
292
293 if use examples; then
294 insinto /usr/share/doc/${PF}/examples
295 find Tools -name __pycache__ -print0 | xargs -0 rm -fr
296 doins -r Tools || die "doins failed"
297 fi
298
299 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
300 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
301 sed \
302 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
303 -e "s:@PYDOC@:pydoc${SLOT}:" \
304 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
305 }
306
307 pkg_preinst() {
308 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
309 python_updater_warning="1"
310 fi
311 }
312
313 eselect_python_update() {
314 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
315 eselect python update
316 fi
317
318 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
319 eselect python update --python${PV%%.*}
320 fi
321 }
322
323 pkg_postinst() {
324 eselect_python_update
325
326 python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
327
328 if [[ "${python_updater_warning}" == "1" ]]; then
329 ewarn "You have just upgraded from an older version of Python."
330 ewarn "You should switch active version of Python ${PV%%.*} and run"
331 ewarn "'python-updater [options]' to rebuild Python modules."
332 fi
333 }
334
335 pkg_postrm() {
336 eselect_python_update
337
338 python_mod_cleanup $(python_get_libdir)
339 }