/[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.22 - (show annotations) (download)
Thu Oct 10 08:06:30 2013 UTC (11 months, 1 week ago) by djc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.21: +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-3.2.3.ebuild,v 1.21 2013/08/28 15:59:25 floppym 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 hardened 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 )
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
148 # The configure script assumes it's buggy when cross-compiling.
149 export ac_cv_buggy_getaddrinfo=no
150 export ac_cv_have_long_long_format=yes
151 fi
152
153 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
154 tc-export CXX
155 # The configure script fails to use pkg-config correctly.
156 # http://bugs.python.org/issue15506
157 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
158
159 # Set LDFLAGS so we link modules with -lpython3.2 correctly.
160 # Needed on FreeBSD unless Python 3.2 is already installed.
161 # Please query BSD team before removing this!
162 append-ldflags "-L."
163
164 local dbmliborder
165 if use gdbm; then
166 dbmliborder+="${dbmliborder:+:}gdbm"
167 fi
168
169 OPT="" econf \
170 --with-fpectl \
171 --enable-shared \
172 $(use_enable ipv6) \
173 $(use_with threads) \
174 $(use_with wide-unicode) \
175 --infodir='${prefix}/share/info' \
176 --mandir='${prefix}/share/man' \
177 --with-computed-gotos \
178 --with-dbmliborder="${dbmliborder}" \
179 --with-libc="" \
180 --enable-loadable-sqlite-extensions \
181 --with-system-expat \
182 --with-system-ffi
183 }
184
185 src_compile() {
186 emake CPPFLAGS="" CFLAGS="" LDFLAGS="" || die "emake failed"
187
188 # Work around bug 329499. See also bug 413751.
189 pax-mark m python
190 }
191
192 src_test() {
193 # Tests will not work when cross compiling.
194 if tc-is-cross-compiler; then
195 elog "Disabling tests due to crosscompiling."
196 return
197 fi
198
199 # Byte compiling should be enabled here.
200 # Otherwise test_import fails.
201 python_enable_pyc
202
203 # Skip failing tests.
204 local skipped_tests="gdb"
205
206 for test in ${skipped_tests}; do
207 mv Lib/test/test_${test}.py "${T}"
208 done
209
210 # Rerun failed tests in verbose mode (regrtest -w).
211 emake test EXTRATESTOPTS="-w" CPPFLAGS="" CFLAGS="" LDFLAGS="" < /dev/tty
212 local result="$?"
213
214 for test in ${skipped_tests}; do
215 mv "${T}/test_${test}.py" Lib/test
216 done
217
218 elog "The following tests have been skipped:"
219 for test in ${skipped_tests}; do
220 elog "test_${test}.py"
221 done
222
223 elog "If you would like to run them, you may:"
224 elog "cd '${EPREFIX}$(python_get_libdir)/test'"
225 elog "and run the tests separately."
226
227 python_disable_pyc
228
229 if [[ "${result}" -ne 0 ]]; then
230 die "emake test failed"
231 fi
232 }
233
234 src_install() {
235 emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
236 python_clean_installation_image -q
237
238 sed \
239 -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
240 -e "s/\(PY_LDFLAGS=\).*/\1/" \
241 -i "${ED}$(python_get_libdir)/config-${SLOT}/Makefile" || die "sed failed"
242
243 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
244
245 # Fix collisions between different slots of Python.
246 rm -f "${ED}usr/$(get_libdir)/libpython3.so"
247
248 if use build; then
249 rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,sqlite3,test,tkinter}
250 else
251 use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/test"
252 use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
253 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,tkinter,test/test_tk*}
254 fi
255
256 use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
257 use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe
258
259 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
260
261 if use examples; then
262 insinto /usr/share/doc/${PF}/examples
263 find Tools -name __pycache__ -print0 | xargs -0 rm -fr
264 doins -r Tools || die "doins failed"
265 fi
266
267 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
268 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
269 sed \
270 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
271 -e "s:@PYDOC@:pydoc${SLOT}:" \
272 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
273 }
274
275 pkg_preinst() {
276 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
277 python_updater_warning="1"
278 fi
279 }
280
281 eselect_python_update() {
282 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
283 eselect python update
284 fi
285
286 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
287 eselect python update --python${PV%%.*}
288 fi
289 }
290
291 pkg_postinst() {
292 eselect_python_update
293
294 python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
295
296 if [[ "${python_updater_warning}" == "1" ]]; then
297 ewarn "You have just upgraded from an older version of Python."
298 ewarn "You should switch active version of Python ${PV%%.*} and run"
299 ewarn "'python-updater [options]' to rebuild Python modules."
300 fi
301 }
302
303 pkg_postrm() {
304 eselect_python_update
305
306 python_mod_cleanup $(python_get_libdir)
307 }

  ViewVC Help
Powered by ViewVC 1.1.20