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

Contents of /dev-lang/python/python-2.7.3-r3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.24 - (show annotations) (download)
Thu Oct 10 08:06:30 2013 UTC (14 months, 1 week ago) by djc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.23: +1 -1 lines
FILE REMOVED
Remove old versions of python.

(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 30380381)

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.3-r3.ebuild,v 1.23 2013/08/28 15:59:25 floppym Exp $
4
5 EAPI="2"
6 WANT_AUTOMAKE="none"
7 WANT_LIBTOOL="none"
8
9 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
10
11 MY_P="Python-${PV}"
12 PATCHSET_REVISION="1"
13
14 DESCRIPTION="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.bz2
17 mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
18
19 LICENSE="PSF-2"
20 SLOT="2.7"
21 KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
22 IUSE="-berkdb build doc elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
23
24 # Do not add a dependency on dev-lang/python to this ebuild.
25 # If you need to apply a patch which requires python for bootstrapping, please
26 # run the bootstrap code on your dev box and include the results in the
27 # patchset. See bug 447752.
28
29 RDEPEND="app-arch/bzip2
30 >=sys-libs/zlib-1.1.3
31 virtual/libffi
32 virtual/libintl
33 !build? (
34 berkdb? ( || (
35 sys-libs/db:4.8
36 sys-libs/db:4.7
37 sys-libs/db:4.6
38 sys-libs/db:4.5
39 sys-libs/db:4.4
40 sys-libs/db:4.3
41 sys-libs/db:4.2
42 ) )
43 gdbm? ( sys-libs/gdbm[berkdb] )
44 ncurses? (
45 >=sys-libs/ncurses-5.2
46 readline? ( >=sys-libs/readline-4.1 )
47 )
48 sqlite? ( >=dev-db/sqlite-3.3.8:3 )
49 ssl? ( dev-libs/openssl )
50 tk? (
51 >=dev-lang/tk-8.0
52 dev-tcltk/blt
53 )
54 xml? ( >=dev-libs/expat-2.1 )
55 )
56 !!<sys-apps/portage-2.1.9"
57 DEPEND="${RDEPEND}
58 virtual/pkgconfig
59 >=sys-devel/autoconf-2.65
60 !sys-devel/gcc[libffi]"
61 RDEPEND+=" !build? ( app-misc/mime-types )
62 doc? ( dev-python/python-docs:${SLOT} )"
63 PDEPEND="app-admin/eselect-python
64 app-admin/python-updater"
65
66 S="${WORKDIR}/${MY_P}"
67
68 pkg_setup() {
69 if use berkdb; then
70 ewarn "'bsddb' module is out-of-date and no longer maintained inside"
71 ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
72 ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
73 ewarn "is provided by dev-python/bsddb3."
74 else
75 if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
76 ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
77 ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
78 ewarn "You might need to migrate your databases."
79 fi
80 fi
81 }
82
83 src_prepare() {
84 # Ensure that internal copies of expat, libffi and zlib are not used.
85 rm -fr Modules/expat
86 rm -fr Modules/_ctypes/libffi*
87 rm -fr Modules/zlib
88
89 local excluded_patches
90 if ! tc-is-cross-compiler; then
91 excluded_patches="*_all_crosscompile.patch"
92 fi
93
94 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
95 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
96
97 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
98 Lib/distutils/command/install.py \
99 Lib/distutils/sysconfig.py \
100 Lib/site.py \
101 Lib/sysconfig.py \
102 Lib/test/test_site.py \
103 Makefile.pre.in \
104 Modules/Setup.dist \
105 Modules/getpath.c \
106 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
107
108 eautoconf
109 eautoheader
110 }
111
112 src_configure() {
113 if use build; then
114 # Disable extraneous modules with extra dependencies.
115 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
116 export PYTHON_DISABLE_SSL="1"
117 else
118 # dbm module can be linked against berkdb or gdbm.
119 # Defaults to gdbm when both are enabled, #204343.
120 local disable
121 use berkdb || use gdbm || disable+=" dbm"
122 use berkdb || disable+=" _bsddb"
123 use gdbm || disable+=" gdbm"
124 use ncurses || disable+=" _curses _curses_panel"
125 use readline || disable+=" readline"
126 use sqlite || disable+=" _sqlite3"
127 use ssl || export PYTHON_DISABLE_SSL="1"
128 use tk || disable+=" _tkinter"
129 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
130 export PYTHON_DISABLE_MODULES="${disable}"
131
132 if ! use xml; then
133 ewarn "You have configured Python without XML support."
134 ewarn "This is NOT a recommended configuration as you"
135 ewarn "may face problems parsing any XML documents."
136 fi
137 fi
138
139 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
140 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
141 fi
142
143 if [[ "$(gcc-major-version)" -ge 4 ]]; then
144 append-flags -fwrapv
145 fi
146
147 filter-flags -malign-double
148
149 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
150
151 # https://bugs.gentoo.org/show_bug.cgi?id=50309
152 if is-flagq -O3; then
153 is-flagq -fstack-protector-all && replace-flags -O3 -O2
154 use hardened && replace-flags -O3 -O2
155 fi
156
157 # Run the configure scripts in parallel.
158 multijob_init
159
160 mkdir -p "${WORKDIR}"/{${CBUILD},${CHOST}}
161
162 if tc-is-cross-compiler; then
163 (
164 multijob_child_init
165 cd "${WORKDIR}"/${CBUILD} >/dev/null
166 OPT="-O1" CFLAGS="" CPPFLAGS="" LDFLAGS="" CC="" \
167 "${S}"/configure \
168 --{build,host}=${CBUILD} \
169 || die "cross-configure failed"
170 ) &
171 multijob_post_fork
172
173 # The configure script assumes it's buggy when cross-compiling.
174 export ac_cv_buggy_getaddrinfo=no
175 export ac_cv_have_long_long_format=yes
176 fi
177
178 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
179 tc-export CXX
180 # The configure script fails to use pkg-config correctly.
181 # http://bugs.python.org/issue15506
182 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
183
184 # Set LDFLAGS so we link modules with -lpython2.7 correctly.
185 # Needed on FreeBSD unless Python 2.7 is already installed.
186 # Please query BSD team before removing this!
187 append-ldflags "-L."
188
189 local dbmliborder
190 if use gdbm; then
191 dbmliborder+="${dbmliborder:+:}gdbm"
192 fi
193 if use berkdb; then
194 dbmliborder+="${dbmliborder:+:}bdb"
195 fi
196
197 cd "${WORKDIR}"/${CHOST}
198 ECONF_SOURCE=${S} OPT="" \
199 econf \
200 --with-fpectl \
201 --enable-shared \
202 $(use_enable ipv6) \
203 $(use_with threads) \
204 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
205 --infodir='${prefix}/share/info' \
206 --mandir='${prefix}/share/man' \
207 --with-dbmliborder="${dbmliborder}" \
208 --with-libc="" \
209 --enable-loadable-sqlite-extensions \
210 --with-system-expat \
211 --with-system-ffi
212
213 if tc-is-cross-compiler; then
214 # Modify the Makefile.pre so we don't regen for the host/ one.
215 # We need to link the host python programs into $PWD and run
216 # them from here because the distutils sysconfig module will
217 # parse Makefile/etc... from argv[0], and we need it to pick
218 # up the target settings, not the host ones.
219 sed -i \
220 -e '1iHOSTPYTHONPATH = ./hostpythonpath:' \
221 -e '/^HOSTPYTHON/s:=.*:= ./hostpython:' \
222 -e '/^HOSTPGEN/s:=.*:= ./Parser/hostpgen:' \
223 Makefile{.pre,} || die "sed failed"
224 fi
225
226 multijob_finish
227 }
228
229 src_compile() {
230 if tc-is-cross-compiler; then
231 cd "${WORKDIR}"/${CBUILD}
232 # Disable as many modules as possible -- but we need a few to install.
233 PYTHON_DISABLE_MODULES=$(
234 sed -n "/Extension('/{s:^.*Extension('::;s:'.*::;p}" "${S}"/setup.py | \
235 egrep -v '(unicodedata|time|cStringIO|_struct|binascii)'
236 ) \
237 PTHON_DISABLE_SSL="1" \
238 SYSROOT= \
239 emake || die "cross-make failed"
240 # See comment in src_configure about these.
241 ln python ../${CHOST}/hostpython || die
242 ln Parser/pgen ../${CHOST}/Parser/hostpgen || die
243 ln -s ../${CBUILD}/build/lib.*/ ../${CHOST}/hostpythonpath || die
244 fi
245
246 cd "${WORKDIR}"/${CHOST}
247 default
248
249 # Work around bug 329499. See also bug 413751.
250 pax-mark m python
251 }
252
253 src_test() {
254 # Tests will not work when cross compiling.
255 if tc-is-cross-compiler; then
256 elog "Disabling tests due to crosscompiling."
257 return
258 fi
259
260 cd "${WORKDIR}"/${CHOST}
261
262 # Skip failing tests.
263 local skipped_tests="distutils gdb"
264
265 for test in ${skipped_tests}; do
266 mv "${S}"/Lib/test/test_${test}.py "${T}"
267 done
268
269 # Rerun failed tests in verbose mode (regrtest -w).
270 PYTHONDONTWRITEBYTECODE="" emake test EXTRATESTOPTS="-w" < /dev/tty
271 local result="$?"
272
273 for test in ${skipped_tests}; do
274 mv "${T}/test_${test}.py" "${S}"/Lib/test
275 done
276
277 elog "The following tests have been skipped:"
278 for test in ${skipped_tests}; do
279 elog "test_${test}.py"
280 done
281
282 elog "If you would like to run them, you may:"
283 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
284 elog "and run the tests separately."
285
286 if [[ "${result}" -ne 0 ]]; then
287 die "emake test failed"
288 fi
289 }
290
291 src_install() {
292 [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
293
294 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
295
296 cd "${WORKDIR}"/${CHOST}
297 emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
298
299 sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
300
301 # Backwards compat with Gentoo divergence.
302 dosym python${SLOT}-config /usr/bin/python-config-${SLOT} || die
303
304 # Fix collisions between different slots of Python.
305 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
306 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
307 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
308 rm -f "${ED}usr/bin/smtpd.py"
309
310 if use build; then
311 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
312 else
313 use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
314 use berkdb || rm -fr "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*}
315 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
316 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk}
317 fi
318
319 use threads || rm -fr "${libdir}/multiprocessing"
320 use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
321
322 dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
323
324 if use examples; then
325 insinto /usr/share/doc/${PF}/examples
326 doins -r "${S}"/Tools || die "doins failed"
327 fi
328 insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
329 local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
330 emake --no-print-directory -s -f - 2>/dev/null)
331 newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
332
333 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
334 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
335 sed \
336 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
337 -e "s:@PYDOC@:pydoc${SLOT}:" \
338 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
339
340 # for python-exec
341 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
342
343 # if not using a cross-compiler, use the fresh binary
344 if ! tc-is-cross-compiler; then
345 local PYTHON=./python \
346 LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
347 export LD_LIBRARY_PATH
348 fi
349
350 echo "EPYTHON='${EPYTHON}'" > epython.py
351 python_domodule epython.py
352 }
353
354 pkg_preinst() {
355 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
356 python_updater_warning="1"
357 fi
358 }
359
360 eselect_python_update() {
361 [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/"
362
363 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
364 eselect python update
365 fi
366
367 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
368 eselect python update --python${PV%%.*}
369 fi
370 }
371
372 pkg_postinst() {
373 eselect_python_update
374
375 if [[ "${python_updater_warning}" == "1" ]]; then
376 ewarn "You have just upgraded from an older version of Python."
377 ewarn "You should switch active version of Python ${PV%%.*} and run"
378 ewarn "'python-updater [options]' to rebuild Python modules."
379 fi
380 }
381
382 pkg_postrm() {
383 eselect_python_update
384 }

  ViewVC Help
Powered by ViewVC 1.1.20