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

Contents of /dev-lang/python/python-2.5.4-r4.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.34 - (show annotations) (download)
Mon Jul 30 18:09:26 2012 UTC (2 years, 4 months ago) by vapier
Branch: MAIN
Changes since 1.33: +4 -1 lines
Make sure $PKG_CONFIG is respected.

(Portage version: 2.2.0_alpha116/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-2.5.4-r4.ebuild,v 1.33 2012/05/03 02:41:39 jdhore Exp $
4
5 EAPI="1"
6
7 inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
8
9 MY_P="Python-${PV}"
10
11 PATCHSET_REVISION="3"
12
13 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
14 HOMEPAGE="http://www.python.org/"
15 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
16 mirror://gentoo/python-gentoo-patches-${PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
17
18 LICENSE="PSF-2.2"
19 SLOT="2.5"
20 PYTHON_ABI="${SLOT}"
21 KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
22 IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
23
24 # NOTE: dev-python/{elementtree,celementtree,pysqlite}
25 # do not conflict with the ones in python proper. - liquidx
26
27 RDEPEND=">=app-admin/eselect-python-20091230
28 >=sys-libs/zlib-1.1.3
29 virtual/libffi
30 virtual/libintl
31 !build? (
32 berkdb? ( || (
33 sys-libs/db:4.5
34 sys-libs/db:4.4
35 sys-libs/db:4.3
36 sys-libs/db:4.2
37 ) )
38 gdbm? ( sys-libs/gdbm )
39 ncurses? (
40 >=sys-libs/ncurses-5.2
41 readline? ( >=sys-libs/readline-4.1 )
42 )
43 sqlite? ( >=dev-db/sqlite-3 )
44 ssl? ( dev-libs/openssl )
45 tk? ( >=dev-lang/tk-8.0 )
46 xml? ( >=dev-libs/expat-2 )
47 )
48 doc? ( dev-python/python-docs:${SLOT} )"
49 DEPEND="${RDEPEND}
50 virtual/pkgconfig"
51 RDEPEND+=" !build? ( app-misc/mime-types )"
52 PDEPEND="app-admin/python-updater"
53
54 S="${WORKDIR}/${MY_P}"
55
56 pkg_setup() {
57 python_pkg_setup
58
59 if use berkdb; then
60 ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python. It has"
61 ewarn "been additionally removed in Python 3. You should use external, still maintained \"bsddb3\""
62 ewarn "module provided by dev-python/bsddb3 which supports both Python 2 and Python 3."
63 fi
64 }
65
66 src_unpack() {
67 unpack ${A}
68 cd "${S}"
69
70 # Ensure that internal copies of expat, libffi and zlib are not used.
71 rm -fr Modules/expat
72 rm -fr Modules/_ctypes/libffi*
73 rm -fr Modules/zlib
74
75 if tc-is-cross-compiler; then
76 epatch "${FILESDIR}/python-2.5-cross-printf.patch"
77 else
78 rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
79 fi
80
81 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
82
83 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
84 Lib/distutils/command/install.py \
85 Lib/distutils/sysconfig.py \
86 Lib/site.py \
87 Makefile.pre.in \
88 Modules/Setup.dist \
89 Modules/getpath.c \
90 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
91
92 # Fix os.utime() on hppa. utimes it not supported but unfortunately reported as working - gmsoft (22 May 04)
93 # PLEASE LEAVE THIS FIX FOR NEXT VERSIONS AS IT'S A CRITICAL FIX !!!
94 [[ "${ARCH}" == "hppa" ]] && sed -e "s/utimes //" -i "${S}/configure"
95
96 if ! use wininst; then
97 # Remove Microsoft Windows executables.
98 rm Lib/distutils/command/wininst-*.exe
99 fi
100
101 # Linux-3 compat. Bug #374579 (upstream issue12571)
102 cp -r "${S}/Lib/plat-linux2" "${S}/Lib/plat-linux3" || die
103
104 eautoreconf
105 }
106
107 src_configure() {
108 # Disable extraneous modules with extra dependencies.
109 if use build; then
110 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter pyexpat"
111 export PYTHON_DISABLE_SSL="1"
112 else
113 # dbm module can be linked against berkdb or gdbm.
114 # Defaults to gdbm when both are enabled, #204343.
115 local disable
116 use berkdb || use gdbm || disable+=" dbm"
117 use berkdb || disable+=" _bsddb"
118 use gdbm || disable+=" gdbm"
119 use ncurses || disable+=" _curses _curses_panel"
120 use readline || disable+=" readline"
121 use sqlite || disable+=" _sqlite3"
122 use ssl || export PYTHON_DISABLE_SSL="1"
123 use tk || disable+=" _tkinter"
124 use xml || disable+=" pyexpat"
125 export PYTHON_DISABLE_MODULES="${disable}"
126
127 if ! use xml; then
128 ewarn "You have configured Python without XML support."
129 ewarn "This is NOT a recommended configuration as you"
130 ewarn "may face problems parsing any XML documents."
131 fi
132 fi
133
134 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
135 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
136 fi
137
138 if [[ "$(gcc-major-version)" -ge 4 ]]; then
139 append-flags -fwrapv
140 fi
141
142 export OPT="${CFLAGS}"
143
144 filter-flags -malign-double
145
146 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
147
148 # https://bugs.gentoo.org/show_bug.cgi?id=50309
149 if is-flagq -O3; then
150 is-flagq -fstack-protector-all && replace-flags -O3 -O2
151 use hardened && replace-flags -O3 -O2
152 fi
153
154 if tc-is-cross-compiler; then
155 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
156 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
157 emake python Parser/pgen || die "cross-make failed"
158 mv python hostpython
159 mv Parser/pgen Parser/hostpgen
160 make distclean
161 sed -i \
162 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
163 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
164 Makefile.pre.in || die "sed failed"
165 fi
166
167 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
168 tc-export CXX
169 # The configure script fails to use pkg-config correctly.
170 # http://bugs.python.org/issue15506
171 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
172
173 # Set LDFLAGS so we link modules with -lpython2.5 correctly.
174 # Needed on FreeBSD unless Python 2.5 is already installed.
175 # Please query BSD team before removing this!
176 append-ldflags "-L."
177
178 econf \
179 --with-fpectl \
180 --enable-shared \
181 $(use_enable ipv6) \
182 $(use_with threads) \
183 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
184 --infodir='${prefix}/share/info' \
185 --mandir='${prefix}/share/man' \
186 --with-libc="" \
187 --with-system-ffi
188 }
189
190 src_compile() {
191 src_configure
192 emake || die "emake failed"
193 }
194
195 src_test() {
196 # Tests will not work when cross compiling.
197 if tc-is-cross-compiler; then
198 elog "Disabling tests due to crosscompiling."
199 return
200 fi
201
202 # Byte compiling should be enabled here.
203 # Otherwise test_import fails.
204 python_enable_pyc
205
206 # Skip failing tests.
207 local skip_tests="distutils global mimetools minidom mmap posix pyexpat sax strptime subprocess syntax tcl time urllib urllib2 xml_etree"
208
209 # test_ctypes fails with PAX kernel (bug #234498).
210 host-is-pax && skip_tests+=" ctypes"
211
212 for test in ${skip_tests}; do
213 mv "${S}/Lib/test/test_${test}.py" "${T}"
214 done
215
216 # Redirect stdin from /dev/tty as a workaround for bug #248081.
217 # Rerun failed tests in verbose mode (regrtest -w).
218 EXTRATESTOPTS="-w" emake test < /dev/tty
219 local result="$?"
220
221 for test in ${skip_tests}; do
222 mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py"
223 done
224
225 elog "The following tests have been skipped:"
226 for test in ${skip_tests}; do
227 elog "test_${test}.py"
228 done
229
230 elog "If you would like to run them, you may:"
231 elog "cd '${EPREFIX}$(python_get_libdir)/test'"
232 elog "and run the tests separately."
233
234 python_disable_pyc
235
236 if [[ "${result}" -ne 0 ]]; then
237 die "emake test failed"
238 fi
239 }
240
241 src_install() {
242 [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
243
244 emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
245 python_clean_installation_image -q
246
247 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
248
249 # Fix collisions between different slots of Python.
250 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
251 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
252 mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1"
253 rm -f "${ED}usr/bin/smtpd.py"
254
255 # Fix the OPT variable so that it doesn't have any flags listed in it.
256 # Prevents the problem with compiling things with conflicting flags later.
257 sed -e "s:^OPT=.*:OPT=\t\t-DNDEBUG:" -i "${ED}$(python_get_libdir)/config/Makefile"
258
259 if use build; then
260 rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,idlelib,lib-tk,sqlite3,test}
261 else
262 use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test}
263 use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,test/test_bsddb*}
264 use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
265 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk}
266 fi
267
268 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
269
270 if use examples; then
271 insinto /usr/share/doc/${PF}/examples
272 doins -r "${S}/Tools" || die "doins failed"
273 fi
274
275 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
276 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
277 sed \
278 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
279 -e "s:@PYDOC@:pydoc${SLOT}:" \
280 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
281 }
282
283 pkg_preinst() {
284 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.5" && ! has_version "${CATEGORY}/${PN}:2.6" && ! has_version "${CATEGORY}/${PN}:2.7"; then
285 python_updater_warning="1"
286 fi
287 }
288
289 eselect_python_update() {
290 local eselect_python_options
291 [[ "$(eselect python show)" == "python2."* ]] && eselect_python_options="--python2"
292
293 # Create python2 symlink.
294 eselect python update --python2 > /dev/null
295
296 eselect python update ${eselect_python_options}
297 }
298
299 pkg_postinst() {
300 eselect_python_update
301
302 python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
303
304 if [[ "${python_updater_warning}" == "1" ]]; then
305 ewarn
306 ewarn "\e[1;31m************************************************************************\e[0m"
307 ewarn
308 ewarn "You have just upgraded from an older version of Python."
309 ewarn "You should run 'python-updater \${options}' to rebuild Python modules."
310 ewarn
311 ewarn "\e[1;31m************************************************************************\e[0m"
312 ewarn
313 ebeep 12
314 fi
315 }
316
317 pkg_postrm() {
318 eselect_python_update
319
320 python_mod_cleanup $(python_get_libdir)
321 }

  ViewVC Help
Powered by ViewVC 1.1.20