summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Lecher <jlec@gentoo.org>2014-11-14 20:34:11 +0000
committerJustin Lecher <jlec@gentoo.org>2014-11-14 20:34:11 +0000
commit2b47027e0ea1bbfce7fc5a963fa031b6f83856f0 (patch)
treebc9fca6cc822932083fdfa2c695a73758894e035 /sci-libs
parentFix building shared libary on Solaris (diff)
downloadhistorical-2b47027e0ea1bbfce7fc5a963fa031b6f83856f0.tar.gz
historical-2b47027e0ea1bbfce7fc5a963fa031b6f83856f0.tar.bz2
historical-2b47027e0ea1bbfce7fc5a963fa031b6f83856f0.zip
sci-libs/scipy: Backport fix for broken lsqr
Package-Manager: portage-2.2.14/cvs/Linux x86_64 Manifest-Sign-Key: 0xB9D4F231BD1558AB!
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/scipy/ChangeLog8
-rw-r--r--sci-libs/scipy/Manifest36
-rw-r--r--sci-libs/scipy/files/scipy-0.14.0-lsqr-backport.patch107
-rw-r--r--sci-libs/scipy/metadata.xml16
-rw-r--r--sci-libs/scipy/scipy-0.14.0-r1.ebuild143
5 files changed, 285 insertions, 25 deletions
diff --git a/sci-libs/scipy/ChangeLog b/sci-libs/scipy/ChangeLog
index 0471f440b21f..7d3030841f7a 100644
--- a/sci-libs/scipy/ChangeLog
+++ b/sci-libs/scipy/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sci-libs/scipy
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-libs/scipy/ChangeLog,v 1.117 2014/07/22 17:47:47 zerochaos Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/scipy/ChangeLog,v 1.118 2014/11/14 20:34:09 jlec Exp $
+
+*scipy-0.14.0-r1 (14 Nov 2014)
+
+ 14 Nov 2014; Justin Lecher <jlec@gentoo.org> +scipy-0.14.0-r1.ebuild,
+ +files/scipy-0.14.0-lsqr-backport.patch, metadata.xml:
+ Backport fix for broken lsqr
22 Jul 2014; Rick Farina <zerochaos@gentoo.org> scipy-0.12.1.ebuild,
scipy-0.13.2.ebuild, scipy-0.13.3.ebuild, scipy-0.14.0.ebuild:
diff --git a/sci-libs/scipy/Manifest b/sci-libs/scipy/Manifest
index f0d994626270..2482201b553f 100644
--- a/sci-libs/scipy/Manifest
+++ b/sci-libs/scipy/Manifest
@@ -5,6 +5,7 @@ AUX scipy-0.12.0-blitz.patch 731 SHA256 4f487a746aa62a39cdab9381dd4191cef0ccb912
AUX scipy-0.12.0-cephes-missing-include.patch 394 SHA256 0263ba4e9f13c7be0e7160ae73ce98ea37f698ea7e06c3fc090bc4ff7732bc66 SHA512 a4f9adf9b29743b6ca7f42de0695af23ddf7791330a4a58a2f47cd5599af1361aee3b141a016ea1a81a3bc5b8bfcaa3f0478370a09acd37bcd8e519765701510 WHIRLPOOL 59651015bf540ad2218dd65764d68fb5f2b907116245e3e83d14084579314af6c58c34be3f74300166c2450e00833fa4ae6d6de057392d3e947a979555add1bc
AUX scipy-0.12.0-gerqf.patch 731 SHA256 1f3c2723f1094cb6834349f26d40d060ed4e09c722eea876e160fc9ce2b3ced2 SHA512 007bf3d85364c824c03532a07c2678e48c90858d82fa7248cb5139a6f74b853bc4a27e6932638a14bb61e72abbbfd95265e10502c4fd2eb363758f3132722a10 WHIRLPOOL c2d7de949048dcc76e1bf72f2165226b7a741212ef0c6cfc3709ddd91f11fd274ecfcdf62dd47fb11d824d73b41c57d468414b3ef9e8169f7841688f67bcf6af
AUX scipy-0.12.0-restore-sys-argv.patch 483 SHA256 c00daf7d49c042972d2c59bf645c21f3bc437459a745da758e2548a973000170 SHA512 7c439aa7e1e0ccc7444c2c091ef03d3d39f2999a33ef487224c78e74cd3a1b84bd18a9e92d84ab2cd3fc7578644beb3b667fdaacb20a239600cb9b1765eeb7fc WHIRLPOOL f0d4a84e40ee26399b121f0d9159914d480789c83f749cf060bc65f63df315f27718359df7c13c64ae7a04eea00470ea109b110310abeba79944a90b97ebb102
+AUX scipy-0.14.0-lsqr-backport.patch 3764 SHA256 e5db9922b84a51452afebd22d6783eef982f3c7160dcf543388daef4bacfa7e2 SHA512 7fbf7c257c6f68045b14dd1dfc3518c47aaeff9c027441acec9399b3c02bd0c473512cbd9f5c1eed2ac54ed8c53d4416759ebd946516fa776324e5fa88d182cf WHIRLPOOL f2e57e4743ac3d0623057aed4ab225988613d95d09cf38a0db26ecc6e1cb3e7769006a45539d5e8fb1728b910766c0620b09973b609aef5967bf66bd9cff8d95
DIST scipy-0.12.1-html.zip 15578583 SHA256 07c773c6056e5fc0cb65d7048995d0ff056f48f1e482d610865361870ee07998 SHA512 71308ff306ee5556822a279e8dd21efd6c9174fbb5c100acf9e34308cf828789cd257aac5a447a6dbfa8b464447753ea49d6e5819555fbf8db73b3e51fddc2cb WHIRLPOOL 124b12ace1a297789b4f544a28539da964bc756aae72572b2926c9df81b2bd492fdcc4b39bb8b9d83305d21834c7e225a576225a8a94a316707c517583fa9dca
DIST scipy-0.12.1-ref.pdf 11193207 SHA256 4a8298fba9c6d62aeb392ee6588ac45cb266ed6cffb59573f6c19d7779bfc18b SHA512 cad60983c74a447a0e3ba898b81bdea3101dbad7603f1ca8030e3ff9f431eeb8c7b2dd207a45af616ef596e85c0c1846944057ecc11482fe9b389869ee49b137 WHIRLPOOL af600c6cb5c59306b2f5a84df421465a97cae9138f0cf024a0748c80bd516d8fe6a2db135fd56d66eab25f36c99acb3c0825d50b7d376e0ed3d9bd0c4c282943
DIST scipy-0.12.1.tar.gz 9012911 SHA256 15122afe6cb377b010982f9bc46cf41b12af703fd34088aa3971a80276b00e76 SHA512 13dba0b2ff9b69a109403110aaaca892362935262e3999992de96b081eae036fe5dbb3ca209d84ade948377c6ccb4137777c36f76121f8745855dc1d08b86e97 WHIRLPOOL 71467b86b992b14b4bc6c354ac4b4ec138951ab0d17b28c07ac605a81852f4f55bdfe35553ffdecd9611ef0daf2c35012424e28db9c9ff8e2cf6eb3fe0d2583a
@@ -16,23 +17,26 @@ DIST scipy-0.14.0.tar.gz 10212944 SHA256 4b41a3e6bf178df1c7f0ef3bfeabf1f56610329
EBUILD scipy-0.12.1.ebuild 3805 SHA256 5c4e8b9f496e9f96279b3ba8649c7f66d251e77c86017cf102247f6e2895d2d6 SHA512 972cad2341914448941c31fc616a2b1b64ff79ef3f8fd79d7385b52953c5a44c5b8a1ea319a97a07cbac550e2b5f50968bd80153e16cac0fe2d48142b74eed44 WHIRLPOOL 314685828ae74424acc7669523df53c2678381e7e578d65f628759f1e21aab2f5a62b6bd428592285e1fe041407603854f829d90d3e209a71d7573b11ec7a384
EBUILD scipy-0.13.2.ebuild 3827 SHA256 2345269991f640d9e859e591e5a5cb338f965b8f44d943f0a545a71324591597 SHA512 5519c7164ffc193d15754162f73fb14d17ec77be1b802e743bd3bd1773e6831285fa92f8918b29be0d9edca6f057264192fe287dc1f910723ffa3f7f21f21060 WHIRLPOOL 48fc7a3a54099816feca539b59cb6267ea59315cc369d6f581b926d34af868b87eeee06f2f783ea4d5d3914473af4d80227d00225f6fd424faffe67f48034483
EBUILD scipy-0.13.3.ebuild 3914 SHA256 de5293fe8fbbea55dc550af0671aaa93643ec1f051c687d6fdf6168ff06f7516 SHA512 862a5ecaaee18145166cff58bf3865deaabed865e52a6f89750fcfc36a975459ada1824ca6e41676a42b014855aaca5eb3c79a2a9f6d2572cc4f2650febc3ea5 WHIRLPOOL 668b1fb8f9567e5c08c6f6b6dec622876f8ea323f0380370e75c089b4bb462689cee26ff9c187112dbd41afd7f708f3593716858e4a686aed35483fe2b93feb6
+EBUILD scipy-0.14.0-r1.ebuild 3978 SHA256 d4114404359f466a000b0d8cee80ea8f94591dc5302cd81fd952da81c13b5335 SHA512 a61775e3885655be71a370d56c443947139b106af7a6bda3107983afab7161b0d87bccc5bfb75616ddc033c8f997101f0666bfc254ab1f3c425355475d97a425 WHIRLPOOL 7a74309dac105722a1a7123be5702455e1c2618e49735f11151761934918717422198fd457fdd15f3f51731c007e44ed60069d3c312cdacb7bd6af0ed94186c0
EBUILD scipy-0.14.0.ebuild 3927 SHA256 74f646d70b5be2f62d66637c29a7ec01352e1e9d97b0003c1b982a0ef5e7a14c SHA512 27ee56f813a0abdbe1ca0da8fedeb69622aa063aaaff8bbc383f86b312b294df7742df16a0c3fc0c08cbf84859f9232045e08585456ec5d5e43d0ccba8c2edd1 WHIRLPOOL acabd0ae31e1063fe3e2d80590218ce320d9ba3c96b603145702bcb563d373b721963610b09fbb9d0049c5ffa9cda76ab4302097d6a1b3de04503f28cfc3e5fe
-MISC ChangeLog 21231 SHA256 7150d6b0fc296d0e68e03095f6941a2e1059d184d568a9fe29d5c479613c54f6 SHA512 17bb0336456c290d5d2d87f87df971c006b21e7cc97f5496517d659ff1978d090d76c7b820574127c37e05612e6d7fed3169030443ac01ec7df451b1442b5b6c WHIRLPOOL b160f0d0bd62eccf03a5eb9e8d8e4875fe59bb95af24200c47aa275486901d803050b64f282c461868b0e5643eef5d2aa702951e52119dd974375972311adec0
-MISC metadata.xml 762 SHA256 b7a3a5110f5a2446485192ef06b28ce3d67c607b8badf892e764855f74677e59 SHA512 78f48ed6f5cb05e33c96f16ca583a4a6f80b1684e40e355e16ebc3457eaf03b79f7c4893792a0669168edb6e6de1a255e480266adc0e42c797ed5aec8b7c04dd WHIRLPOOL d9277e0e18ced1233e4d724799307eab3f02dfe7c14d80b375727e2dccd22b660b296653c90dadf671da72ff95c627c5ffc2baf5ba062542de44803c2a7c3ea7
+MISC ChangeLog 21419 SHA256 c4fa0c0d11cdd0abff5eaa7902a55a0d061a5689357e481543a9edfd182dad18 SHA512 7d562d4fbdc889a64318ebfdd444d3e4dc34758d2b13b9769b0ee729843a7cd3260ca2ca3b14538aa0d71d4546aa8be727bb41ed6e6713e782095e78888f3f6b WHIRLPOOL 0ed81bb7f186d54cde289e4adb8230c7aa9e08689d615f58a278c799ea37087bc3d5019880e6d8381532205ebbf6647af502963930f9f86d1b1a0a875e8a2c78
+MISC metadata.xml 778 SHA256 c585563656be41d539826dbd6ac5f633a0704b73a39b3603b50ce6092d767e73 SHA512 da239d303a88f7bc4356a27965aed91befd379ee142c529ab5177276eb86ac7976b527a2b1397584754f1cec1c6743c98b9af4a540e6cc503607ac3cf529de06 WHIRLPOOL e04375da88108229b3386ae79ba452705a4d4fcdbff9f38c491a4436846c9037d8c68bd8d5524d5435e351a557bd604211477a28da5661c9cce804fe27a34b2a
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2
+Version: GnuPG v2.0
-iQIcBAEBCgAGBQJTzqSgAAoJEKXdFCfdEflKAB8P/0AvcvCxDUAz0EeLPxnsDi6Q
-OPn84iLtw9CelSdhtJP3IG0I2sz5z+kLsrlfBx2/tp0FECsIK9zz0Jgx/krd2WUA
-VHVeJlTa2mkxB8DNEb7ULk8vOLg+/qw0EVIMZIeBs5audNopG7qHwwZ5C0SwHJii
-dU+BkqXb335ANa7RCY/V/XWsaiAbkNiviTQKibd2vQydsFxmGkzRH1BN/DdlGYHr
-0RqRhuULuApQikiM3EiH6D1VXnHtdSX1Xq6s7SE6g/UwGUyRd8Osi0oh6j/zHtwq
-oXYc3auuMOdjsSHBgtopT+NE3jxtY5p5casYPKZJBTw7Dyq10is5tdTfPQ2oyhVA
-ZuCtF0mqc1CnY11tC2+WN3WgDXy4oUBI5AcA2D36OpdL+yMLRVn0oQZJc4edhVzp
-xIesy/PjgQp9uriGE+xAOs/g0DE43pq+9Tbl/hG7fdwnmvlhTatnP5trIJGFnMT5
-FIF1EqDoUfXG4q2OAaQu3lrM1I8Nn88QAVNSbG5dtoWxZEsiZ+xzPB2lfO+JKQZX
-W9Phxoq9oPkZ3IS2jrhd7zstJQjxHFol+wqO+RXgN9IpStXQD9v3h5Z4lr2ShHWk
-jlFLTHTEGVU6St1mRrNL5+Y76CcsRUArLnRGHJ9lmB9qczzKXg1vDWJeJG7BVIuv
-RvJfQkpeCr/xqdoXamD2
-=Ja1e
+iQJ8BAEBCgBmBQJUZmdCXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
+ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyQ0JDQjFGMzBDQ0UxMjFGNENDNDgxMDdC
+OUQ0RjIzMUJEMTU1OEFCAAoJELnU8jG9FVirTncP/0c2T8rKBbD/rtOjwT4bxgEQ
+Ro0qpncvZ893dXsHlJX34NYm95rOHgM3o3Ao/DER7De/mKmhpVwUDPjczU60JL3c
+S6p4vUFa5Yvo3S+sb5cVei2WPW0AaRGw0NGILE+6qNuq+fXceQya8Y/7ddqgZr/5
+3I0Qa4UIyofxnxqtUQnIIIkV2gdDFx6wF6lQFZvNHlgmMXQgmSM5twoqn5RL4gB6
+/oySx+R0xM+pj4jL7f4NK42KP/4hp8BdAaH7S5O0OzmgjttODW20vMczwBuHhwrz
+a94Hj6IELw5XFqysEDbRG97B599iqE/f1iQwWaoqGicg4b5PJ1ruOMwldO2IH4A2
+/7t4UBI7tGXwgWtTLAh7AK+Uj2SRPx68kMf/M41Yg1GKxfNGWfMsD+s5b2RZZTwg
+8C6jK4TkDgmqBHYlPpu8ngT26g6rCU8HOAVXVjc3lCFC+7JtiXk0fRxSf3k3xjaL
+Dg3HGOvk2Bc4QhLVlDs94sDhfJ5MXSfWGAtsWyVPxuHoPfvVJn5CPAnyWvBSGPkf
+bl7B1yh9lxVJXgsug2sjs/JAbF6gMGMPueLNOok374iy6N3fJayQZRl7oOeN78vQ
+DcPKlYVO/Rc2jbSm1HvWtEntlYIUB2NnTaqLFeo+e+WU3U6iiwbHeHvZ0W2EMhyb
++XZVMvvh5s3jYI8EvSpB
+=P09P
-----END PGP SIGNATURE-----
diff --git a/sci-libs/scipy/files/scipy-0.14.0-lsqr-backport.patch b/sci-libs/scipy/files/scipy-0.14.0-lsqr-backport.patch
new file mode 100644
index 000000000000..a754e36ab2cf
--- /dev/null
+++ b/sci-libs/scipy/files/scipy-0.14.0-lsqr-backport.patch
@@ -0,0 +1,107 @@
+From 785e3961a685a351bd9d1e8eec0a62035cc4c6aa Mon Sep 17 00:00:00 2001
+From: Olivier Grisel <olivier.grisel@ensta.org>
+Date: Thu, 13 Nov 2014 13:39:35 +0100
+Subject: [PATCH] BUG: ZeroDivisionError in scipy.sparse.linalg.lsqr
+
+---
+ scipy/sparse/linalg/isolve/lsqr.py | 6 ++--
+ scipy/sparse/linalg/isolve/tests/test_lsqr.py | 51 +++++++++++++++++++++------
+ 2 files changed, 45 insertions(+), 12 deletions(-)
+
+diff --git a/scipy/sparse/linalg/isolve/lsqr.py b/scipy/sparse/linalg/isolve/lsqr.py
+index c4a6c02..de5a6b9 100644
+--- a/scipy/sparse/linalg/isolve/lsqr.py
++++ b/scipy/sparse/linalg/isolve/lsqr.py
+@@ -57,6 +57,8 @@
+ from math import sqrt
+ from scipy.sparse.linalg.interface import aslinearoperator
+
++eps = np.finfo(np.float64).eps
++
+
+ def _sym_ortho(a, b):
+ """
+@@ -432,8 +434,8 @@ def lsqr(A, b, damp=0.0, atol=1e-8, btol=1e-8, conlim=1e8,
+ # Now use these norms to estimate certain other quantities,
+ # some of which will be small near a solution.
+ test1 = rnorm / bnorm
+- test2 = arnorm / (anorm * rnorm)
+- test3 = 1 / acond
++ test2 = arnorm / (anorm * rnorm + eps)
++ test3 = 1 / (acond + eps)
+ t1 = test1 / (1 + anorm * xnorm / bnorm)
+ rtol = btol + atol * anorm * xnorm / bnorm
+
+diff --git a/scipy/sparse/linalg/isolve/tests/test_lsqr.py b/scipy/sparse/linalg/isolve/tests/test_lsqr.py
+index f378cca..626288b 100644
+--- a/scipy/sparse/linalg/isolve/tests/test_lsqr.py
++++ b/scipy/sparse/linalg/isolve/tests/test_lsqr.py
+@@ -1,7 +1,7 @@
+ from __future__ import division, print_function, absolute_import
+
+ import numpy as np
+-from numpy.testing import assert_
++from numpy.testing import assert_, assert_equal, assert_array_almost_equal
+ from scipy.lib.six import xrange
+
+ import scipy.sparse
+@@ -34,6 +34,46 @@ def test_basic():
+ xo = X[0]
+ assert_(norm(svx - xo) < 1e-5)
+
++
++def test_gh_2466():
++ row = np.array([0, 0])
++ col = np.array([0, 1])
++ val = np.array([1, -1])
++ A = scipy.sparse.coo_matrix((val, (row, col)), shape=(1, 2))
++ b = np.asarray([4])
++ lsqr(A, b)
++
++
++def test_well_conditioned_problems():
++ # Test that sparse the lsqr solver returns the right solution
++ # on various problems with different random seeds.
++ # This is a non-regression test for a potential ZeroDivisionError
++ # raised when computing the `test2` & `test3` convergence conditions.
++ n = 10
++ A_sparse = scipy.sparse.eye(n, n)
++ A_dense = A_sparse.toarray()
++
++ with np.errstate(invalid='raise'):
++ for seed in range(30):
++ rng = np.random.RandomState(seed + 10)
++ beta = rng.rand(n)
++ beta[beta == 0] = 0.00001 # ensure that all the betas are not null
++ b = A_sparse * beta[:, np.newaxis]
++ output = lsqr(A_sparse, b, show=show)
++
++ # Check that the termination condition corresponds to an approximate
++ # solution to Ax = b
++ assert_equal(output[1], 1)
++ solution = output[0]
++
++ # Check that we recover the ground truth solution
++ assert_array_almost_equal(solution, beta)
++
++ # Sanity check: compare to the dense array solver
++ reference_solution = np.linalg.solve(A_dense, b).ravel()
++ assert_array_almost_equal(solution, reference_solution)
++
++
+ if __name__ == "__main__":
+ svx = np.linalg.solve(G, b)
+
+@@ -64,12 +104,3 @@ def test_basic():
+ print("")
+ print(" || x_{direct} - x_{LSQR}|| %9.4e " % norm(svx-xo))
+ print("")
+-
+-
+-def test_gh_2466():
+- row = np.array([0, 0])
+- col = np.array([0, 1])
+- val = np.array([1, -1])
+- A = scipy.sparse.coo_matrix((val, (row, col)), shape=(1, 2))
+- b = np.asarray([4])
+- lsqr(A, b)
diff --git a/sci-libs/scipy/metadata.xml b/sci-libs/scipy/metadata.xml
index 4ee19593821e..350066e901ec 100644
--- a/sci-libs/scipy/metadata.xml
+++ b/sci-libs/scipy/metadata.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
-<herd>sci</herd>
-<longdescription lang="en">
+ <herd>sci</herd>
+ <longdescription lang="en">
SciPy is an open source library of scientific tools for Python. SciPy
supplements the popular numpy module, gathering a variety of high level
science and engineering modules together as a single package.
@@ -10,10 +10,10 @@
integration, special functions, signal and image processing, genetic
algorithms, ODE solvers, and others.
</longdescription>
-<use>
- <flag name="sparse">Adds support for sparse solving with <pkg>sci-libs/umfpack</pkg></flag>
-</use>
-<upstream>
- <remote-id type="pypi">scipy</remote-id>
-</upstream>
+ <use>
+ <flag name="sparse">Adds support for sparse solving with <pkg>sci-libs/umfpack</pkg></flag>
+ </use>
+ <upstream>
+ <remote-id type="pypi">scipy</remote-id>
+ </upstream>
</pkgmetadata>
diff --git a/sci-libs/scipy/scipy-0.14.0-r1.ebuild b/sci-libs/scipy/scipy-0.14.0-r1.ebuild
new file mode 100644
index 000000000000..7e11f66d4227
--- /dev/null
+++ b/sci-libs/scipy/scipy-0.14.0-r1.ebuild
@@ -0,0 +1,143 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/scipy/scipy-0.14.0-r1.ebuild,v 1.1 2014/11/14 20:34:09 jlec Exp $
+
+EAPI=5
+
+PYTHON_COMPAT=( python{2_7,3_2,3_3,3_4} )
+
+DOC_PV=0.13.0
+
+inherit eutils fortran-2 distutils-r1 flag-o-matic multilib toolchain-funcs
+
+DESCRIPTION="Scientific algorithms library for Python"
+HOMEPAGE="http://www.scipy.org/"
+SRC_URI="
+ mirror://sourceforge/${PN}/${P}.tar.gz
+ doc? (
+ http://docs.scipy.org/doc/${PN}-${DOC_PV}/${PN}-html.zip -> ${PN}-${DOC_PV}-html.zip
+ http://docs.scipy.org/doc/${PN}-${DOC_PV}/${PN}-ref.pdf -> ${PN}-${DOC_PV}-ref.pdf
+ )"
+
+LICENSE="BSD LGPL-2"
+SLOT="0"
+IUSE="doc sparse test"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
+
+CDEPEND="
+ dev-python/numpy[lapack,${PYTHON_USEDEP}]
+ sci-libs/arpack:0=
+ virtual/cblas
+ virtual/lapack
+ sparse? ( sci-libs/umfpack:0= )"
+DEPEND="${CDEPEND}
+ dev-lang/swig
+ >=dev-python/cython-0.19.1[${PYTHON_USEDEP}]
+ virtual/pkgconfig
+ doc? ( app-arch/unzip )
+ test? ( dev-python/nose[${PYTHON_USEDEP}] )
+ "
+
+RDEPEND="${CDEPEND}
+ virtual/python-imaging[${PYTHON_USEDEP}]"
+
+DOCS=( HACKING.rst.txt THANKS.txt )
+
+DISTUTILS_IN_SOURCE_BUILD=1
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ if use doc; then
+ unzip -qo "${DISTDIR}"/${PN}-${DOC_PV}-html.zip -d html || die
+ fi
+}
+
+pc_incdir() {
+ $(tc-getPKG_CONFIG) --cflags-only-I $@ | \
+ sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' -e 's|^:||'
+}
+
+pc_libdir() {
+ $(tc-getPKG_CONFIG) --libs-only-L $@ | \
+ sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -e 's/[ ]*$//' -e 's|^:||'
+}
+
+pc_libs() {
+ $(tc-getPKG_CONFIG) --libs-only-l $@ | \
+ sed -e 's/[ ]-l*\(pthread\|m\)\([ ]\|$\)//g' \
+ -e 's/^-l//' -e 's/[ ]*-l/,/g' -e 's/[ ]*$//' \
+ | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's|,$||'
+}
+
+python_prepare_all() {
+ # scipy automatically detects libraries by default
+ export {FFTW,FFTW3,UMFPACK}=None
+ use sparse && unset UMFPACK
+ # the missing symbols are in -lpythonX.Y, but since the version can
+ # differ, we just introduce the same scaryness as on Linux/ELF
+ [[ ${CHOST} == *-darwin* ]] \
+ && append-ldflags -bundle "-undefined dynamic_lookup" \
+ || append-ldflags -shared
+ [[ -z ${FC} ]] && export FC="$(tc-getFC)"
+ # hack to force F77 to be FC until bug #278772 is fixed
+ [[ -z ${F77} ]] && export F77="$(tc-getFC)"
+ export F90="${FC}"
+ export SCIPY_FCONFIG="config_fc --noopt --noarch"
+ append-fflags -fPIC
+
+ local libdir="${EPREFIX}"/usr/$(get_libdir)
+ cat >> site.cfg <<-EOF
+ [blas]
+ include_dirs = $(pc_incdir cblas)
+ library_dirs = $(pc_libdir cblas blas):${libdir}
+ blas_libs = $(pc_libs cblas blas)
+ [lapack]
+ library_dirs = $(pc_libdir lapack):${libdir}
+ lapack_libs = $(pc_libs lapack)
+ EOF
+
+ # Drop hashes to force rebuild of cython based .c code
+ rm cythonize.dat || die
+
+ local PATCHES=(
+ "${FILESDIR}"/${PN}-0.12.0-blitz.patch
+ "${FILESDIR}"/${PN}-0.12.0-restore-sys-argv.patch
+ "${FILESDIR}"/${PN}-0.12.0-cephes-missing-include.patch
+ "${FILESDIR}"/${P}-lsqr-backport.patch
+ )
+ distutils-r1_python_prepare_all
+}
+
+python_compile() {
+ ${EPYTHON} tools/cythonize.py || die
+ distutils-r1_python_compile ${SCIPY_FCONFIG}
+}
+
+python_test() {
+ # fails with bdist_egg. should it be fixed in distutils-r1 eclass?
+ distutils_install_for_testing ${SCIPY_FCONFIG}
+ cd "${TEST_DIR}" || die "no ${TEST_DIR} available"
+ "${EPYTHON}" -c "
+import scipy, sys
+r = scipy.test('fast',verbose=2)
+sys.exit(0 if r.wasSuccessful() else 1)" || die "Tests fail with ${EPYTHON}"
+}
+
+python_install_all() {
+ if use doc; then
+ dodoc "${DISTDIR}"/${PN}*pdf
+ docinto html
+ dodoc -r "${WORKDIR}"/html/.
+ fi
+ distutils-r1_python_install_all
+}
+
+python_install() {
+ distutils-r1_python_install ${SCIPY_FCONFIG}
+}
+
+pkg_postinst() {
+ elog "You might want to set the variable SCIPY_PIL_IMAGE_VIEWER"
+ elog "to your prefered image viewer. Example:"
+ elog "\t echo \"export SCIPY_PIL_IMAGE_VIEWER=display\" >> ~/.bashrc"
+}