blob: 5f690448311f8bffc7a302f8427613ebd7e46baa [file] [log] [blame]
Mike Frysinger51f0d522015-11-21 00:11:17 +00001# Copyright 1999-2015 Gentoo Foundation
Mike Frysinger682d0652012-07-30 11:38:25 -04002# Distributed under the terms of the GNU General Public License v2
Mike Frysinger51f0d522015-11-21 00:11:17 +00003# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.10.ebuild,v 1.2 2015/06/29 17:26:27 floppym Exp $
Mike Frysinger682d0652012-07-30 11:38:25 -04004
Cheng-Yi Chiangb88f6962015-08-06 13:49:23 +00005# ******************************* README ***************************************
6# WARNING! ANY CHANGE TO THIS FILE *MUST* BE ACCOMPANIED BY A CHANGE TO
7# chromeos-base/dev-install's ebuild, which depends on python indirectly.
8# Otherwise, incremental builds will break. See crbug.com/489895.
9# ******************************************************************************
10
Mike Frysinger51f0d522015-11-21 00:11:17 +000011EAPI="4"
Mike Frysinger682d0652012-07-30 11:38:25 -040012WANT_LIBTOOL="none"
13
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040014inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
Mike Frysinger682d0652012-07-30 11:38:25 -040015
16MY_P="Python-${PV}"
Mike Frysinger51f0d522015-11-21 00:11:17 +000017PATCHSET_VERSION="2.7.10-0"
Mike Frysinger682d0652012-07-30 11:38:25 -040018
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040019DESCRIPTION="An interpreted, interactive, object-oriented programming language"
Mike Frysinger682d0652012-07-30 11:38:25 -040020HOMEPAGE="http://www.python.org/"
Mike Frysinger51f0d522015-11-21 00:11:17 +000021SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
22 http://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
Mike Frysinger682d0652012-07-30 11:38:25 -040023
24LICENSE="PSF-2"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040025SLOT="2.7"
Mike Frysinger65332152014-02-14 13:55:27 -050026KEYWORDS="*"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040027IUSE="-berkdb build doc elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
28
29# Do not add a dependency on dev-lang/python to this ebuild.
30# If you need to apply a patch which requires python for bootstrapping, please
31# run the bootstrap code on your dev box and include the results in the
32# patchset. See bug 447752.
Mike Frysinger682d0652012-07-30 11:38:25 -040033
34RDEPEND="app-arch/bzip2
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040035 >=sys-libs/zlib-1.1.3
36 virtual/libffi
37 virtual/libintl
38 !build? (
39 berkdb? ( || (
Mike Frysinger51f0d522015-11-21 00:11:17 +000040 sys-libs/db:5.3
41 sys-libs/db:5.2
42 sys-libs/db:5.1
43 sys-libs/db:5.0
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040044 sys-libs/db:4.8
45 sys-libs/db:4.7
46 sys-libs/db:4.6
47 sys-libs/db:4.5
48 sys-libs/db:4.4
49 sys-libs/db:4.3
50 sys-libs/db:4.2
51 ) )
52 gdbm? ( sys-libs/gdbm )
53 ncurses? (
54 >=sys-libs/ncurses-5.2
55 readline? ( >=sys-libs/readline-4.1 )
Mike Frysinger682d0652012-07-30 11:38:25 -040056 )
Ryan Sleevi1a745162014-10-27 18:14:49 -070057 sqlite? ( >=dev-db/sqlite-3.3.8:3 )
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040058 ssl? ( dev-libs/openssl )
59 tk? (
60 >=dev-lang/tk-8.0
61 dev-tcltk/blt
Mike Frysinger51f0d522015-11-21 00:11:17 +000062 dev-tcltk/tix
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040063 )
64 xml? ( >=dev-libs/expat-2.1 )
65 )
66 !!<sys-apps/portage-2.1.9"
Mike Frysinger682d0652012-07-30 11:38:25 -040067DEPEND="${RDEPEND}
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040068 virtual/pkgconfig
69 >=sys-devel/autoconf-2.65
70 !sys-devel/gcc[libffi]"
Mike Frysinger682d0652012-07-30 11:38:25 -040071RDEPEND+=" !build? ( app-misc/mime-types )
72 doc? ( dev-python/python-docs:${SLOT} )"
Mike Frysinger51f0d522015-11-21 00:11:17 +000073PDEPEND="app-admin/eselect-python
74 app-admin/python-updater"
Mike Frysinger682d0652012-07-30 11:38:25 -040075
76S="${WORKDIR}/${MY_P}"
77
78pkg_setup() {
Mike Frysinger682d0652012-07-30 11:38:25 -040079 if use berkdb; then
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040080 ewarn "'bsddb' module is out-of-date and no longer maintained inside"
81 ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
82 ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
83 ewarn "is provided by dev-python/bsddb3."
Mike Frysinger682d0652012-07-30 11:38:25 -040084 else
85 if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
Mike Frysinger4cfb44a2013-03-18 22:37:33 -040086 ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
87 ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
Mike Frysinger682d0652012-07-30 11:38:25 -040088 ewarn "You might need to migrate your databases."
89 fi
90 fi
91}
92
93src_prepare() {
Tim Zwiebelab07eb22017-06-03 03:19:57 -070094 # According to the comments at the top of cgi.py, Linux vendors need to
95 # patch the shebang in cgi.py. We'll ignore the comment about not using
96 # "/usr/bin/env python" and use it anyway.
97 sed -i -e '1 s:^#!.*$:#! /usr/bin/env python:' Lib/cgi.py || die
98
Mike Frysinger682d0652012-07-30 11:38:25 -040099 # Ensure that internal copies of expat, libffi and zlib are not used.
Mike Frysinger51f0d522015-11-21 00:11:17 +0000100 rm -r Modules/expat || die
101 rm -r Modules/_ctypes/libffi* || die
102 rm -r Modules/zlib || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400103
Mike Frysinger51f0d522015-11-21 00:11:17 +0000104 if tc-is-cross-compiler; then
105 local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
Mike Frysinger682d0652012-07-30 11:38:25 -0400106 fi
107
Mike Frysinger51f0d522015-11-21 00:11:17 +0000108 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
Mike Frysinger682d0652012-07-30 11:38:25 -0400109
110 #
111 # START: ChromiumOS specific changes
112 #
113 if tc-is-cross-compiler ; then
Mike Frysinger51f0d522015-11-21 00:11:17 +0000114 epatch "${FILESDIR}"/python-2.7.10-cross-h2py.patch
115 epatch "${FILESDIR}"/python-2.7.10-cross-hack-compiler.patch
Mike Frysinger682d0652012-07-30 11:38:25 -0400116 sed -i 's:^python$EXE:${HOSTPYTHON}:' Lib/*/regen || die
117 fi
Mike Frysinger51f0d522015-11-21 00:11:17 +0000118 epatch "${FILESDIR}"/python-2.7.10-cross-setup-sysroot.patch
119 epatch "${FILESDIR}"/python-2.7.10-cross-distutils.patch
Paul Hobbs43d07e62015-05-14 16:43:16 -0700120 epatch "${FILESDIR}"/python-2.7.3-unique-semaphore-name.patch
Mike Frysinger51f0d522015-11-21 00:11:17 +0000121 epatch "${FILESDIR}"/python-2.7.10-ldshared.patch
Mike Frysingereb047962014-04-06 10:08:56 -0400122 # Undo the @libdir@ change for portage's pym folder as it is always
123 # installed into /usr/lib/ and not the abi libdir.
124 sed -i \
125 -e '/portage.*pym/s:@@GENTOO_LIBDIR@@:lib:g' \
126 Lib/site.py || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400127
128 sed -i -e "s:sys.exec_prefix]:sys.exec_prefix, '/usr/local']:g" \
129 Lib/site.py || die "sed failed to add /usr/local to prefixes"
130 #
131 # END: ChromiumOS specific changes
132 #
133
Mike Frysinger51f0d522015-11-21 00:11:17 +0000134 # Fix for cross-compiling.
135 epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
136 epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
137
Mike Frysinger682d0652012-07-30 11:38:25 -0400138 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
139 Lib/distutils/command/install.py \
140 Lib/distutils/sysconfig.py \
141 Lib/site.py \
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400142 Lib/sysconfig.py \
143 Lib/test/test_site.py \
Mike Frysinger682d0652012-07-30 11:38:25 -0400144 Makefile.pre.in \
145 Modules/Setup.dist \
146 Modules/getpath.c \
147 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
148
Mike Frysinger51f0d522015-11-21 00:11:17 +0000149 epatch_user
150
151 eautoreconf
Mike Frysinger682d0652012-07-30 11:38:25 -0400152}
153
154src_configure() {
155 if use build; then
156 # Disable extraneous modules with extra dependencies.
157 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
158 export PYTHON_DISABLE_SSL="1"
159 else
160 # dbm module can be linked against berkdb or gdbm.
161 # Defaults to gdbm when both are enabled, #204343.
162 local disable
163 use berkdb || use gdbm || disable+=" dbm"
164 use berkdb || disable+=" _bsddb"
165 use gdbm || disable+=" gdbm"
166 use ncurses || disable+=" _curses _curses_panel"
167 use readline || disable+=" readline"
168 use sqlite || disable+=" _sqlite3"
169 use ssl || export PYTHON_DISABLE_SSL="1"
170 use tk || disable+=" _tkinter"
171 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
172 export PYTHON_DISABLE_MODULES="${disable}"
173
174 if ! use xml; then
175 ewarn "You have configured Python without XML support."
176 ewarn "This is NOT a recommended configuration as you"
177 ewarn "may face problems parsing any XML documents."
178 fi
179 fi
180
181 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
182 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
183 fi
184
185 if [[ "$(gcc-major-version)" -ge 4 ]]; then
186 append-flags -fwrapv
187 fi
188
189 filter-flags -malign-double
190
191 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
192
193 # https://bugs.gentoo.org/show_bug.cgi?id=50309
194 if is-flagq -O3; then
195 is-flagq -fstack-protector-all && replace-flags -O3 -O2
196 use hardened && replace-flags -O3 -O2
197 fi
198
Mike Frysinger682d0652012-07-30 11:38:25 -0400199 if tc-is-cross-compiler; then
Mike Frysinger51f0d522015-11-21 00:11:17 +0000200 # Force some tests that try to poke fs paths.
201 export ac_cv_file__dev_ptc=no
202 export ac_cv_file__dev_ptmx=yes
Mike Frysinger682d0652012-07-30 11:38:25 -0400203 fi
204
205 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
206 tc-export CXX
207 # The configure script fails to use pkg-config correctly.
208 # http://bugs.python.org/issue15506
209 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
210
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400211 # Set LDFLAGS so we link modules with -lpython2.7 correctly.
212 # Needed on FreeBSD unless Python 2.7 is already installed.
Mike Frysinger682d0652012-07-30 11:38:25 -0400213 # Please query BSD team before removing this!
214 append-ldflags "-L."
215
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400216 local dbmliborder
217 if use gdbm; then
218 dbmliborder+="${dbmliborder:+:}gdbm"
219 fi
220 if use berkdb; then
221 dbmliborder+="${dbmliborder:+:}bdb"
222 fi
223
Mike Frysinger51f0d522015-11-21 00:11:17 +0000224 BUILD_DIR="${WORKDIR}/${CHOST}"
225 mkdir -p "${BUILD_DIR}" || die
226 cd "${BUILD_DIR}" || die
227
228 ECONF_SOURCE="${S}" OPT="" \
Mike Frysinger682d0652012-07-30 11:38:25 -0400229 econf \
230 --with-fpectl \
231 --enable-shared \
232 $(use_enable ipv6) \
233 $(use_with threads) \
234 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
235 --infodir='${prefix}/share/info' \
236 --mandir='${prefix}/share/man' \
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400237 --with-dbmliborder="${dbmliborder}" \
Mike Frysinger682d0652012-07-30 11:38:25 -0400238 --with-libc="" \
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400239 --enable-loadable-sqlite-extensions \
240 --with-system-expat \
Mike Frysinger51f0d522015-11-21 00:11:17 +0000241 --with-system-ffi \
242 --without-ensurepip
Mike Frysinger682d0652012-07-30 11:38:25 -0400243
Mike Frysinger51f0d522015-11-21 00:11:17 +0000244 if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
245 eerror "configure has detected that the sem_open function is broken."
246 eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
247 die "Broken sem_open function (bug 496328)"
Mike Frysinger682d0652012-07-30 11:38:25 -0400248 fi
Mike Frysinger682d0652012-07-30 11:38:25 -0400249}
250
251src_compile() {
Mike Frysinger51f0d522015-11-21 00:11:17 +0000252 # Avoid invoking pgen for cross-compiles.
253 touch Include/graminit.h Python/graminit.c
254
255 cd "${BUILD_DIR}" || die
256 emake
257
258 # Work around bug 329499. See also bug 413751 and 457194.
259 if has_version dev-libs/libffi[pax_kernel]; then
260 pax-mark E python
261 else
262 pax-mark m python
Mike Frysinger682d0652012-07-30 11:38:25 -0400263 fi
Mike Frysinger682d0652012-07-30 11:38:25 -0400264}
265
266src_test() {
267 # Tests will not work when cross compiling.
268 if tc-is-cross-compiler; then
269 elog "Disabling tests due to crosscompiling."
270 return
271 fi
272
Mike Frysinger51f0d522015-11-21 00:11:17 +0000273 cd "${BUILD_DIR}" || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400274
Mike Frysinger682d0652012-07-30 11:38:25 -0400275 # Skip failing tests.
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400276 local skipped_tests="distutils gdb"
Mike Frysinger682d0652012-07-30 11:38:25 -0400277
278 for test in ${skipped_tests}; do
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400279 mv "${S}"/Lib/test/test_${test}.py "${T}"
Mike Frysinger682d0652012-07-30 11:38:25 -0400280 done
281
282 # Rerun failed tests in verbose mode (regrtest -w).
283 emake test EXTRATESTOPTS="-w" < /dev/tty
284 local result="$?"
285
286 for test in ${skipped_tests}; do
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400287 mv "${T}/test_${test}.py" "${S}"/Lib/test
Mike Frysinger682d0652012-07-30 11:38:25 -0400288 done
289
290 elog "The following tests have been skipped:"
291 for test in ${skipped_tests}; do
292 elog "test_${test}.py"
293 done
294
295 elog "If you would like to run them, you may:"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400296 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
Mike Frysinger682d0652012-07-30 11:38:25 -0400297 elog "and run the tests separately."
298
299 python_disable_pyc
300
301 if [[ "${result}" -ne 0 ]]; then
302 die "emake test failed"
303 fi
304}
305
306src_install() {
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400307 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
308
Mike Frysinger51f0d522015-11-21 00:11:17 +0000309 cd "${BUILD_DIR}" || die
310 emake DESTDIR="${D}" altinstall
Mike Frysinger682d0652012-07-30 11:38:25 -0400311
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400312 sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
313
314 # Backwards compat with Gentoo divergence.
Mike Frysinger51f0d522015-11-21 00:11:17 +0000315 dosym python${SLOT}-config /usr/bin/python-config-${SLOT}
Mike Frysinger682d0652012-07-30 11:38:25 -0400316
317 # Fix collisions between different slots of Python.
318 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
319 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
320 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
Mike Frysinger682d0652012-07-30 11:38:25 -0400321 rm -f "${ED}usr/bin/smtpd.py"
322
323 if use build; then
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400324 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
Mike Frysinger682d0652012-07-30 11:38:25 -0400325 else
Mike Frysinger51f0d522015-11-21 00:11:17 +0000326 use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
327 use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
328 use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400329 use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
Mike Frysinger682d0652012-07-30 11:38:25 -0400330 fi
331
Mike Frysinger51f0d522015-11-21 00:11:17 +0000332 use threads || rm -r "${libdir}/multiprocessing" || die
333 use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400334
Mike Frysinger51f0d522015-11-21 00:11:17 +0000335 dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
Mike Frysinger682d0652012-07-30 11:38:25 -0400336
337 if use examples; then
338 insinto /usr/share/doc/${PF}/examples
Mike Frysinger51f0d522015-11-21 00:11:17 +0000339 doins -r "${S}"/Tools
Mike Frysinger682d0652012-07-30 11:38:25 -0400340 fi
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400341 insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
342 local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
343 emake --no-print-directory -s -f - 2>/dev/null)
344 newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
Mike Frysinger682d0652012-07-30 11:38:25 -0400345
Mike Frysinger51f0d522015-11-21 00:11:17 +0000346 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
347 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
Mike Frysinger682d0652012-07-30 11:38:25 -0400348 sed \
349 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
350 -e "s:@PYDOC@:pydoc${SLOT}:" \
351 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400352
353 # for python-exec
354 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
355
356 # if not using a cross-compiler, use the fresh binary
357 if ! tc-is-cross-compiler; then
Mike Frysinger51f0d522015-11-21 00:11:17 +0000358 local PYTHON=./python
359 local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400360 fi
361
362 echo "EPYTHON='${EPYTHON}'" > epython.py
363 python_domodule epython.py
364
365 # The sysconfig module will actually read the pyconfig.h at runtime to see what kind
366 # of functionality is enabled in the build. Deploy it behind the back of portage as
367 # need be.
Mike Frysingerd7685db2013-04-06 02:03:53 -0400368 ln "${ED}/usr/include/python${SLOT}/pyconfig.h" "${libdir}/pyconfig_h" || die
369
370 # Workaround https://bugs.gentoo.org/380569
371 keepdir /etc/env.d/python
Mike Frysinger682d0652012-07-30 11:38:25 -0400372}
373
374pkg_preinst() {
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400375 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
Mike Frysinger682d0652012-07-30 11:38:25 -0400376 python_updater_warning="1"
377 fi
378}
379
380eselect_python_update() {
Mike Frysinger682d0652012-07-30 11:38:25 -0400381 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
382 eselect python update
383 fi
384
385 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
386 eselect python update --python${PV%%.*}
387 fi
388}
389
390pkg_postinst() {
391 eselect_python_update
392
Mike Frysinger682d0652012-07-30 11:38:25 -0400393 if [[ "${python_updater_warning}" == "1" ]]; then
394 ewarn "You have just upgraded from an older version of Python."
395 ewarn "You should switch active version of Python ${PV%%.*} and run"
396 ewarn "'python-updater [options]' to rebuild Python modules."
397 fi
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400398
Mike Frysingerd7685db2013-04-06 02:03:53 -0400399 local pyconfig="${EROOT}/usr/$(get_libdir)/python${SLOT}/pyconfig_h"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400400 if [[ ! -e ${EROOT}/usr/include/python${SLOT}/pyconfig.h ]] ; then
401 # See pkg_preinst above for details.
Mike Frysingerd7685db2013-04-06 02:03:53 -0400402 install -D -m644 "${pyconfig}" "${EROOT}/usr/include/python${SLOT}/pyconfig.h" || die
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400403 fi
Mike Frysingerd7685db2013-04-06 02:03:53 -0400404 rm "${pyconfig}" || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400405}
406
407pkg_postrm() {
408 eselect_python_update
Mike Frysinger682d0652012-07-30 11:38:25 -0400409}