diff options
-rw-r--r-- | dev-python/numarray/ChangeLog | 7 | ||||
-rw-r--r-- | dev-python/numarray/files/numarray-1.5.2-python25.patch | 40 | ||||
-rw-r--r-- | dev-python/numarray/numarray-1.5.2-r1.ebuild | 85 |
3 files changed, 75 insertions, 57 deletions
diff --git a/dev-python/numarray/ChangeLog b/dev-python/numarray/ChangeLog index 273041542b41..b6eabc4798ef 100644 --- a/dev-python/numarray/ChangeLog +++ b/dev-python/numarray/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for dev-python/numarray # Copyright 2000-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/numarray/ChangeLog,v 1.27 2007/06/07 22:49:44 lavajoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/numarray/ChangeLog,v 1.28 2007/10/15 18:46:45 bicatali Exp $ + + 15 Oct 2007; Sébastien Fabbro <bicatali@gentoo.org> + +files/numarray-1.5.2-python25.patch, numarray-1.5.2-r1.ebuild: + use new virtual/cblas. added an (incomplete) patch for python-2.5. some + cleanup. 07 Jun 2007; Joe Peterson <lavajoe@gentoo.org> numarray-1.5.2-r1.ebuild: Add ~x86-fbsd keyword (bug #178368) diff --git a/dev-python/numarray/files/numarray-1.5.2-python25.patch b/dev-python/numarray/files/numarray-1.5.2-python25.patch new file mode 100644 index 000000000000..6d7621984a4a --- /dev/null +++ b/dev-python/numarray/files/numarray-1.5.2-python25.patch @@ -0,0 +1,40 @@ +--- Src/_ndarraymodule.c.orig 2007-09-05 09:54:58.759967037 +0100 ++++ Src/_ndarraymodule.c 2007-09-05 09:54:36.098675644 +0100 +@@ -596,12 +596,12 @@ + + /* Copied from Python-2.3.3 Objects/sliceobject.c */ + int +-_GetIndicesEx(PySliceObject *r, int length, +- int *start, int *stop, int *step, int *slicelength) ++_GetIndicesEx(PySliceObject *r, Py_ssize_t length, ++ Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength) + { + /* this is harder to get right than you might think */ + +- int defstart, defstop; ++ Py_ssize_t defstart, defstop; + + if (r->step == Py_None) { + *step = 1; +@@ -706,7 +706,7 @@ + self->nd = _snip( self->nd, self->dimensions, dim); + self->nstrides = _snip( self->nstrides, self->strides, dim); + } else if (PySlice_Check(slice)) { +- int start, stop, step, strided; ++ Py_ssize_t start, stop, step, strided; + if (_GetIndicesEx( (PySliceObject *) slice, + self->dimensions[dim], + &start, &stop, &step, &strided) < 0) +@@ -718,9 +718,9 @@ + Py_INCREF(Py_None); + return Py_None; + } +- self->byteoffset += self->strides[dim] * start; +- self->dimensions[dim] = strided; +- self->strides[dim] *= step; ++ self->byteoffset += (maybelong) (self->strides[dim] * start); ++ self->dimensions[dim] = (maybelong) strided; ++ self->strides[dim] *= (maybelong) step; + ++ dim; + } else { + Py_DECREF(rest); diff --git a/dev-python/numarray/numarray-1.5.2-r1.ebuild b/dev-python/numarray/numarray-1.5.2-r1.ebuild index fcf1dc335d3e..20df4ee5aee1 100644 --- a/dev-python/numarray/numarray-1.5.2-r1.ebuild +++ b/dev-python/numarray/numarray-1.5.2-r1.ebuild @@ -1,10 +1,10 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/numarray/numarray-1.5.2-r1.ebuild,v 1.7 2007/06/07 22:49:44 lavajoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/numarray/numarray-1.5.2-r1.ebuild,v 1.8 2007/10/15 18:46:45 bicatali Exp $ NEED_PYTHON=2.3 -inherit distutils fortran +inherit distutils DOC_PV=1.5 DESCRIPTION="Large array processing extension module for Python" @@ -12,13 +12,10 @@ SRC_URI="mirror://sourceforge/numpy/${P}.tar.gz doc? ( mirror://sourceforge/numpy/${PN}-${DOC_PV}.html.tar.gz )" HOMEPAGE="http://www.stsci.edu/resources/software_hardware/numarray" -# numarray does not work yet with other cblas implementations -# than cblas-reference or blas-atlas -RDEPEND="lapack? ( || ( >=sci-libs/blas-atlas-3.7.11-r1 - >=sci-libs/cblas-reference-20030223-r3 ) - virtual/lapack )" +RDEPEND="lapack? ( virtual/cblas virtual/lapack )" + DEPEND="${RDEPEND} - lapack? ( app-admin/eselect-cblas )" + lapack? ( dev-util/pkgconfig )" IUSE="doc lapack" SLOT="0" @@ -28,28 +25,21 @@ LICENSE="BSD" DOCS="LICENSE.txt Doc/*.txt Doc/release_notes/ANNOUNCE-${PV:0:3}" # test with lapack buggy on amd64 (at least) -RESTRICT="amd64? ( lapack? ( test ) )" +#RESTRICT="amd64? ( lapack? ( test ) )" -pkg_setup() { - if use lapack; then - FORTRAN="gfortran g77" - fortran_pkg_setup - for d in $(eselect cblas show); do mycblas=${d}; done - if [[ -z "${mycblas/reference/}" ]] && [[ -z "${mycblas/atlas/}" ]]; then - ewarn "You need to set cblas to atlas or reference. Do:" - ewarn " eselect cblas set <impl>" - ewarn "where <impl> is atlas, threaded-atlas or reference" - die "setup failed" - fi - fi +use lapack && unset LDFLAGS + +# ex usage: pkgconf_cfg --libs-only-l cblas: ['cblas','atlas'] +pkgconf_cfg() { + local cfg="[" + for i in $(pkg-config "$@"); do + cfg="${cfg}'${i:2}'" + done + echo "${cfg//\'\'/','}]" } src_unpack() { - if use lapack; then - fortran_src_unpack - else - unpack ${A} - fi + unpack ${A} cd "${S}" # include Python.h from header files using the PyObject_HEAD macro. @@ -62,51 +52,34 @@ src_unpack() { # (i.e. need to include "__FreeBSD__" in pre-processor conditionals) epatch "${FILESDIR}"/${P}-freebsd.patch - # fix array_protocol tests with numpy - #sed -i \ - # -e 's/True/ True/g' \ - # Lib/array_protocol.py || die "sed array_protocol failed" + # fix only for python-2.5 (fix still uncomplete, see bug #191240) + distutils_python_version + [[ "${PYVER}" == 2.5 ]] && epatch "${FILESDIR}"/${P}-python25.patch # array_protocol tests are buggy with various numeric/numpy versions sed -i \ -e '/array_protocol/d' \ Lib/testall.py || die "sed testall failed" - # fix hard-coded path in numinclude - sed -i \ - -e "s:/home/jmiller/work/debug/include/python2.5:/usr/include/python${PYVER}:" \ - Lib/numinclude.py || die "sed numinclude failed" - # configure cfg_packages.py for lapack if use lapack; then sed -i \ - -e '/^if USE_LAPACK:/iUSE_LAPACK=True' \ - -e 's:/usr/local/include/atlas:/usr/include/atlas:g' \ - -e "s:/usr/local/lib/atlas:/usr/$(get_libdir):g" \ - -e 's:f77blas:blas:g' \ + -e '/^if USE_LAPACK:/iUSE_LAPACK = True' \ + -e "s:\['/usr/local/lib/atlas'\]:$(pkgconf_cfg --libs-only-L cblas lapack):g" \ + -e "s:\[\"/usr/local/include/atlas\"\]:$(pkgconf_cfg --cflags-only-I cblas lapack):g" \ + -e "s:\['lapack', 'cblas', 'f77blas', 'atlas', 'g2c', 'm'\]:$(pkgconf_cfg --libs-only-l cblas lapack):g" \ cfg_packages.py || die "sed for lapack failed" - # fix gfortran for > gcc-4 - if [[ "${FORTRANC}" == gfortran ]]; then - sed -i \ - -e "s:g2c:gfortran:g" \ - cfg_packages.py || die "sed for gfortran failed" - fi - if [[ "${mycblas}" == reference ]]; then - sed -i \ - -e "s:'atlas',::g" \ - -e "s:include/atlas:include/cblas:g" \ - cfg_packages.py || die "sed for reference lapack failed" - fi fi - ${python} setup.py config --gencode || die "API code generation failed" + + "${python}" setup.py config --gencode || die "API code generation failed" } src_test() { cd build/lib* cp "${S}"/Lib/testdata.fits numarray PYTHONPATH=. "${python}" -c \ - "from numarray.testall import test;import sys;sys.exit(test())" \ - > test.log + "from numarray.testall import test;import sys;sys.exit(test())" 2>&1 \ + | tee test.log grep -q -i failed test.log && die "failed tests in ${PWD}/test.log" rm -f numarray/testdata.fits test*.* } @@ -115,7 +88,7 @@ src_install() { distutils_src_install if use doc; then insinto /usr/share/doc/${PF} - doins -r Examples - dohtml ${WORKDIR}/${PN}-${DOC_PV}/* || die "dohtml failed" + doins -r Examples || die "install examples failed" + dohtml "${WORKDIR}"/${PN}-${DOC_PV}/* || die "dohtml failed" fi } |