/[gentoo-x86]/dev-lang/python/python-3.3.0.ebuild
Gentoo

Contents of /dev-lang/python/python-3.3.0.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Oct 2 02:26:45 2012 UTC (23 months, 4 weeks ago) by floppym
Branch: MAIN
Changes since 1.2: +3 -4 lines
Bump patchset revision for bug 436904. Drop wide-unicode use flag.

(Portage version: 2.2.0_alpha134/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20