Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 1 | # Copyright 1999-2012 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 3 | # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.3-r3.ebuild,v 1.5 2012/12/19 18:03:41 floppym Exp $ |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 4 | |
| 5 | EAPI="2" |
| 6 | WANT_AUTOMAKE="none" |
| 7 | WANT_LIBTOOL="none" |
| 8 | |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 9 | inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 10 | |
| 11 | MY_P="Python-${PV}" |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 12 | PATCHSET_REVISION="1" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 13 | |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 14 | DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 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" |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 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. |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 28 | |
| 29 | RDEPEND="app-arch/bzip2 |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 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 ) |
| 44 | ncurses? ( |
| 45 | >=sys-libs/ncurses-5.2 |
| 46 | readline? ( >=sys-libs/readline-4.1 ) |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 47 | ) |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 48 | sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] ) |
| 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" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 57 | DEPEND="${RDEPEND} |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 58 | virtual/pkgconfig |
| 59 | >=sys-devel/autoconf-2.65 |
| 60 | !sys-devel/gcc[libffi]" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 61 | RDEPEND+=" !build? ( app-misc/mime-types ) |
| 62 | doc? ( dev-python/python-docs:${SLOT} )" |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 63 | PDEPEND="app-admin/eselect-python |
| 64 | app-admin/python-updater" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 65 | |
| 66 | S="${WORKDIR}/${MY_P}" |
| 67 | |
| 68 | pkg_setup() { |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 69 | if use berkdb; then |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 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." |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 74 | else |
| 75 | if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 76 | ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]" |
| 77 | ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]." |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 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 | # |
| 98 | # START: ChromiumOS specific changes |
| 99 | # |
| 100 | if tc-is-cross-compiler ; then |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 101 | epatch "${FILESDIR}"/python-2.7.3-cross-setup-sysroot.patch |
| 102 | epatch "${FILESDIR}"/python-2.7.3-cross-h2py.patch |
| 103 | epatch "${FILESDIR}"/python-2.7.3-cross-install-compile.patch |
Han Shen | bbd204e | 2013-04-02 11:00:24 -0700 | [diff] [blame] | 104 | epatch "${FILESDIR}"/python-2.7.3-gcc-4_8.patch |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 105 | sed -i 's:^python$EXE:${HOSTPYTHON}:' Lib/*/regen || die |
| 106 | fi |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 107 | epatch "${FILESDIR}"/python-2.7.3-cross-distutils.patch |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 108 | |
| 109 | sed -i -e "s:sys.exec_prefix]:sys.exec_prefix, '/usr/local']:g" \ |
| 110 | Lib/site.py || die "sed failed to add /usr/local to prefixes" |
| 111 | # |
| 112 | # END: ChromiumOS specific changes |
| 113 | # |
| 114 | |
| 115 | sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
| 116 | Lib/distutils/command/install.py \ |
| 117 | Lib/distutils/sysconfig.py \ |
| 118 | Lib/site.py \ |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 119 | Lib/sysconfig.py \ |
| 120 | Lib/test/test_site.py \ |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 121 | Makefile.pre.in \ |
| 122 | Modules/Setup.dist \ |
| 123 | Modules/getpath.c \ |
| 124 | setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
| 125 | |
| 126 | eautoconf |
| 127 | eautoheader |
| 128 | } |
| 129 | |
| 130 | src_configure() { |
| 131 | if use build; then |
| 132 | # Disable extraneous modules with extra dependencies. |
| 133 | export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" |
| 134 | export PYTHON_DISABLE_SSL="1" |
| 135 | else |
| 136 | # dbm module can be linked against berkdb or gdbm. |
| 137 | # Defaults to gdbm when both are enabled, #204343. |
| 138 | local disable |
| 139 | use berkdb || use gdbm || disable+=" dbm" |
| 140 | use berkdb || disable+=" _bsddb" |
| 141 | use gdbm || disable+=" gdbm" |
| 142 | use ncurses || disable+=" _curses _curses_panel" |
| 143 | use readline || disable+=" readline" |
| 144 | use sqlite || disable+=" _sqlite3" |
| 145 | use ssl || export PYTHON_DISABLE_SSL="1" |
| 146 | use tk || disable+=" _tkinter" |
| 147 | use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
| 148 | export PYTHON_DISABLE_MODULES="${disable}" |
| 149 | |
| 150 | if ! use xml; then |
| 151 | ewarn "You have configured Python without XML support." |
| 152 | ewarn "This is NOT a recommended configuration as you" |
| 153 | ewarn "may face problems parsing any XML documents." |
| 154 | fi |
| 155 | fi |
| 156 | |
| 157 | if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
| 158 | einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
| 159 | fi |
| 160 | |
| 161 | if [[ "$(gcc-major-version)" -ge 4 ]]; then |
| 162 | append-flags -fwrapv |
| 163 | fi |
| 164 | |
| 165 | filter-flags -malign-double |
| 166 | |
| 167 | [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC |
| 168 | |
| 169 | # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
| 170 | if is-flagq -O3; then |
| 171 | is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
| 172 | use hardened && replace-flags -O3 -O2 |
| 173 | fi |
| 174 | |
| 175 | # Run the configure scripts in parallel. |
| 176 | multijob_init |
| 177 | |
| 178 | mkdir -p "${WORKDIR}"/{${CBUILD},${CHOST}} |
| 179 | |
| 180 | if tc-is-cross-compiler; then |
| 181 | ( |
| 182 | multijob_child_init |
| 183 | cd "${WORKDIR}"/${CBUILD} >/dev/null |
| 184 | OPT="-O1" CFLAGS="" CPPFLAGS="" LDFLAGS="" CC="" \ |
| 185 | "${S}"/configure \ |
| 186 | --{build,host}=${CBUILD} \ |
| 187 | || die "cross-configure failed" |
| 188 | ) & |
| 189 | multijob_post_fork |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 190 | |
| 191 | # The configure script assumes it's buggy when cross-compiling. |
| 192 | export ac_cv_buggy_getaddrinfo=no |
| 193 | export ac_cv_have_long_long_format=yes |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 194 | fi |
| 195 | |
| 196 | # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. |
| 197 | tc-export CXX |
| 198 | # The configure script fails to use pkg-config correctly. |
| 199 | # http://bugs.python.org/issue15506 |
| 200 | export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
| 201 | |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 202 | # Set LDFLAGS so we link modules with -lpython2.7 correctly. |
| 203 | # Needed on FreeBSD unless Python 2.7 is already installed. |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 204 | # Please query BSD team before removing this! |
| 205 | append-ldflags "-L." |
| 206 | |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 207 | local dbmliborder |
| 208 | if use gdbm; then |
| 209 | dbmliborder+="${dbmliborder:+:}gdbm" |
| 210 | fi |
| 211 | if use berkdb; then |
| 212 | dbmliborder+="${dbmliborder:+:}bdb" |
| 213 | fi |
| 214 | |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 215 | cd "${WORKDIR}"/${CHOST} |
| 216 | ECONF_SOURCE=${S} OPT="" \ |
| 217 | econf \ |
| 218 | --with-fpectl \ |
| 219 | --enable-shared \ |
| 220 | $(use_enable ipv6) \ |
| 221 | $(use_with threads) \ |
| 222 | $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \ |
| 223 | --infodir='${prefix}/share/info' \ |
| 224 | --mandir='${prefix}/share/man' \ |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 225 | --with-dbmliborder="${dbmliborder}" \ |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 226 | --with-libc="" \ |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 227 | --enable-loadable-sqlite-extensions \ |
| 228 | --with-system-expat \ |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 229 | --with-system-ffi |
| 230 | |
| 231 | if tc-is-cross-compiler; then |
| 232 | # Modify the Makefile.pre so we don't regen for the host/ one. |
| 233 | # We need to link the host python programs into $PWD and run |
| 234 | # them from here because the distutils sysconfig module will |
| 235 | # parse Makefile/etc... from argv[0], and we need it to pick |
| 236 | # up the target settings, not the host ones. |
| 237 | sed -i \ |
| 238 | -e '1iHOSTPYTHONPATH = ./hostpythonpath:' \ |
| 239 | -e '/^HOSTPYTHON/s:=.*:= ./hostpython:' \ |
| 240 | -e '/^HOSTPGEN/s:=.*:= ./Parser/hostpgen:' \ |
| 241 | Makefile{.pre,} || die "sed failed" |
| 242 | fi |
| 243 | |
| 244 | multijob_finish |
| 245 | } |
| 246 | |
| 247 | src_compile() { |
| 248 | if tc-is-cross-compiler; then |
| 249 | cd "${WORKDIR}"/${CBUILD} |
| 250 | # Disable as many modules as possible -- but we need a few to install. |
| 251 | PYTHON_DISABLE_MODULES=$( |
| 252 | sed -n "/Extension('/{s:^.*Extension('::;s:'.*::;p}" "${S}"/setup.py | \ |
| 253 | egrep -v '(unicodedata|time|cStringIO|_struct|binascii)' |
| 254 | ) \ |
| 255 | PTHON_DISABLE_SSL="1" \ |
| 256 | SYSROOT= \ |
| 257 | emake || die "cross-make failed" |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 258 | [[ -e build/lib.linux-x86_64-${SLOT}/unicodedata.so ]] || die |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 259 | # See comment in src_configure about these. |
| 260 | ln python ../${CHOST}/hostpython || die |
| 261 | ln Parser/pgen ../${CHOST}/Parser/hostpgen || die |
| 262 | ln -s ../${CBUILD}/build/lib.*/ ../${CHOST}/hostpythonpath || die |
| 263 | fi |
| 264 | |
| 265 | cd "${WORKDIR}"/${CHOST} |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 266 | default |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 267 | |
| 268 | # Work around bug 329499. See also bug 413751. |
| 269 | pax-mark m python |
| 270 | } |
| 271 | |
| 272 | src_test() { |
| 273 | # Tests will not work when cross compiling. |
| 274 | if tc-is-cross-compiler; then |
| 275 | elog "Disabling tests due to crosscompiling." |
| 276 | return |
| 277 | fi |
| 278 | |
| 279 | cd "${WORKDIR}"/${CHOST} |
| 280 | |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 281 | # Skip failing tests. |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 282 | local skipped_tests="distutils gdb" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 283 | |
| 284 | for test in ${skipped_tests}; do |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 285 | mv "${S}"/Lib/test/test_${test}.py "${T}" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 286 | done |
| 287 | |
| 288 | # Rerun failed tests in verbose mode (regrtest -w). |
| 289 | emake test EXTRATESTOPTS="-w" < /dev/tty |
| 290 | local result="$?" |
| 291 | |
| 292 | for test in ${skipped_tests}; do |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 293 | mv "${T}/test_${test}.py" "${S}"/Lib/test |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 294 | done |
| 295 | |
| 296 | elog "The following tests have been skipped:" |
| 297 | for test in ${skipped_tests}; do |
| 298 | elog "test_${test}.py" |
| 299 | done |
| 300 | |
| 301 | elog "If you would like to run them, you may:" |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 302 | elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 303 | elog "and run the tests separately." |
| 304 | |
| 305 | python_disable_pyc |
| 306 | |
| 307 | if [[ "${result}" -ne 0 ]]; then |
| 308 | die "emake test failed" |
| 309 | fi |
| 310 | } |
| 311 | |
| 312 | src_install() { |
| 313 | [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/" |
| 314 | |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 315 | local libdir=${ED}/usr/$(get_libdir)/python${SLOT} |
| 316 | |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 317 | cd "${WORKDIR}"/${CHOST} |
| 318 | emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 319 | |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 320 | sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed" |
| 321 | |
| 322 | # Backwards compat with Gentoo divergence. |
| 323 | dosym python${SLOT}-config /usr/bin/python-config-${SLOT} || die |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 324 | |
| 325 | # Fix collisions between different slots of Python. |
| 326 | mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" |
| 327 | mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" |
| 328 | mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 329 | rm -f "${ED}usr/bin/smtpd.py" |
| 330 | |
| 331 | if use build; then |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 332 | rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test} |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 333 | else |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 334 | use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test} |
| 335 | use berkdb || rm -fr "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} |
| 336 | use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} |
| 337 | use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 338 | fi |
| 339 | |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 340 | use threads || rm -fr "${libdir}/multiprocessing" |
| 341 | use wininst || rm -f "${libdir})/distutils/command/"wininst-*.exe |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 342 | |
| 343 | dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed" |
| 344 | |
| 345 | if use examples; then |
| 346 | insinto /usr/share/doc/${PF}/examples |
| 347 | doins -r "${S}"/Tools || die "doins failed" |
| 348 | fi |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 349 | insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
| 350 | local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
| 351 | emake --no-print-directory -s -f - 2>/dev/null) |
| 352 | newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 353 | |
| 354 | newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed" |
| 355 | newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed" |
| 356 | sed \ |
| 357 | -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ |
| 358 | -e "s:@PYDOC@:pydoc${SLOT}:" \ |
| 359 | -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 360 | |
| 361 | # for python-exec |
| 362 | python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR |
| 363 | |
| 364 | # if not using a cross-compiler, use the fresh binary |
| 365 | if ! tc-is-cross-compiler; then |
| 366 | local PYTHON=./python \ |
| 367 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}. |
| 368 | export LD_LIBRARY_PATH |
| 369 | fi |
| 370 | |
| 371 | echo "EPYTHON='${EPYTHON}'" > epython.py |
| 372 | python_domodule epython.py |
| 373 | |
| 374 | # The sysconfig module will actually read the pyconfig.h at runtime to see what kind |
| 375 | # of functionality is enabled in the build. Deploy it behind the back of portage as |
| 376 | # need be. |
Mike Frysinger | d7685db | 2013-04-06 02:03:53 -0400 | [diff] [blame] | 377 | ln "${ED}/usr/include/python${SLOT}/pyconfig.h" "${libdir}/pyconfig_h" || die |
| 378 | |
| 379 | # Workaround https://bugs.gentoo.org/380569 |
| 380 | keepdir /etc/env.d/python |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | pkg_preinst() { |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 384 | if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 385 | python_updater_warning="1" |
| 386 | fi |
| 387 | } |
| 388 | |
| 389 | eselect_python_update() { |
| 390 | [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/" |
| 391 | |
| 392 | if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
| 393 | eselect python update |
| 394 | fi |
| 395 | |
| 396 | if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
| 397 | eselect python update --python${PV%%.*} |
| 398 | fi |
| 399 | } |
| 400 | |
| 401 | pkg_postinst() { |
| 402 | eselect_python_update |
| 403 | |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 404 | if [[ "${python_updater_warning}" == "1" ]]; then |
| 405 | ewarn "You have just upgraded from an older version of Python." |
| 406 | ewarn "You should switch active version of Python ${PV%%.*} and run" |
| 407 | ewarn "'python-updater [options]' to rebuild Python modules." |
| 408 | fi |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 409 | |
Mike Frysinger | d7685db | 2013-04-06 02:03:53 -0400 | [diff] [blame] | 410 | local pyconfig="${EROOT}/usr/$(get_libdir)/python${SLOT}/pyconfig_h" |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 411 | if [[ ! -e ${EROOT}/usr/include/python${SLOT}/pyconfig.h ]] ; then |
| 412 | # See pkg_preinst above for details. |
Mike Frysinger | d7685db | 2013-04-06 02:03:53 -0400 | [diff] [blame] | 413 | install -D -m644 "${pyconfig}" "${EROOT}/usr/include/python${SLOT}/pyconfig.h" || die |
Mike Frysinger | 4cfb44a | 2013-03-18 22:37:33 -0400 | [diff] [blame] | 414 | fi |
Mike Frysinger | d7685db | 2013-04-06 02:03:53 -0400 | [diff] [blame] | 415 | rm "${pyconfig}" || die |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 416 | } |
| 417 | |
| 418 | pkg_postrm() { |
| 419 | eselect_python_update |
Mike Frysinger | 682d065 | 2012-07-30 11:38:25 -0400 | [diff] [blame] | 420 | } |