fix(dev-lang/python-oem): cleanups and fixes for OEM python

Remove all RDEPENDS, OEM packages are installed after prod images are
pruned of the previously installed package database.

Re-enable XML and ctypes support since the required libraries happen to
be bundled with Python.

Assorted other simplifications.
This commit is contained in:
Michael Marineau 2014-03-31 18:10:01 -07:00
parent 7f6d33c575
commit bc89c0fec5

View File

@ -20,26 +20,20 @@ SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
LICENSE="PSF-2" LICENSE="PSF-2"
SLOT="2.7" SLOT="2.7"
KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
IUSE="+build doc elibc_uclibc examples gdbm hardened ipv6" IUSE="hardened"
# Do not add a dependency on dev-lang/python to this ebuild. # Do not add a dependency on dev-lang/python to this ebuild.
# If you need to apply a patch which requires python for bootstrapping, please # If you need to apply a patch which requires python for bootstrapping, please
# run the bootstrap code on your dev box and include the results in the # run the bootstrap code on your dev box and include the results in the
# patchset. See bug 447752. # patchset. See bug 447752.
RDEPEND="app-arch/bzip2 RDEPEND=""
DEPEND="app-arch/bzip2
>=sys-libs/zlib-1.1.3 >=sys-libs/zlib-1.1.3
virtual/libffi
virtual/libintl virtual/libintl
!!<sys-apps/portage-2.1.9"
DEPEND="${RDEPEND}
virtual/pkgconfig virtual/pkgconfig
>=sys-devel/autoconf-2.65 >=sys-devel/autoconf-2.65
!sys-devel/gcc[libffi]" !sys-devel/gcc[libffi]"
RDEPEND+=" !build? ( app-misc/mime-types )
doc? ( dev-python/python-docs:${SLOT} )"
PDEPEND="app-admin/eselect-python
app-admin/python-updater"
S="${WORKDIR}/${MY_P}" S="${WORKDIR}/${MY_P}"
@ -72,7 +66,7 @@ src_prepare() {
src_configure() { src_configure() {
# Disable extraneous modules with extra dependencies. # Disable extraneous modules with extra dependencies.
export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter"
export PYTHON_DISABLE_SSL="1" export PYTHON_DISABLE_SSL="1"
if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
@ -99,22 +93,36 @@ src_configure() {
export ac_cv_file__dev_ptmx=yes export ac_cv_file__dev_ptmx=yes
fi fi
# Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
tc-export CXX
# The configure script fails to use pkg-config correctly.
# http://bugs.python.org/issue15506
export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
# Set LDFLAGS so we link modules with -lpython2.7 correctly.
# Needed on FreeBSD unless Python 2.7 is already installed.
# Please query BSD team before removing this!
append-ldflags "-L."
BUILD_DIR="${WORKDIR}/${CHOST}" BUILD_DIR="${WORKDIR}/${CHOST}"
mkdir -p "${BUILD_DIR}" || die mkdir -p "${BUILD_DIR}" || die
cd "${BUILD_DIR}" || die cd "${BUILD_DIR}" || die
ECONF_SOURCE="${S}" OPT="" \ ECONF_SOURCE="${S}" OPT="" \
econf \ econf \
--prefix=/usr/share/oem/python \
--with-fpectl \ --with-fpectl \
--enable-shared \ --disable-shared \
--enable-ipv6 \
--enable-threads \
--enable-unicode=ucs4 \ --enable-unicode=ucs4 \
$(use_enable ipv6) \ --includedir='/discard/include' \
--infodir='${prefix}/share/info' \ --infodir='/discard/info' \
--mandir='${prefix}/share/man' \ --mandir='/discard/man' \
--with-dbmliborder="" \
--with-libc="" \ --with-libc="" \
--enable-loadable-sqlite-extensions \ --without-system-expat \
--with-system-expat \ --without-system-ffi
--prefix=/usr/share/oem/python
} }
src_compile() { src_compile() {
@ -125,56 +133,23 @@ src_compile() {
emake emake
} }
src_test() {
# Tests will not work when cross compiling.
if tc-is-cross-compiler; then
elog "Disabling tests due to crosscompiling."
return
fi
cd "${BUILD_DIR}" || die
# Skip failing tests.
local skipped_tests="distutils gdb"
for test in ${skipped_tests}; do
mv "${S}"/Lib/test/test_${test}.py "${T}"
done
# Rerun failed tests in verbose mode (regrtest -w).
emake test EXTRATESTOPTS="-w" < /dev/tty
local result="$?"
for test in ${skipped_tests}; do
mv "${T}/test_${test}.py" "${S}"/Lib/test
done
elog "The following tests have been skipped:"
for test in ${skipped_tests}; do
elog "test_${test}.py"
done
elog "If you would like to run them, you may:"
elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
elog "and run the tests separately."
if [[ "${result}" -ne 0 ]]; then
die "emake test failed"
fi
}
src_install() { src_install() {
local bindir=/usr/share/oem/python/bin
local libdir=/usr/share/oem/python/$(get_libdir)/python${SLOT} local libdir=/usr/share/oem/python/$(get_libdir)/python${SLOT}
cd "${BUILD_DIR}" || die cd "${BUILD_DIR}" || die
emake DESTDIR="${D}" altinstall emake DESTDIR="${D}" altinstall
rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test} # create a simple versionless 'python' symlink
dosym "python${SLOT}" "${bindir}/python"
dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} # Throw away headers and man/info pages and extra modules
rm -r "${D}/discard" \
if use examples; then "${D}${bindir}/"{idle,smtpd.py} \
insinto /usr/share/doc/${PF}/examples "${D}${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} \
doins -r "${S}"/Tools "${D}${libdir}/"{idlelib,lib-tk} \
fi "${D}${libdir}/distutils/command/"wininst-*.exe \
"${D}${libdir}/test" \
"${D}${libdir}/sqlite3" \
|| die
} }