commit:     bd2bae0edf7dc6a4b0869e96a1652541f3e4f60c
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  7 22:00:06 2016 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Tue Jun  7 22:02:15 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd2bae0e

dev-python/montage-wrapper: Initial import

Package-Manager: portage-2.3.0_rc1

 dev-python/montage-wrapper/Manifest                |  1 +
 .../files/montage-wrapper-0.9.8-fix_tests.patch    | 40 +++++++++++++++++
 .../montage-wrapper-0.9.8-increase_rtol.patch      | 17 ++++++++
 .../montage-wrapper-0.9.8-use_configparser.patch   | 18 ++++++++
 dev-python/montage-wrapper/metadata.xml            | 17 ++++++++
 .../montage-wrapper/montage-wrapper-0.9.8.ebuild   | 51 ++++++++++++++++++++++
 6 files changed, 144 insertions(+)

diff --git a/dev-python/montage-wrapper/Manifest 
b/dev-python/montage-wrapper/Manifest
new file mode 100644
index 0000000..92a8c29
--- /dev/null
+++ b/dev-python/montage-wrapper/Manifest
@@ -0,0 +1 @@
+DIST montage-wrapper-0.9.8.tar.gz 208240 SHA256 
8f7c468f602e3fa38907e481abaede08fbc4cd17faae0b82d86638c0418aa98e SHA512 
a9aeb48f86d055448fdfed3a5c3762b554627db10f1374cbd3f7af6002721ae04e9f47828c2084147be40f79c1c4ce6e56568bf61a6cdd78a31ce91de6365ec1
 WHIRLPOOL 
f224a4fe9dba626700e85a78b309f5db0bf1bac26d27457f6f3eb8a53ae58effbe70043c8c1f311029e36e36082540a9da634821df75366056e9ecb7dbc602f1

diff --git 
a/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-fix_tests.patch 
b/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-fix_tests.patch
new file mode 100644
index 0000000..8d611b7
--- /dev/null
+++ b/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-fix_tests.patch
@@ -0,0 +1,40 @@
+Author: Ole Streicher <[email protected]>
+Description: Make sure that opened FITS files are closed after the test
+--- a/montage_wrapper/tests/test_wrappers.py
++++ b/montage_wrapper/tests/test_wrappers.py
+@@ -46,21 +46,21 @@
+ 
+     def test_mosaic(self):
+         mosaic(os.path.join(self.tmpdir, 'raw'),os.path.join(self.tmpdir, 
'mosaic'), hdu=0)
+-        hdu = fits.open(os.path.join(self.tmpdir, 'mosaic', 'mosaic.fits'))[0]
+-        assert hdu.data.shape == (288, 282)
+-        valid = hdu.data[~np.isnan(hdu.data)]
+-        assert len(valid) == 65029
+-        assert_allclose(np.std(valid), 0.12658458001333581, 1e-5)
+-        assert_allclose(np.mean(valid), 0.4995945318627074, 1e-5)
+-        assert_allclose(np.median(valid), 0.5003376603126526, 1e-5)
++        with fits.open(os.path.join(self.tmpdir, 'mosaic', 'mosaic.fits')) as 
hdu:
++            assert hdu[0].data.shape == (288, 282)
++            valid = hdu[0].data[~np.isnan(hdu[0].data)]
++            assert len(valid) == 65029
++            assert_allclose(np.std(valid), 0.12658458001333581, 1e-5)
++            assert_allclose(np.mean(valid), 0.4995945318627074, 1e-5)
++            assert_allclose(np.median(valid), 0.5003376603126526, 1e-5)
+ 
+     @pytest.mark.xfail()  # results are not consistent on different machines
+     def test_mosaic_background_match(self):
+         mosaic(os.path.join(self.tmpdir, 'raw'),os.path.join(self.tmpdir, 
'mosaic_bkgmatch'), background_match=True)
+-        hdu = fits.open(os.path.join(self.tmpdir, 'mosaic_bkgmatch', 
'mosaic.fits'))[0]
+-        assert hdu.data.shape == (288, 282)
+-        valid = hdu.data[~np.isnan(hdu.data)]
+-        assert len(valid) == 65029
+-        assert_allclose(np.std(valid), 0.12661606622654725)
+-        assert_allclose(np.mean(valid), 0.4994805202294361)
+-        assert_allclose(np.median(valid), 0.5002447366714478)
++        with fits.open(os.path.join(self.tmpdir, 'mosaic_bkgmatch', 
'mosaic.fits')) as hdu:
++            assert hdu[0].data.shape == (288, 282)
++            valid = hdu[0].data[~np.isnan(hdu[0].data)]
++            assert len(valid) == 65029
++            assert_allclose(np.std(valid), 0.12661606622654725)
++            assert_allclose(np.mean(valid), 0.4994805202294361)
++            assert_allclose(np.median(valid), 0.5002447366714478)

diff --git 
a/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-increase_rtol.patch 
b/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-increase_rtol.patch
new file mode 100644
index 0000000..285b525
--- /dev/null
+++ b/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-increase_rtol.patch
@@ -0,0 +1,17 @@
+Author: Ole Streicher <[email protected]>
+Description: Increase rtol of asserts to let the tests succeed with montage-4.0
+--- a/montage_wrapper/tests/test_wrappers.py
++++ b/montage_wrapper/tests/test_wrappers.py
+@@ -50,9 +50,9 @@
+         assert hdu.data.shape == (288, 282)
+         valid = hdu.data[~np.isnan(hdu.data)]
+         assert len(valid) == 65029
+-        assert_allclose(np.std(valid), 0.12658458001333581)
+-        assert_allclose(np.mean(valid), 0.4995945318627074)
+-        assert_allclose(np.median(valid), 0.5003376603126526)
++        assert_allclose(np.std(valid), 0.12658458001333581, 1e-5)
++        assert_allclose(np.mean(valid), 0.4995945318627074, 1e-5)
++        assert_allclose(np.median(valid), 0.5003376603126526, 1e-5)
+ 
+     @pytest.mark.xfail()  # results are not consistent on different machines
+     def test_mosaic_background_match(self):

diff --git 
a/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-use_configparser.patch 
b/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-use_configparser.patch
new file mode 100644
index 0000000..082c367
--- /dev/null
+++ 
b/dev-python/montage-wrapper/files/montage-wrapper-0.9.8-use_configparser.patch
@@ -0,0 +1,18 @@
+Author: Vincent Prat <[email protected]>
+Description: Use ConfigParser module instead of the one embedded in 
distutils.config
+--- a/setup.py
++++ b/setup.py
+@@ -21,8 +21,11 @@
+ from astropy_helpers.version_helpers import generate_version_py
+ 
+ # Get some values from the setup.cfg
+-from distutils import config
+-conf = config.ConfigParser()
++try:
++    from configparser import ConfigParser
++except:
++    from ConfigParser import ConfigParser
++conf = ConfigParser()
+ conf.read(['setup.cfg'])
+ metadata = dict(conf.items('metadata'))
+ 

diff --git a/dev-python/montage-wrapper/metadata.xml 
b/dev-python/montage-wrapper/metadata.xml
new file mode 100644
index 0000000..aa3e481
--- /dev/null
+++ b/dev-python/montage-wrapper/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="project">
+    <email>[email protected]</email>
+    <name>Gentoo Astronomy Project</name>
+  </maintainer>
+  <longdescription>
+  This Astropy-affiliated package provides a python wrapper to the
+  Montage Astronomical Image Mosaic Engine, including both functions to
+  access individual Montage commands, and high-level functions to
+  facilitate mosaicking and re-projecting.
+</longdescription>
+  <upstream>
+    <remote-id type="pypi">montage-wrapper</remote-id>
+  </upstream>
+</pkgmetadata>

diff --git a/dev-python/montage-wrapper/montage-wrapper-0.9.8.ebuild 
b/dev-python/montage-wrapper/montage-wrapper-0.9.8.ebuild
new file mode 100644
index 0000000..a9d8750
--- /dev/null
+++ b/dev-python/montage-wrapper/montage-wrapper-0.9.8.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python wrapper for the Montage mosaicking toolkit"
+HOMEPAGE="http://www.astropy.org/montage-wrapper/";
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc test"
+
+RDEPEND="
+       dev-python/astropy[${PYTHON_USEDEP}]
+       sci-astronomy/montage"
+DEPEND="
+       dev-python/astropy[${PYTHON_USEDEP}]
+       dev-python/setuptools[${PYTHON_USEDEP}]
+       test? ( sci-astronomy/montage )"
+
+PATCHES=(
+       "${FILESDIR}/${P}-increase_rtol.patch"
+       "${FILESDIR}/${P}-fix_tests.patch"
+       "${FILESDIR}/${P}-use_configparser.patch"
+)
+
+python_prepare_all() {
+       # use system astropy-helpers instead of bundled one
+       sed -i -e '/auto_use/s/True/False/' setup.cfg || die
+       distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+       use doc && PYTHONPATH=".." emake -C docs html
+}
+
+python_test() {
+       ${EPYTHON} setup.py test
+}
+
+python_install_all() {
+       use doc && HTML_DOCS=( docs/_build/html/. )
+       distutils-r1_python_install_all
+}

Reply via email to