diff -ur ../logilab-common.orig/logilab-common-0.58.0.ebuild ../logilab-common/logilab-common-0.58.0.ebuild --- ../logilab-common.orig/logilab-common-0.58.0.ebuild 2012-05-22 20:01:44.806643865 +0800 +++ ../logilab-common/logilab-common-0.58.0.ebuild 2012-05-22 20:13:46.504624345 +0800 @@ -14,20 +14,41 @@ LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" -IUSE="test" +IUSE="test doc" # dev-python/unittest2 is not required with Python >=3.2. RDEPEND="dev-python/setuptools dev-python/unittest2" + # Tests using dev-python/psycopg are skipped when dev-python/psycopg isn't installed. DEPEND="${RDEPEND} test? ( dev-python/egenix-mx-base !dev-python/psycopg[-mxdatetime] - )" + ) + doc? ( dev-python/epydoc )" PYTHON_MODNAME="logilab" +src_prepare() { + use doc && sed -e 's:(CURDIR):{S}/${P}:' -i doc/makefile || return +} + +src_compile() { + distutils_src_compile + + # Simplest way to make makefile point to the right place. + mklinks() { + # dosym it seems is restricted to src_install. + ln -s build-${PYTHON_ABI} build + emake -C doc epydoc + rm build + } + use doc && python_execute_function -f mklinks +} + +# Tests are devastated by use of abs paths. grep abspath yields dozens of entries in test files. +# Unusable. Need install for each desired ABI so they can import from installed instance to run tests src_test() { testing() { # Install temporarily. @@ -37,14 +58,17 @@ "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${tpath}" || die "Installation for tests failed with $(python_get_implementation) $(python_get_version)" # pytest uses tests placed relatively to the current directory. + # NOT ANY MORE pushd "${spath}" > /dev/null || return 1 if [[ "${PYTHON_ABI}" == 3.* ]]; then + pushd "${spath}" > /dev/null || return 1 # Support for Python 3 is experimental. Some tests are known to fail. PYTHONPATH="${spath}" "$(PYTHON)" "${tpath}${EPREFIX}/usr/bin/pytest" -v else - PYTHONPATH="${spath}" "$(PYTHON)" "${tpath}${EPREFIX}/usr/bin/pytest" -v || return 1 + #PYTHONPATH="build-${PYTHON_ABI}/lib/" "$(PYTHON)" build-"${PYTHON_ABI}/scripts-${PYTHON_ABI:0:3}"/pytest || return 1 + "${tpath}${EPREFIX}/usr/bin/pytest" -v || return 1 fi - popd > /dev/null || return 1 +# popd > /dev/null || return 1 } python_execute_function testing } @@ -60,4 +84,5 @@ rm -fr "${ED}$(python_get_sitedir)/${PN/-//}/test" } python_execute_function -q delete_tests + use doc && dohtml -r doc/apidoc/ }