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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations) (download)
Sun Sep 30 17:15:28 2012 UTC (23 months, 2 weeks ago) by armin76
Branch: MAIN
Changes since 1.16: +2 -2 lines
alpha/ia64/m68k/s390/sh/sparc stable wrt #427548

(Portage version: 2.1.11.16/cvs/Linux ia64)

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.2.3.ebuild,v 1.16 2012/08/03 21:22:53 blueness 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="0"
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.2"
21 PYTHON_ABI="${SLOT}"
22 KEYWORDS="alpha amd64 arm ~hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
23 IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode 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 pkg_setup() {
53 python_pkg_setup
54
55 if [[ "${PV}" =~ ^3\.2(\.[1234])?(_pre)? ]]; then
56 rm -f "${EROOT}usr/$(get_libdir)/llibpython3.so"
57 else
58 die "Deprecated code not deleted"
59 fi
60 }
61
62 src_prepare() {
63 # Ensure that internal copies of expat, libffi and zlib are not used.
64 rm -fr Modules/expat
65 rm -fr Modules/_ctypes/libffi*
66 rm -fr Modules/zlib
67
68 local excluded_patches
69 if ! tc-is-cross-compiler; then
70 excluded_patches="*_all_crosscompile.patch"
71 fi
72
73 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
74 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
75 epatch "${FILESDIR}"/${PN}-3.2.3-x32.patch
76
77 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
78 Lib/distutils/command/install.py \
79 Lib/distutils/sysconfig.py \
80 Lib/site.py \
81 Lib/sysconfig.py \
82 Lib/test/test_site.py \
83 Makefile.pre.in \
84 Modules/Setup.dist \
85 Modules/getpath.c \
86 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
87
88 # Disable ABI flags.
89 sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.in || die "sed failed"
90
91 eautoconf
92 eautoheader
93 }
94
95 src_configure() {
96 if use build; then
97 # Disable extraneous modules with extra dependencies.
98 export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
99 export PYTHON_DISABLE_SSL="1"
100 else
101 local disable
102 use gdbm || disable+=" gdbm"
103 use ncurses || disable+=" _curses _curses_panel"
104 use readline || disable+=" readline"
105 use sqlite || disable+=" _sqlite3"
106 use ssl || export PYTHON_DISABLE_SSL="1"
107 use tk || disable+=" _tkinter"
108 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
109 export PYTHON_DISABLE_MODULES="${disable}"
110
111 if ! use xml; then
112 ewarn "You have configured Python without XML support."
113 ewarn "This is NOT a recommended configuration as you"
114 ewarn "may face problems parsing any XML documents."
115 fi
116 fi
117
118 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
119 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
120 fi
121
122 if [[ "$(gcc-major-version)" -ge 4 ]]; then
123 append-flags -fwrapv
124 fi
125
126 filter-flags -malign-double
127
128 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
129
130 # https://bugs.gentoo.org/show_bug.cgi?id=50309
131 if is-flagq -O3; then
132 is-flagq -fstack-protector-all && replace-flags -O3 -O2
133 use hardened && replace-flags -O3 -O2
134 fi
135
136 if tc-is-cross-compiler; then
137 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
138 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
139 emake python Parser/pgen || die "cross-make failed"
140 mv python hostpython
141 mv Parser/pgen Parser/hostpgen
142 make distclean
143 sed -i \
144 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
145 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
146 Makefile.pre.in || die "sed failed"
147 fi
148
149 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
150 tc-export CXX
151 # The configure script fails to use pkg-config correctly.
152 # http://bugs.python.org/issue15506
153 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
154
155 # Set LDFLAGS so we link modules with -lpython3.2 correctly.
156 # Needed on FreeBSD unless Python 3.2 is already installed.
157 # Please query BSD team before removing this!
158 append-ldflags "-L."
159
160 local dbmliborder
161 if use gdbm; then
162 dbmliborder+="${dbmliborder:+:}gdbm"
163 fi
164
165 OPT="" econf \
166 --with-fpectl \
167 --enable-shared \
168 $(use_enable ipv6) \
169 $(use_with threads) \
170 $(use_with wide-unicode) \
171 --infodir='${prefix}/share/info' \
172 --mandir='${prefix}/share/man' \
173 --with-computed-gotos \
174 --with-dbmliborder="${dbmliborder}" \
175 --with-libc="" \
176 --enable-loadable-sqlite-extensions \
177 --with-system-expat \
178 --with-system-ffi
179 }
180
181 src_compile() {
182 emake CPPFLAGS="" CFLAGS="" LDFLAGS="" || die "emake failed"
183
184 # Work around bug 329499. See also bug 413751.
185 pax-mark m python
186 }
187
188 src_test() {
189 # Tests will not work when cross compiling.
190 if tc-is-cross-compiler; then
191 elog "Disabling tests due to crosscompiling."
192 return
193 fi
194
195 # Byte compiling should be enabled here.
196 # Otherwise test_import fails.
197 python_enable_pyc
198
199 # Skip failing tests.
200 local skipped_tests="gdb"
201
202 for test in ${skipped_tests}; do
203 mv Lib/test/test_${test}.py "${T}"
204 done
205
206 # Rerun failed tests in verbose mode (regrtest -w).
207 emake test EXTRATESTOPTS="-w" CPPFLAGS="" CFLAGS="" LDFLAGS="" < /dev/tty
208 local result="$?"
209
210 for test in ${skipped_tests}; do
211 mv "${T}/test_${test}.py" Lib/test
212 done
213
214 elog "The following tests have been skipped:"
215 for test in ${skipped_tests}; do
216 elog "test_${test}.py"
217 done
218
219 elog "If you would like to run them, you may:"
220 elog "cd '${EPREFIX}$(python_get_libdir)/test'"
221 elog "and run the tests separately."
222
223 python_disable_pyc
224
225 if [[ "${result}" -ne 0 ]]; then
226 die "emake test failed"
227 fi
228 }
229
230 src_install() {
231 emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
232 python_clean_installation_image -q
233
234 sed \
235 -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
236 -e "s/\(PY_LDFLAGS=\).*/\1/" \
237 -i "${ED}$(python_get_libdir)/config-${SLOT}/Makefile" || die "sed failed"
238
239 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
240
241 # Fix collisions between different slots of Python.
242 rm -f "${ED}usr/$(get_libdir)/libpython3.so"
243
244 if use build; then
245 rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,sqlite3,test,tkinter}
246 else
247 use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/test"
248 use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
249 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,tkinter,test/test_tk*}
250 fi
251
252 use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
253 use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe
254
255 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
256
257 if use examples; then
258 insinto /usr/share/doc/${PF}/examples
259 find Tools -name __pycache__ -print0 | xargs -0 rm -fr
260 doins -r Tools || die "doins failed"
261 fi
262
263 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
264 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
265 sed \
266 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
267 -e "s:@PYDOC@:pydoc${SLOT}:" \
268 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
269 }
270
271 pkg_preinst() {
272 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
273 python_updater_warning="1"
274 fi
275 }
276
277 eselect_python_update() {
278 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
279 eselect python update
280 fi
281
282 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
283 eselect python update --python${PV%%.*}
284 fi
285 }
286
287 pkg_postinst() {
288 eselect_python_update
289
290 python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
291
292 if [[ "${python_updater_warning}" == "1" ]]; then
293 ewarn "You have just upgraded from an older version of Python."
294 ewarn "You should switch active version of Python ${PV%%.*} and run"
295 ewarn "'python-updater [options]' to rebuild Python modules."
296 fi
297 }
298
299 pkg_postrm() {
300 eselect_python_update
301
302 python_mod_cleanup $(python_get_libdir)
303 }

  ViewVC Help
Powered by ViewVC 1.1.20