--- python-2.6.5-r1.ebuild 2010-03-31 04:36:03.000000000 +0200 +++ python-2.6.5-r1.ebuild 2010-04-25 11:28:35.756029000 +0200 @@ -19,15 +19,15 @@ LICENSE="PSF-2.2" SLOT="2.6" PYTHON_ABI="${SLOT}" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" -IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" +KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" # NOTE: dev-python/{elementtree,celementtree,pysqlite,ctypes} # do not conflict with the ones in python proper. - liquidx RDEPEND=">=app-admin/eselect-python-20091230 >=sys-libs/zlib-1.1.3 - virtual/libffi + !m68k-mint? ( virtual/libffi ) virtual/libintl !build? ( berkdb? ( || ( @@ -74,8 +74,46 @@ rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch fi + # hardcoding GNU specifics breaks platforms not using GNU binutils + case $($(tc-getAS) --noexecstack -v 2>&1 /dev/null + rm -f python python-config python${SLOT}-config + # python${SLOT} was created above + for f in pythonw smtpd${SLOT}.py pydoc idle ; do + rm -f ${f} ${f}${SLOT} + done + # pythonw needs to remain in the framework (that's the whole + # reason we go through this framework hassle) + ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw2.6 || die + # copy the scripts to we can fix their shebangs + for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do + cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die + sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \ + ${f} || die + done + # "fix" to have below collision fix not to bail + mv pydoc${SLOT} pydoc || die + mv idle${SLOT} idle || die + popd > /dev/null + + # basically we don't like the framework stuff at all, so just move + # stuff around or add some symlinks to make our life easier + mkdir -p "${ED}"/usr + mv "${D}${fwdir}"/Versions/${SLOT}/share \ + "${ED}"/usr/ || die "can't move share" + # get includes just UNIX style + mkdir -p "${ED}"/usr/include + mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \ + "${ED}"/usr/include/ || die "can't move include" + pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null + ln -s ../../../../../include/python${SLOT} || die + popd > /dev/null + # remove now dead symlink + rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.a + + # same for libs + # NOTE: can't symlink the entire dir, because a real dir already exists + # on upgrade (site-packages), however since we h4x0rzed python to + # actually look into the UNIX-style dir, we just switch them around. + mkdir -p "${ED}"/usr/$(get_libdir) + mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} \ + "${ED}"/usr/lib/ || die "can't move python${SLOT}" + pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null + ln -s ../../../../python${SLOT} || die + popd > /dev/null + + # fix up Makefile + sed -i \ + -e '/^LINKFORSHARED=/s/_PyMac_Error.*$/PyMac_Error/' \ + -e '/^LDFLAGS=/s/=.*$/=/' \ + -e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \ + -e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \ + -e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \ + -e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \ + -e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \ + -e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \ + "${ED}"/usr/lib/python${SLOT}/config/Makefile || die + + # add missing version.plist file + mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources + cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF + + + + + BuildVersion + 1 + CFBundleShortVersionString + ${PV} + CFBundleVersion + ${PV} + ProjectName + Python + SourceVersion + ${PV} + + +EOF + else + emake DESTDIR="${D}" altinstall || die "emake altinstall failed" + emake DESTDIR="${D}" maninstall || die "emake maninstall failed" + fi - mv "${D}usr/bin/python${SLOT}-config" "${D}usr/bin/python-config-${SLOT}" + mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}" # Fix collisions between different slots of Python. - mv "${D}usr/bin/2to3" "${D}usr/bin/2to3-${SLOT}" - mv "${D}usr/bin/pydoc" "${D}usr/bin/pydoc${SLOT}" - mv "${D}usr/bin/idle" "${D}usr/bin/idle${SLOT}" - mv "${D}usr/share/man/man1/python.1" "${D}usr/share/man/man1/python${SLOT}.1" - rm -f "${D}usr/bin/smtpd.py" + mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" + mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" + mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" + mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1" + rm -f "${ED}usr/bin/smtpd.py" + + # http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec + # These #defines cause problems when building c99 compliant python modules + # http://bugs.python.org/issue1759169 + [[ ${CHOST} == *-solaris* ]] && dosed -e \ + 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \ + /usr/include/python${SLOT}/pyconfig.h if use build; then - rm -fr "${D}usr/bin/idle${SLOT}" "${D}$(python_get_libdir)/"{bsddb,idlelib,lib-tk,sqlite3,test} + rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,idlelib,lib-tk,sqlite3,test} else - use elibc_uclibc && rm -fr "${D}$(python_get_libdir)/"{bsddb/test,test} - use berkdb || rm -fr "${D}$(python_get_libdir)/"{bsddb,test/test_bsddb*} - use sqlite || rm -fr "${D}$(python_get_libdir)/"{sqlite3,test/test_sqlite*} - use tk || rm -fr "${D}usr/bin/idle${SLOT}" "${D}$(python_get_libdir)/"{idlelib,lib-tk} + use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test} + use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,test/test_bsddb*} + use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*} + use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk} fi - use threads || rm -fr "${D}$(python_get_libdir)/multiprocessing" + use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing" prep_ml_includes $(python_get_includedir) @@ -258,7 +484,11 @@ newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} # Don't install empty directory. - rmdir "${D}$(python_get_libdir)/lib-old" + rmdir "${ED}$(python_get_libdir)/lib-old" + + # fix invalid shebang /usr/local/bin/python + sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python' \ + "${ED}"/usr/$(get_libdir)/python${SLOT}/cgi.py } pkg_preinst() {