blob: c1b541ddd6d3887d4dd8b281abed5b96a559879b [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} )"
Daniel Kurtzd47b2922017-07-17 17:47:39 +080073PDEPEND="app-eselect/eselect-python
Mike Frysinger51f0d522015-11-21 00:11:17 +000074 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
Yunlian Jiang871d0072018-07-24 11:11:01 -0700122 epatch "${FILESDIR}"/2.7-disable-nis.patch
Mike Frysingereb047962014-04-06 10:08:56 -0400123 # Undo the @libdir@ change for portage's pym folder as it is always
124 # installed into /usr/lib/ and not the abi libdir.
125 sed -i \
126 -e '/portage.*pym/s:@@GENTOO_LIBDIR@@:lib:g' \
127 Lib/site.py || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400128
129 sed -i -e "s:sys.exec_prefix]:sys.exec_prefix, '/usr/local']:g" \
130 Lib/site.py || die "sed failed to add /usr/local to prefixes"
131 #
132 # END: ChromiumOS specific changes
133 #
134
Mike Frysinger51f0d522015-11-21 00:11:17 +0000135 # Fix for cross-compiling.
136 epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
137 epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
138
Mike Frysinger682d0652012-07-30 11:38:25 -0400139 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
140 Lib/distutils/command/install.py \
141 Lib/distutils/sysconfig.py \
142 Lib/site.py \
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400143 Lib/sysconfig.py \
144 Lib/test/test_site.py \
Mike Frysinger682d0652012-07-30 11:38:25 -0400145 Makefile.pre.in \
146 Modules/Setup.dist \
147 Modules/getpath.c \
148 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
149
Mike Frysinger51f0d522015-11-21 00:11:17 +0000150 epatch_user
151
152 eautoreconf
Mike Frysinger682d0652012-07-30 11:38:25 -0400153}
154
155src_configure() {
156 if use build; then
157 # Disable extraneous modules with extra dependencies.
158 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
159 export PYTHON_DISABLE_SSL="1"
160 else
161 # dbm module can be linked against berkdb or gdbm.
162 # Defaults to gdbm when both are enabled, #204343.
163 local disable
164 use berkdb || use gdbm || disable+=" dbm"
165 use berkdb || disable+=" _bsddb"
166 use gdbm || disable+=" gdbm"
167 use ncurses || disable+=" _curses _curses_panel"
168 use readline || disable+=" readline"
169 use sqlite || disable+=" _sqlite3"
170 use ssl || export PYTHON_DISABLE_SSL="1"
171 use tk || disable+=" _tkinter"
172 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
173 export PYTHON_DISABLE_MODULES="${disable}"
174
175 if ! use xml; then
176 ewarn "You have configured Python without XML support."
177 ewarn "This is NOT a recommended configuration as you"
178 ewarn "may face problems parsing any XML documents."
179 fi
180 fi
181
182 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
183 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
184 fi
185
186 if [[ "$(gcc-major-version)" -ge 4 ]]; then
187 append-flags -fwrapv
188 fi
189
190 filter-flags -malign-double
191
192 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
193
194 # https://bugs.gentoo.org/show_bug.cgi?id=50309
195 if is-flagq -O3; then
196 is-flagq -fstack-protector-all && replace-flags -O3 -O2
197 use hardened && replace-flags -O3 -O2
198 fi
199
Mike Frysinger682d0652012-07-30 11:38:25 -0400200 if tc-is-cross-compiler; then
Mike Frysinger51f0d522015-11-21 00:11:17 +0000201 # Force some tests that try to poke fs paths.
202 export ac_cv_file__dev_ptc=no
203 export ac_cv_file__dev_ptmx=yes
Mike Frysinger682d0652012-07-30 11:38:25 -0400204 fi
205
206 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
207 tc-export CXX
208 # The configure script fails to use pkg-config correctly.
209 # http://bugs.python.org/issue15506
210 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
211
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400212 # Set LDFLAGS so we link modules with -lpython2.7 correctly.
213 # Needed on FreeBSD unless Python 2.7 is already installed.
Mike Frysinger682d0652012-07-30 11:38:25 -0400214 # Please query BSD team before removing this!
215 append-ldflags "-L."
216
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400217 local dbmliborder
218 if use gdbm; then
219 dbmliborder+="${dbmliborder:+:}gdbm"
220 fi
221 if use berkdb; then
222 dbmliborder+="${dbmliborder:+:}bdb"
223 fi
224
Mike Frysinger51f0d522015-11-21 00:11:17 +0000225 BUILD_DIR="${WORKDIR}/${CHOST}"
226 mkdir -p "${BUILD_DIR}" || die
227 cd "${BUILD_DIR}" || die
228
229 ECONF_SOURCE="${S}" OPT="" \
Mike Frysinger682d0652012-07-30 11:38:25 -0400230 econf \
231 --with-fpectl \
232 --enable-shared \
233 $(use_enable ipv6) \
234 $(use_with threads) \
235 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
236 --infodir='${prefix}/share/info' \
237 --mandir='${prefix}/share/man' \
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400238 --with-dbmliborder="${dbmliborder}" \
Mike Frysinger682d0652012-07-30 11:38:25 -0400239 --with-libc="" \
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400240 --enable-loadable-sqlite-extensions \
241 --with-system-expat \
Mike Frysinger51f0d522015-11-21 00:11:17 +0000242 --with-system-ffi \
243 --without-ensurepip
Mike Frysinger682d0652012-07-30 11:38:25 -0400244
Mike Frysinger51f0d522015-11-21 00:11:17 +0000245 if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
246 eerror "configure has detected that the sem_open function is broken."
247 eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
248 die "Broken sem_open function (bug 496328)"
Mike Frysinger682d0652012-07-30 11:38:25 -0400249 fi
Mike Frysinger682d0652012-07-30 11:38:25 -0400250}
251
252src_compile() {
Mike Frysinger51f0d522015-11-21 00:11:17 +0000253 # Avoid invoking pgen for cross-compiles.
254 touch Include/graminit.h Python/graminit.c
255
256 cd "${BUILD_DIR}" || die
257 emake
258
259 # Work around bug 329499. See also bug 413751 and 457194.
260 if has_version dev-libs/libffi[pax_kernel]; then
261 pax-mark E python
262 else
263 pax-mark m python
Mike Frysinger682d0652012-07-30 11:38:25 -0400264 fi
Mike Frysinger682d0652012-07-30 11:38:25 -0400265}
266
267src_test() {
268 # Tests will not work when cross compiling.
269 if tc-is-cross-compiler; then
270 elog "Disabling tests due to crosscompiling."
271 return
272 fi
273
Mike Frysinger51f0d522015-11-21 00:11:17 +0000274 cd "${BUILD_DIR}" || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400275
Mike Frysinger682d0652012-07-30 11:38:25 -0400276 # Skip failing tests.
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400277 local skipped_tests="distutils gdb"
Mike Frysinger682d0652012-07-30 11:38:25 -0400278
279 for test in ${skipped_tests}; do
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400280 mv "${S}"/Lib/test/test_${test}.py "${T}"
Mike Frysinger682d0652012-07-30 11:38:25 -0400281 done
282
283 # Rerun failed tests in verbose mode (regrtest -w).
284 emake test EXTRATESTOPTS="-w" < /dev/tty
285 local result="$?"
286
287 for test in ${skipped_tests}; do
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400288 mv "${T}/test_${test}.py" "${S}"/Lib/test
Mike Frysinger682d0652012-07-30 11:38:25 -0400289 done
290
291 elog "The following tests have been skipped:"
292 for test in ${skipped_tests}; do
293 elog "test_${test}.py"
294 done
295
296 elog "If you would like to run them, you may:"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400297 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
Mike Frysinger682d0652012-07-30 11:38:25 -0400298 elog "and run the tests separately."
299
300 python_disable_pyc
301
302 if [[ "${result}" -ne 0 ]]; then
303 die "emake test failed"
304 fi
305}
306
307src_install() {
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400308 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
309
Mike Frysinger51f0d522015-11-21 00:11:17 +0000310 cd "${BUILD_DIR}" || die
311 emake DESTDIR="${D}" altinstall
Mike Frysinger682d0652012-07-30 11:38:25 -0400312
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400313 sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
314
315 # Backwards compat with Gentoo divergence.
Mike Frysinger51f0d522015-11-21 00:11:17 +0000316 dosym python${SLOT}-config /usr/bin/python-config-${SLOT}
Mike Frysinger682d0652012-07-30 11:38:25 -0400317
318 # Fix collisions between different slots of Python.
319 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
320 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
321 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
Mike Frysinger682d0652012-07-30 11:38:25 -0400322 rm -f "${ED}usr/bin/smtpd.py"
323
324 if use build; then
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400325 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
Mike Frysinger682d0652012-07-30 11:38:25 -0400326 else
Mike Frysinger51f0d522015-11-21 00:11:17 +0000327 use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
328 use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
329 use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400330 use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
Mike Frysinger682d0652012-07-30 11:38:25 -0400331 fi
332
Mike Frysinger51f0d522015-11-21 00:11:17 +0000333 use threads || rm -r "${libdir}/multiprocessing" || die
334 use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400335
Mike Frysinger51f0d522015-11-21 00:11:17 +0000336 dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
Mike Frysinger682d0652012-07-30 11:38:25 -0400337
338 if use examples; then
339 insinto /usr/share/doc/${PF}/examples
Mike Frysinger51f0d522015-11-21 00:11:17 +0000340 doins -r "${S}"/Tools
Mike Frysinger682d0652012-07-30 11:38:25 -0400341 fi
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400342 insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
343 local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
344 emake --no-print-directory -s -f - 2>/dev/null)
345 newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
Mike Frysinger682d0652012-07-30 11:38:25 -0400346
Mike Frysinger51f0d522015-11-21 00:11:17 +0000347 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
348 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
Mike Frysinger682d0652012-07-30 11:38:25 -0400349 sed \
350 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
351 -e "s:@PYDOC@:pydoc${SLOT}:" \
352 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400353
354 # for python-exec
355 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
356
357 # if not using a cross-compiler, use the fresh binary
358 if ! tc-is-cross-compiler; then
Mike Frysinger51f0d522015-11-21 00:11:17 +0000359 local PYTHON=./python
360 local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400361 fi
362
363 echo "EPYTHON='${EPYTHON}'" > epython.py
364 python_domodule epython.py
365
366 # The sysconfig module will actually read the pyconfig.h at runtime to see what kind
367 # of functionality is enabled in the build. Deploy it behind the back of portage as
368 # need be.
Mike Frysingerd7685db2013-04-06 02:03:53 -0400369 ln "${ED}/usr/include/python${SLOT}/pyconfig.h" "${libdir}/pyconfig_h" || die
370
371 # Workaround https://bugs.gentoo.org/380569
372 keepdir /etc/env.d/python
Mike Frysinger682d0652012-07-30 11:38:25 -0400373}
374
375pkg_preinst() {
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400376 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
Mike Frysinger682d0652012-07-30 11:38:25 -0400377 python_updater_warning="1"
378 fi
379}
380
381eselect_python_update() {
Mike Frysinger682d0652012-07-30 11:38:25 -0400382 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
383 eselect python update
384 fi
385
386 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
387 eselect python update --python${PV%%.*}
388 fi
389}
390
391pkg_postinst() {
392 eselect_python_update
393
Mike Frysinger682d0652012-07-30 11:38:25 -0400394 if [[ "${python_updater_warning}" == "1" ]]; then
395 ewarn "You have just upgraded from an older version of Python."
396 ewarn "You should switch active version of Python ${PV%%.*} and run"
397 ewarn "'python-updater [options]' to rebuild Python modules."
398 fi
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400399
Mike Frysingerd7685db2013-04-06 02:03:53 -0400400 local pyconfig="${EROOT}/usr/$(get_libdir)/python${SLOT}/pyconfig_h"
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400401 if [[ ! -e ${EROOT}/usr/include/python${SLOT}/pyconfig.h ]] ; then
402 # See pkg_preinst above for details.
Mike Frysingerd7685db2013-04-06 02:03:53 -0400403 install -D -m644 "${pyconfig}" "${EROOT}/usr/include/python${SLOT}/pyconfig.h" || die
Mike Frysinger4cfb44a2013-03-18 22:37:33 -0400404 fi
Mike Frysingerd7685db2013-04-06 02:03:53 -0400405 rm "${pyconfig}" || die
Mike Frysinger682d0652012-07-30 11:38:25 -0400406}
407
408pkg_postrm() {
409 eselect_python_update
Mike Frysinger682d0652012-07-30 11:38:25 -0400410}