diff options
author | Justin Lecher <jlec@gentoo.org> | 2014-02-06 09:44:54 +0000 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2014-02-06 09:44:54 +0000 |
commit | 2771530118d00b0670cb6cda082b5592977cb359 (patch) | |
tree | 5f9b00978c6a249a14cfd89b8361d96466261914 /dev-python/numpy | |
parent | Version bump. Removed old versions (diff) | |
download | historical-2771530118d00b0670cb6cda082b5592977cb359.tar.gz historical-2771530118d00b0670cb6cda082b5592977cb359.tar.bz2 historical-2771530118d00b0670cb6cda082b5592977cb359.zip |
Backport fix for sec bug, #500484
Package-Manager: portage-2.2.8-r1/cvs/Linux x86_64
Manifest-Sign-Key: 0xB9D4F231BD1558AB!
Diffstat (limited to 'dev-python/numpy')
-rw-r--r-- | dev-python/numpy/ChangeLog | 8 | ||||
-rw-r--r-- | dev-python/numpy/Manifest | 32 | ||||
-rw-r--r-- | dev-python/numpy/files/numpy-1.8.0-f2py-insecure-temporary.patch | 214 | ||||
-rw-r--r-- | dev-python/numpy/numpy-1.8.0-r1.ebuild | 146 |
4 files changed, 384 insertions, 16 deletions
diff --git a/dev-python/numpy/ChangeLog b/dev-python/numpy/ChangeLog index 0c95e7109381..6aa898a11705 100644 --- a/dev-python/numpy/ChangeLog +++ b/dev-python/numpy/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-python/numpy # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/numpy/ChangeLog,v 1.218 2014/01/18 12:16:02 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/numpy/ChangeLog,v 1.219 2014/02/06 09:44:52 jlec Exp $ + +*numpy-1.8.0-r1 (06 Feb 2014) + + 06 Feb 2014; Justin Lecher <jlec@gentoo.org> + +files/numpy-1.8.0-f2py-insecure-temporary.patch, +numpy-1.8.0-r1.ebuild: + Backport fix for sec bug, #500484 18 Jan 2014; Mike Frysinger <vapier@gentoo.org> numpy-1.7.1.ebuild, numpy-1.8.0.ebuild: diff --git a/dev-python/numpy/Manifest b/dev-python/numpy/Manifest index 9319e5ce1932..137bee6e7289 100644 --- a/dev-python/numpy/Manifest +++ b/dev-python/numpy/Manifest @@ -1,11 +1,12 @@ -----BEGIN PGP SIGNED MESSAGE----- -Hash: SHA256 +Hash: SHA512 AUX numpy-1.6.1-atlas.patch 829 SHA256 5faada467f38931eb128144bdef72d19b227eb3583bcdc95b973bc2267e3705d SHA512 84e5a820fad9bb2c97c866891b7e4cd5d025c21b4ccff2703b57eabdf3597cb9162d528d13863e1f6fa6b1e50281b2066f12b975feb88cc905b6da6cc60adde5 WHIRLPOOL 1f14425a1dd6717611a77693a90a94e60bde5ecfe82e5d26c0c38aa33e0374b363c135e906ec51c382bf62761d95aa9293d0f98ccf04e07544ad184d39e9d965 AUX numpy-1.6.2-distutils.patch 20000 SHA256 779c0b03ee25b294f203729e954eed02022113ab18f4a1fbc20c36299dc5c1b8 SHA512 d47c2d4dab77c69fbad4b3a84df493e1e2a584b67d5832b3c11ca5d449935ca4ac5626d3616c8f612e74cb6503ddbf94a44fd1fda7b9aed5f20e8358aaa44c8a WHIRLPOOL bb876d24d56dd13409516e7de3dfce492fd4498ad186016be672b3ef613064c3c7f3fb8f62e0188277d2ea7191efb490e7482fd60413ce0f75df5052c8f8a828 AUX numpy-1.6.2-test-pareto.patch 1857 SHA256 6e5d42323fdd76ad8e4c7d9dfd313f27e5b301f9ec3a98810779f6e6524e9675 SHA512 342576c546839ed601d32542947b52684b208c89a9fa93176f7d2b1ca77bd7c1179ea2513f094a59a55d01d686cda2b9e2cc07ca386e4c4146fdcc6f980b7235 WHIRLPOOL fae26d2cea2d28b9a569fbf4195401b4b342e25468cf7e3d0750adb306a61d22ed88d1903f8f382740f2a7d76e5c277bb6fd9b622530fe16d14aba0266828583 AUX numpy-1.7.0-atlas.patch 845 SHA256 fe1097351178aab9fe7fbf4dde87a2e177c53989b6080bb5b2a9059fd596d83f SHA512 a9c4a8b9a11c58462cfc13beec8e5f4045a302c833e792cd42b35d5a0cfb497b594d3cfe8ea51108f447bcdc22308f74bd9dea108de1e6491e3adc761be7dd42 WHIRLPOOL b815cded5082740c8941a6c976345465e1815a926c2bfb8bdb940096f4e928a7065dbbcc3a9b195584dbca0612c725d6a4a6b260fabd50f8ad9af7c29cb9fdab AUX numpy-1.7.1-distutils-python33.patch 20008 SHA256 5a5f191321b794fea110610246ccbaf985c790e184ce6df6928af0686cc43acd SHA512 a97db2d74d8be34a84d7aafc992379ecfff1303f1b2ea21689a31183b8c433d02a8c86f4c529ada24451188c3dc6895f83cd06cc7a1ad59a732ec94878875a52 WHIRLPOOL efbdf5c8658cc6038ea8881e493c7653a71d185864a1103d20f157f853641f7a52a70bdec3932ed70ceb6d8fc568fe6c7273e03bba8213e262e9d0d7d83d9a10 +AUX numpy-1.8.0-f2py-insecure-temporary.patch 7243 SHA256 4215b023f3d03b506f9c757c532cf9a6188cb218b4f3c97aea83376f121d1ab0 SHA512 b3c70726f443c41520a77ae80f937d5e990754d9afcc1120e41841f70759c5c5352fe0a47adbada3ce84384a3b8fefdcab8a763c9082af38d7dd85b163679657 WHIRLPOOL 3d8be22202ff6fb7dc47229a2e13ba02b1e2df86bfdd7a3dee22592e20999284219c48881dde23829720cc0dd31a2c79a55faa5df3c3dc5aa552c163d4f64e3e AUX numpy-1.8.0-no-hardcode-blas.patch 1153 SHA256 ad79d788189db97178b73f019a47c502bb9297ae7a1b248da878f3f91ab8af3b SHA512 baa29a0c981ede608d890e776026961fb71156eb7804f702623bce775e3b6ce3bb28ced252d9c6fe991429b690b3eef8468d703f79247820527648d6484d23f3 WHIRLPOOL 38db4618b8fe505b711270b9050c56c1541c2fc3094b02ef6a45e776d56f54fd82b79ddc1b65721e0ac08949c6b9354da8c6ae0437b77e3b474ca941d44de9bb DIST numpy-1.6.0-html.zip 9242421 SHA256 555cfd5899ee54d129169fb70e418c2593d5377ea963d50c812f25bb182261e0 SHA512 b3a7df5b3bb4d307b9184ffa7a0f7a8d919a70f642d9be3d1b3d9c837516385423cc05ba114310e03e124fc80033216035ff389a7f56b74ac1a849c975dbdc8c WHIRLPOOL 6edeecf637e5ca23c906e51dd4933bb6ab4beb3014a9c2cc6d59459d76dd8bf617ea6e3c1d5d5a15af17022549812d358a37840b8d47841d14e156fb6b319600 DIST numpy-1.6.0-ref.pdf 6106335 SHA256 cbeea9b1395e0576bbd256c5de11886c63321d434785c6777df7bdd50109ba9f SHA512 ff00333beae3d886cf96cd72687f68dd0f226c88c390824c3f0cfc18a50ea6b8d6e12035eda76e10a97d58e7bc9b48b6dff7e0447b6045cc4e40fff3225721ec WHIRLPOOL 3ccb0373f0ef0f22a0a1ad967cecc1c7fd8e663d9c4437cfd31bf42a23d121619d89bcfcbb25091609cfdc20f13b551f6d904b1d13b4da6104dfca094734ca19 @@ -21,23 +22,24 @@ DIST numpy-user-1.7.0.pdf 404104 SHA256 0c8dc1d53cc057a66139039dbaaf65499687cf64 DIST numpy-user-1.8.0.pdf 408447 SHA256 a8c30360f9e46c63cfdf48fa594971d94d68ce59ece08c13d4acde8b14032cfe SHA512 10293dba45377c6f1024125a49810b01e388eb33a3e8ed75b8ec39c2b93e53878cbe62e6b7adbf1e957dc47ef253e20304afa7d86d798fb5198887cbe618131f WHIRLPOOL 70cc5a5e97a919bb027f92ac87127fb1bc08d06e2a131c4b413837e76d8feab9b65d7dc9e95b6e797d057efb6abf0d2b3e7562ee3cd140b1ff1418bad5475335 EBUILD numpy-1.6.2-r2.ebuild 4041 SHA256 a19790520f8f2e72424a19fcfb0eb6e6b92f824c65e5d0e0c4186c3623d4468c SHA512 63ebe9d2113905b9da0f567d29a607106ea34bd5bece980684be2cd4e7963af67c33d5e96be210fc5c2befbfcdc2e99358940e05b1c558ca068d6e5b41d5c2e9 WHIRLPOOL 188c736341018499da86161ac3f4dad5bd3387c385dd1fa5b27fd0b465f1ce8335079a305ce93932616bb41f1172721d9d97a7e2cab79cc2c7519cdec6774a7f EBUILD numpy-1.7.1.ebuild 4023 SHA256 d42c28ce42b8f2ff050154ff92e374a632e536bb6c45e668103351b48f360e44 SHA512 16ae348159b79049f5a5485c047ed3c442196406c9f7bdf57bf1e30e8bd87599c0606480520a8fad54ecf0233c09ae7a488b11d31113629db3182671bd56b35c WHIRLPOOL 12dcbc39670bd489107adc19aa054fb07e67b316ba3cac65308a89b15265e7343702f4b857c2a87c4d6765965d663afbdef86a2fe29a42907d610cad6532aee1 +EBUILD numpy-1.8.0-r1.ebuild 4012 SHA256 53fff2a316f73513284193ed85c271e8b6ccd6f4e22c3e848f3b0718bef22ace SHA512 dc2977b18c2876c607289279ed375526ca72da364771e06a09471384e5013696a11ac25f1f1311ebeef49235725882f0306191a5c43e83836c7a269d8886209c WHIRLPOOL f6448f6cb1a9c0e348e75f0da3769210444bf150b03f50f7c4022f90a91174479ce460ce02fd767a608da07c100771850f8b6335dc72d7ae2eb6ba0412dbf11b EBUILD numpy-1.8.0.ebuild 3961 SHA256 cae3cfcd25b225bc7599edbb67e284630bbb22adfeef88be18fcd11b249d5474 SHA512 4aa9976d94d424c0ff9c97fd993a6d72ee91de109e8c2854ffb813fe53a177508be0b7ce80ed740f00506f043dd5029755d671400230da292afbd7a01f5375d0 WHIRLPOOL 5c461337ab3fb15c6e292f7a7f57e30adb6426727d83549e7b41629fbbde57cccb69d12e9c771fe3c81079e9c3f265a348c58a77d30e7f858dc10aad30c5c44c -MISC ChangeLog 30412 SHA256 85e87259fc346b3fd9091acfc5bdad419949e30551b6adbc03298aacf5792915 SHA512 fcab054314250c8d048d04eb7aa00c92c1877d1b4bb724d474600758a4aae6aaa08a62df8aadf9b8b223a79bb0ebee7aad2b55abbe3e8547e882660fbe259413 WHIRLPOOL 3604429e1f752cfeaf23b6f7170c858499c2d2297cc4624c34307286ac72f29fb1618ecf5fde0c11c1ea18eb2643e57c678d84899742ff6671e26957c4b72498 +MISC ChangeLog 30601 SHA256 3d4b3d95fd498ff5828c59cc6dfcd3c532888d93b11b0abf6c70bf575672b391 SHA512 b5fa8e539b208f1d0276793cbef75f1eb44af74291390f1373664dc9e72481be3a27b9bade2ece706820ac5d6b56ad0be913a81518f974f67121025f5ba14cf5 WHIRLPOOL aecd24e4f4eaed22ab47d78426757579e30f4d734d7a3c5406c16f570ceda2c5dfee934cc1930cd9850995c4eea349f58041d31da3c85db67521c0dbe7f8fdb4 MISC metadata.xml 678 SHA256 184af17845835a595a8b2ee396a6f55baa7234a7b91ebddcf957a5d69c0b01d0 SHA512 6dbcd40d6722b481caf27183618012f3df43fd6fc22f8ddd6f1a3e9e42bc1240f56573616ef32fe8c3ea52addc42172940b3d7c5fa0938b854baeb96daa53d88 WHIRLPOOL e9b5f50c2b2d34745b255d05f65c6762c34fe34a2f097633621479ce909a1e120322cbcd0ded383fae6511240a14a7e9db4f47592715e2919d1c4d615f9bd24d -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) -iQIcBAEBCAAGBQJS2nCEAAoJEPGu1DbS6WIAh6EQAIx/bEbUZZupq6r0uDE8tAKa -zPwMddXxvHY7ETcjVF/7IlB45gX9dOaXy+54TCTqhuk63uw2BNOryYGKeh7oFgYu -tWFS8+kAJkvz7bL2MR3WzOgZ9H+HT4WSA83sFI2FkrtwBeRLbgfLYC8+QbhL+ZM6 -UW0gIvMF6J5mJZ4xrO5DrIuxZnXO1BQTOOAAihXZ96qp8QJfupjaGiFiK/CU0Boc -3Ll9oslylApZ/6dnpTWabUdJ53W+Svv7AOb+BbhRJQ4LMFJEBkdmer5LEnyspxcp -igGDik5Kf4RyNIwLBQbCOsm7rWtHIUEji6IgCH4qytLNZzaAGrbBEV3qfR+Mtjsr -XRV7qJu5kSSCQXkyLBN8xppNctHLxPsxnWOzaWpRWvQ0WwVm8JdKOqCCOZvC4KFZ -FGTkgzF3JwbUchakimydPibBgjAN+XcjyIjIxFe33zYSdz/QMnjKixmzX/eKw6Ds -gMaiwIdOxOCWKF3fuC2ghNfe3ciGqU5sre71l3Y3K0fMkRFyxg0QCGlTQIc6jR8Z -zDZyaegZvGolUFIUxws59u9auJhi4RRpR4hHrY89heUnYUGwB/txtqsq5cr1COWm -qbThXra8dieXBvruBXuSjOK8sKPgnUMubM4M8w2d3j0tX952DcgB/07lOF6CpS2v -gxOj3ee7KqS/ySd2PtIB -=w6m0 +iQIcBAEBCgAGBQJS81mWAAoJELnU8jG9FVirMY8P/0w8gPSEepy2P6nmwcWHzrfd +6ATrkd2fzoxyDhIOz8LTwNdUwChBItP5Ig1IizXn6IN9Sf+SvLc9EleckX/ticQh +KZ7VsE7E9zYODNhLJES0y/W+LiWhSAA6VktiS/MqYlDfe3bDakWVjizsLnP+7oCT +UBSgRsVSJAgZMAT1z6VoYNXTy0bZbHQBMxxUy4dt3XnYsH3lddciErWrjCkWwZ8n +8l6ba/iOe5/joK97gnsuE30/S2h6xfirzuCzMQil5KxMQzYtkz1lgNVTBasKY/YB +krRPxUgujf5G0sF9sSiA7Q3H7uK+iE7VTnFK0AbVC3NEARCQ/FfY69fSYIj1vsLg +v4sdaRE8wX48YcEOqHBWc6OV3OqrnPzE+DqgynbR/n1r6YcrVqGO/0prXrTtuqCj +03dHjjikNhj05TWsgDUTqoGW8Tv9nlapLFK8+N1wRLgNss+H4YIpbmJdNOM4kVXC ++Dx+ZO/fdppWT32/py0vcH94m6Bzki0jXSbuNmIS4H52MJrOzZj48LKfaWY5560M +sOrBQRFAn+ztOoABL882Sw3sq1FS9AHSaJq3p80vvlsO6DY0qBbqU1JCoCLH5tbS +OrYiMXHQYlX56o0uWpCMD/0gtWrhGMkoBVFw3vjH2mde9M1vqLGJRVnVGN+ta7rF +Zz4fNUfLhdFpdnjpirCk +=2uZt -----END PGP SIGNATURE----- diff --git a/dev-python/numpy/files/numpy-1.8.0-f2py-insecure-temporary.patch b/dev-python/numpy/files/numpy-1.8.0-f2py-insecure-temporary.patch new file mode 100644 index 000000000000..0d34924b3f9e --- /dev/null +++ b/dev-python/numpy/files/numpy-1.8.0-f2py-insecure-temporary.patch @@ -0,0 +1,214 @@ + numpy/core/tests/test_memmap.py | 34 ++++++++++++++++------------------ + numpy/core/tests/test_multiarray.py | 9 +++------ + numpy/f2py/__init__.py | 22 +++++++++++----------- + numpy/f2py/f2py2e.py | 4 ++-- + numpy/lib/tests/test_io.py | 24 ++++++++++++++++-------- + 5 files changed, 48 insertions(+), 45 deletions(-) + +diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py +index 6de6319..10e7a08 100644 +--- a/numpy/core/tests/test_memmap.py ++++ b/numpy/core/tests/test_memmap.py +@@ -1,7 +1,7 @@ + from __future__ import division, absolute_import, print_function + + import sys +-from tempfile import NamedTemporaryFile, TemporaryFile, mktemp ++from tempfile import NamedTemporaryFile, TemporaryFile + import os + + from numpy import memmap +@@ -33,12 +33,11 @@ class TestMemmap(TestCase): + assert_array_equal(self.data, newfp) + + def test_open_with_filename(self): +- tmpname = mktemp('', 'mmap') +- fp = memmap(tmpname, dtype=self.dtype, mode='w+', +- shape=self.shape) +- fp[:] = self.data[:] +- del fp +- os.unlink(tmpname) ++ with NamedTemporaryFile() as tmp: ++ fp = memmap(tmp.name, dtype=self.dtype, mode='w+', ++ shape=self.shape) ++ fp[:] = self.data[:] ++ del fp + + def test_unnamed_file(self): + with TemporaryFile() as f: +@@ -55,17 +54,16 @@ class TestMemmap(TestCase): + del fp + + def test_filename(self): +- tmpname = mktemp('', 'mmap') +- fp = memmap(tmpname, dtype=self.dtype, mode='w+', +- shape=self.shape) +- abspath = os.path.abspath(tmpname) +- fp[:] = self.data[:] +- self.assertEqual(abspath, fp.filename) +- b = fp[:1] +- self.assertEqual(abspath, b.filename) +- del b +- del fp +- os.unlink(tmpname) ++ with NamedTemporaryFile() as tmp: ++ fp = memmap(tmp.name, dtype=self.dtype, mode='w+', ++ shape=self.shape) ++ abspath = os.path.abspath(tmp.name) ++ fp[:] = self.data[:] ++ self.assertEqual(abspath, fp.filename) ++ b = fp[:1] ++ self.assertEqual(abspath, b.filename) ++ del b ++ del fp + + def test_filename_fileobj(self): + fp = memmap(self.tmpfp, dtype=self.dtype, mode="w+", +diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py +index a0c4bcf..37b9931 100644 +--- a/numpy/core/tests/test_multiarray.py ++++ b/numpy/core/tests/test_multiarray.py +@@ -2051,12 +2051,11 @@ class TestIO(object): + self.x = rand(shape) + rand(shape).astype(np.complex)*1j + self.x[0,:, 1] = [nan, inf, -inf, nan] + self.dtype = self.x.dtype +- self.filename = tempfile.mktemp() ++ self.file = tempfile.NamedTemporaryFile() ++ self.filename = self.file.name + + def tearDown(self): +- if os.path.isfile(self.filename): +- os.unlink(self.filename) +- #tmp_file.close() ++ self.file.close() + + def test_bool_fromstring(self): + v = np.array([True, False, True, False], dtype=np.bool_) +@@ -2084,7 +2083,6 @@ class TestIO(object): + y = np.fromfile(f, dtype=self.dtype) + f.close() + assert_array_equal(y, self.x.flat) +- os.unlink(self.filename) + + def test_roundtrip_filename(self): + self.x.tofile(self.filename) +@@ -2217,7 +2215,6 @@ class TestIO(object): + s = f.read() + f.close() + assert_equal(s, '1.51,2.0,3.51,4.0') +- os.unlink(self.filename) + + def test_tofile_format(self): + x = np.array([1.51, 2, 3.51, 4], dtype=float) +diff --git a/numpy/f2py/__init__.py b/numpy/f2py/__init__.py +index ccdbd4e..fcfd185 100644 +--- a/numpy/f2py/__init__.py ++++ b/numpy/f2py/__init__.py +@@ -28,20 +28,20 @@ def compile(source, + from numpy.distutils.exec_command import exec_command + import tempfile + if source_fn is None: +- fname = os.path.join(tempfile.mktemp()+'.f') ++ f = tempfile.NamedTemporaryFile(suffix='.f') + else: +- fname = source_fn +- +- f = open(fname, 'w') +- f.write(source) +- f.close() +- +- args = ' -c -m %s %s %s'%(modulename, fname, extra_args) +- c = '%s -c "import numpy.f2py as f2py2e;f2py2e.main()" %s' %(sys.executable, args) +- s, o = exec_command(c) +- if source_fn is None: +- try: os.remove(fname) +- except OSError: pass ++ f = open(source_fn, 'w') ++ ++ try: ++ f.write(source) ++ f.flush() ++ ++ args = ' -c -m %s %s %s'%(modulename, f.name, extra_args) ++ c = '%s -c "import numpy.f2py as f2py2e;f2py2e.main()" %s' % \ ++ (sys.executable, args) ++ s, o = exec_command(c) ++ finally: ++ f.close() + return s + + from numpy.testing import Tester +diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py +old mode 100755 +new mode 100644 +index 011b430..b264ea3 +--- a/numpy/f2py/f2py2e.py ++++ b/numpy/f2py/f2py2e.py +@@ -91,7 +91,7 @@ Options: + --lower is assumed with -h key, and --no-lower without -h key. + + --build-dir <dirname> All f2py generated files are created in <dirname>. +- Default is tempfile.mktemp(). ++ Default is tempfile.mkdtemp(). + + --overwrite-signature Overwrite existing signature file. + +@@ -428,7 +428,7 @@ def run_compile(): + del sys.argv[i] + else: + remove_build_dir = 1 +- build_dir = os.path.join(tempfile.mktemp()) ++ build_dir = tempfile.mkdtemp() + + _reg1 = re.compile(r'[-][-]link[-]') + sysinfo_flags = [_m for _m in sys.argv[1:] if _reg1.match(_m)] +diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py +index fdd78b2..caffada 100644 +--- a/numpy/lib/tests/test_io.py ++++ b/numpy/lib/tests/test_io.py +@@ -4,7 +4,9 @@ import sys + import gzip + import os + import threading +-from tempfile import mkstemp, mktemp, NamedTemporaryFile ++import shutil ++import contextlib ++from tempfile import mkstemp, mkdtemp, NamedTemporaryFile + import time + import warnings + import gc +@@ -21,6 +23,12 @@ from numpy.ma.testutils import (TestCase, assert_equal, assert_array_equal, + assert_raises, run_module_suite) + from numpy.testing import assert_warns, assert_, build_err_msg + ++@contextlib.contextmanager ++def tempdir(change_dir=False): ++ tmpdir = mkdtemp() ++ yield tmpdir ++ shutil.rmtree(tmpdir) ++ + + class TextIO(BytesIO): + """Helper IO class. +@@ -145,14 +153,14 @@ class TestSavezLoad(RoundtripTest, TestCase): + @np.testing.dec.slow + def test_big_arrays(self): + L = (1 << 31) + 100000 +- tmp = mktemp(suffix='.npz') + a = np.empty(L, dtype=np.uint8) +- np.savez(tmp, a=a) +- del a +- npfile = np.load(tmp) +- a = npfile['a'] +- npfile.close() +- os.remove(tmp) ++ with tempdir() as tmpdir: ++ tmp = open(os.path.join(tmpdir, "file.npz"), "w") ++ np.savez(tmp, a=a) ++ del a ++ npfile = np.load(tmp) ++ a = npfile['a'] ++ npfile.close() + + def test_multiple_arrays(self): + a = np.array([[1, 2], [3, 4]], float) diff --git a/dev-python/numpy/numpy-1.8.0-r1.ebuild b/dev-python/numpy/numpy-1.8.0-r1.ebuild new file mode 100644 index 000000000000..feb129aeef18 --- /dev/null +++ b/dev-python/numpy/numpy-1.8.0-r1.ebuild @@ -0,0 +1,146 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/numpy/numpy-1.8.0-r1.ebuild,v 1.1 2014/02/06 09:44:52 jlec Exp $ + +EAPI=5 + +PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3} ) + +FORTRAN_NEEDED=lapack + +inherit distutils-r1 eutils flag-o-matic fortran-2 multilib toolchain-funcs versionator + +DOC_PV="${PV}" + +DESCRIPTION="Fast array and numerical python library" +HOMEPAGE="http://numpy.scipy.org/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz + doc? ( + http://docs.scipy.org/doc/${P}/${PN}-html-${DOC_PV}.zip + http://docs.scipy.org/doc/${P}/${PN}-ref-${DOC_PV}.pdf + http://docs.scipy.org/doc/${P}/${PN}-user-${DOC_PV}.pdf + )" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris" +IUSE="doc lapack test" + +RDEPEND=" + dev-python/setuptools[${PYTHON_USEDEP}] + lapack? ( virtual/cblas virtual/lapack )" +DEPEND="${RDEPEND} + doc? ( app-arch/unzip ) + lapack? ( virtual/pkgconfig ) + test? ( >=dev-python/nose-0.10[${PYTHON_USEDEP}] )" + +# Uses distutils.command.config. +DISTUTILS_IN_SOURCE_BUILD=1 + +src_unpack() { + unpack ${P}.tar.gz + if use doc; then + unzip -qo "${DISTDIR}"/${PN}-html-${DOC_PV}.zip -d html || die + fi +} + +pc_incdir() { + $(tc-getPKG_CONFIG) --cflags-only-I $@ | \ + sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' +} + +pc_libdir() { + $(tc-getPKG_CONFIG) --libs-only-L $@ | \ + sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -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/[ ]*$//' \ + | sort | uniq | tr '\n' ',' +} + +python_prepare_all() { + epatch \ + "${FILESDIR}"/${P}-no-hardcode-blas.patch \ + "${FILESDIR}"/${P}-f2py-insecure-temporary.patch + + if use lapack; then + append-ldflags "$($(tc-getPKG_CONFIG) --libs-only-other cblas lapack)" + local libdir="${EPREFIX}"/usr/$(get_libdir) + # make sure _dotblas.so gets built + sed -i -e '/NO_ATLAS_INFO/,+1d' numpy/core/setup.py || die + 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 + else + export {ATLAS,PTATLAS,BLAS,LAPACK,MKL}=None + fi + + export CC="$(tc-getCC) ${CFLAGS}" + + append-flags -fno-strict-aliasing + + # See progress in http://projects.scipy.org/scipy/numpy/ticket/573 + # with the subtle difference that we don't want to break Darwin where + # -shared is not a valid linker argument + if [[ ${CHOST} != *-darwin* ]]; then + append-ldflags -shared + fi + + # only one fortran to link with: + # linking with cblas and lapack library will force + # autodetecting and linking to all available fortran compilers + if use lapack; then + append-fflags -fPIC + NUMPY_FCONFIG="config_fc --noopt --noarch" + # workaround bug 335908 + [[ $(tc-getFC) == *gfortran* ]] && NUMPY_FCONFIG+=" --fcompiler=gnu95" + fi + + # don't version f2py, we will handle it. + sed -i -e '/f2py_exe/s:+os\.path.*$::' numpy/f2py/setup.py || die + + distutils-r1_python_prepare_all +} + +python_compile() { + distutils-r1_python_compile ${NUMPY_FCONFIG} +} + +python_test() { + distutils_install_for_testing ${NUMPY_FCONFIG} + + cd "${TMPDIR}" || die + ${EPYTHON} -c " +import numpy, sys +r = numpy.test(verbose=3) +sys.exit(0 if r.wasSuccessful() else 1)" || die "Tests fail with ${EPYTHON}" +} + +python_install() { + distutils-r1_python_install ${NUMPY_FCONFIG} +} + +python_install_all() { + distutils-r1_python_install_all + + dodoc COMPATIBILITY DEV_README.txt THANKS.txt + + docinto f2py + dodoc numpy/f2py/docs/*.txt + doman numpy/f2py/f2py.1 + + if use doc; then + dohtml -r "${WORKDIR}"/html/* + insinto /usr/share/doc/${PF} + doins "${DISTDIR}"/${PN}-{user,ref}-${DOC_PV}.pdf + fi +} |