public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/fitsio/files/, dev-python/fitsio/
@ 2017-07-13 19:16 Sebastien Fabbro
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastien Fabbro @ 2017-07-13 19:16 UTC (permalink / raw
  To: gentoo-commits

commit:     1fd35e3bd8d2038f42a5622a82ec4466a7338fd1
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 12 20:02:46 2017 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Thu Jul 13 19:15:55 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fd35e3b

dev-python/fitsio: initial import

Package-Manager: Portage-2.3.6, Repoman-2.3.2

 dev-python/fitsio/Manifest                         |  1 +
 .../fitsio/files/fitsio-0.9.11-test-failures.patch | 38 ++++++++++++++++++++
 dev-python/fitsio/fitsio-0.9.11.ebuild             | 40 ++++++++++++++++++++++
 dev-python/fitsio/metadata.xml                     | 21 ++++++++++++
 4 files changed, 100 insertions(+)

diff --git a/dev-python/fitsio/Manifest b/dev-python/fitsio/Manifest
new file mode 100644
index 00000000000..211ba4147d0
--- /dev/null
+++ b/dev-python/fitsio/Manifest
@@ -0,0 +1 @@
+DIST fitsio-0.9.11.tar.gz 6020222 SHA256 a1196385ca7c42c93d9e53002d5ba574a8db452c3b53ef1189e2c150177d4266 SHA512 751b9612fe051f128d8f5dea61e2d119409293051a130ee3e18836181637e8c8daea757a715012fd024678d00e234e8b6c0cc0c9229c2bd9a406db312e4607d7 WHIRLPOOL b1baeef81675b089fc176d2c83766fc535e0fe5f1841b8ecf3b37ce8a336f05c9d61791fa5d7d010a115f300560ffe499eed291c12c3ed2633a2651de79f26e9

diff --git a/dev-python/fitsio/files/fitsio-0.9.11-test-failures.patch b/dev-python/fitsio/files/fitsio-0.9.11-test-failures.patch
new file mode 100644
index 00000000000..243913dc659
--- /dev/null
+++ b/dev-python/fitsio/files/fitsio-0.9.11-test-failures.patch
@@ -0,0 +1,38 @@
+From: Ole Streicher <olebole@debian.org>
+Date: Fri, 15 Jul 2016 08:46:15 +0200
+Subject: Mark failures that are known to fail with the original cfitsio
+
+---
+ fitsio/test.py | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/fitsio/test.py b/fitsio/test.py
+index bafde15..49a4b3b 100644
+--- a/fitsio/test.py
++++ b/fitsio/test.py
+@@ -545,7 +545,7 @@ class TestReadWrite(unittest.TestCase):
+         try:
+             with fitsio.FITS(fname,'rw',clobber=True) as fits:
+                 # note i8 not supported for compressed!
+-                dtypes = ['u1','i1','u2','i2','u4','i4','f4','f8']
++                dtypes = ['u1','i1',     'i2','u4','i4','f4','f8']
+ 
+                 for dtype in dtypes:
+                     data = numpy.arange(5*20,dtype=dtype).reshape(5,20)
+@@ -569,7 +569,7 @@ class TestReadWrite(unittest.TestCase):
+         try:
+             with fitsio.FITS(fname,'rw',clobber=True) as fits:
+                 # note i8 not supported for compressed!
+-                dtypes = ['u1','i1','u2','i2','u4','i4','f4','f8']
++                dtypes = ['u1','i1',     'i2','u4','i4','f4','f8']
+ 
+                 for dtype in dtypes:
+                     data = numpy.arange(5*20,dtype=dtype).reshape(5,20)
+@@ -1365,6 +1365,7 @@ class TestReadWrite(unittest.TestCase):
+             if os.path.exists(fname):
+                 os.remove(fname)
+ 
++    @unittest.skip("bzip2 is not supported with debian cfitsio package")
+     def testBz2Read(self):
+         '''
+         Write a normal .fits file, run bzip2 on it, then read the bz2

diff --git a/dev-python/fitsio/fitsio-0.9.11.ebuild b/dev-python/fitsio/fitsio-0.9.11.ebuild
new file mode 100644
index 00000000000..cf3d78bf88d
--- /dev/null
+++ b/dev-python/fitsio/fitsio-0.9.11.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 python3_{5,6} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python library to read from and write to FITS files"
+HOMEPAGE="https://github.com/esheldon/fitsio"
+SRC_URI="https://github.com/esheldon/fitsio/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND="
+	>=dev-python/numpy-1.11[${PYTHON_USEDEP}]
+	sci-libs/cfitsio:0=
+"
+DEPEND="${RDEPEND}
+	dev-python/setuptools[${PYTHON_USEDEP}]
+"
+
+PATCHES=( "${FILESDIR}"/${P}-test-failures.patch )
+
+python_prepare_all() {
+	sed -e '/self.use_system_fitsio/s/False/True/' \
+		-i setup.py || die
+	distutils-r1_python_prepare_all
+}
+
+python_test() {
+	distutils_install_for_testing
+	pushd "${TEST_DIR}"/ || die
+	${PYTHON} -c "import fitsio; exit(fitsio.test.test())" || die
+	popd > /dev/null || die
+}

diff --git a/dev-python/fitsio/metadata.xml b/dev-python/fitsio/metadata.xml
new file mode 100644
index 00000000000..b7f5bc4ce9a
--- /dev/null
+++ b/dev-python/fitsio/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="project">
+    <email>sci-astronomy@gentoo.org</email>
+    <name>Gentoo Astronomy Project</name>
+  </maintainer>
+  <longdescription lang="en">
+    Fitsio provides an easy to use object-oriented API including
+    providing a Numpy interface to FITS files read from CFITSIO. It
+    allows direct access to the columns of a FITS binary table which can
+    be useful for reading large fits files. Compared to astropy.io.fits,
+    this package is closer to the underlying cfitsio library.
+    Fitsio also exposes a microlanguage (implemented in CFITSIO) for
+    making efficient SQL-like queries of tables (single tables only
+    though–no joins or anything like that).
+  </longdescription>
+  <upstream>
+    <remote-id type="github">esheldon/fitsio</remote-id>
+  </upstream>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/fitsio/files/, dev-python/fitsio/
@ 2024-06-10 17:01 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2024-06-10 17:01 UTC (permalink / raw
  To: gentoo-commits

commit:     bdac399c3ca7a4398c93072198b3f75a84fd84bb
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 16:50:44 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 17:01:05 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdac399c

dev-python/fitsio: Add numpy-2 / gcc-14 / py3.13 support

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/fitsio/Manifest                         |   1 +
 dev-python/fitsio/files/fitsio-1.2.1-numpy-2.patch | 159 +++++++++++++++++++++
 dev-python/fitsio/fitsio-1.2.1-r2.ebuild           |  50 +++++++
 3 files changed, 210 insertions(+)

diff --git a/dev-python/fitsio/Manifest b/dev-python/fitsio/Manifest
index f7d234d76cce..c8dcf5810f42 100644
--- a/dev-python/fitsio/Manifest
+++ b/dev-python/fitsio/Manifest
@@ -1 +1,2 @@
+DIST fitsio-1.2.1-gcc-14.patch 28560 BLAKE2B 14a98317e6ad8f53b7f7d4501926e59bdc6fdc0d0540f03c1b8628ece79857b1e06086e261745dcfe6f980413f62a2e2740d6b1b0fb278b38df2abc9d0b727ef SHA512 ec2093e9430ecb49820338577b2b51a6057777fa4b94170657a1e6f044d57de7b83c1947870e1c188510a10b081b9cf6adad6dc2ca6002eb406596593c508504
 DIST fitsio-1.2.1.gh.tar.gz 4584464 BLAKE2B 376d2afe2e637075fca88c24c17117600973dc81fbb006e3e8bf4ddab023db6a466653187b686a4beb75339559cb4b77e0bf927f09c991d9205ffb0e66ad17a6 SHA512 645c117c394a18cdbb0c5033a1446e1f6e6473f54d9556b7591f33873855a70860343b3e4811284d7dfa16696ef23a1abb74ee638318d7295eb85ec4b17f0309

diff --git a/dev-python/fitsio/files/fitsio-1.2.1-numpy-2.patch b/dev-python/fitsio/files/fitsio-1.2.1-numpy-2.patch
new file mode 100644
index 000000000000..cfc0b99a8f17
--- /dev/null
+++ b/dev-python/fitsio/files/fitsio-1.2.1-numpy-2.patch
@@ -0,0 +1,159 @@
+diff --git a/fitsio/fitslib.py b/fitsio/fitslib.py
+index 7ef718b..3d43549 100644
+--- a/fitsio/fitslib.py
++++ b/fitsio/fitslib.py
+@@ -25,7 +25,7 @@
+ import numpy
+ 
+ from . import _fitsio_wrap
+-from .util import IS_PY3, mks, array_to_native, isstring
++from .util import IS_PY3, mks, array_to_native, isstring, copy_if_needed
+ from .header import FITSHDR
+ from .hdu import (
+     ANY_HDU, IMAGE_HDU, BINARY_TBL, ASCII_TBL,
+@@ -957,7 +957,7 @@ def create_image_hdu(self,
+                 if IS_PY3 and img2send.dtype.char == 'U':
+                     # for python3, we convert unicode to ascii
+                     # this will error if the character is not in ascii
+-                    img2send = img2send.astype('S', copy=False)
++                    img2send = img2send.astype('S', copy=copy_if_needed)
+ 
+             else:
+                 self._ensure_empty_image_ok()
+@@ -1738,7 +1738,7 @@ def npy_obj2fits(data, name=None):
+         else:
+             fits_dtype = _table_npy2fits_form['S']
+     else:
+-        arr0 = numpy.array(first, copy=False)
++        arr0 = numpy.array(first, copy=copy_if_needed)
+         dtype0 = arr0.dtype
+         npy_dtype = dtype0.descr[0][1][1:]
+         if npy_dtype[0] == 'S' or npy_dtype[0] == 'U':
+diff --git a/fitsio/hdu/image.py b/fitsio/hdu/image.py
+index 8c06bcf..a2d16c8 100644
+--- a/fitsio/hdu/image.py
++++ b/fitsio/hdu/image.py
+@@ -27,7 +27,7 @@
+ 
+ from math import floor
+ from .base import HDUBase, IMAGE_HDU
+-from ..util import IS_PY3, array_to_native
++from ..util import IS_PY3, array_to_native, copy_if_needed
+ 
+ # for python3 compat
+ if IS_PY3:
+@@ -146,7 +146,7 @@ def write(self, img, start=0, **keys):
+         if IS_PY3 and img_send.dtype.char == 'U':
+             # for python3, we convert unicode to ascii
+             # this will error if the character is not in ascii
+-            img_send = img_send.astype('S', copy=False)
++            img_send = img_send.astype('S', copy=copy_if_needed)
+ 
+         if not numpy.isscalar(start):
+             # convert to scalar offset
+diff --git a/fitsio/hdu/table.py b/fitsio/hdu/table.py
+index f210121..3b462b1 100644
+--- a/fitsio/hdu/table.py
++++ b/fitsio/hdu/table.py
+@@ -36,7 +36,8 @@
+     array_to_native,
+     array_to_native_c,
+     FITSRuntimeWarning,
+-    mks
++    mks,
++    copy_if_needed,
+ )
+ from .base import HDUBase, ASCII_TBL, IMAGE_HDU, _hdu_type_map
+ 
+@@ -282,7 +283,7 @@ def write(self, data, firstrow=0, columns=None, names=None, slow=False,
+                     if IS_PY3 and colref.dtype.char == 'U':
+                         # for python3, we convert unicode to ascii
+                         # this will error if the character is not in ascii
+-                        colref = colref.astype('S', copy=False)
++                        colref = colref.astype('S', copy=copy_if_needed)
+ 
+                     nonobj_arrays.append(colref)
+ 
+@@ -347,7 +348,7 @@ def write_column(self, column, data, firstrow=0, **keys):
+         if IS_PY3 and data_send.dtype.char == 'U':
+             # for python3, we convert unicode to ascii
+             # this will error if the character is not in ascii
+-            data_send = data_send.astype('S', copy=False)
++            data_send = data_send.astype('S', copy=copy_if_needed)
+ 
+         self._verify_column_data(colnum, data_send)
+ 
+@@ -1420,13 +1421,13 @@ def _extract_rows(self, rows, sort=False):
+         Extract an array of rows from an input scalar or sequence
+         """
+         if rows is not None:
+-            rows = np.array(rows, ndmin=1, copy=False, dtype='i8')
++            rows = np.array(rows, ndmin=1, copy=copy_if_needed, dtype='i8')
+             if sort:
+                 rows = np.unique(rows)
+                 return rows, None
+ 
+             # returns unique, sorted.  Force i8 for 32-bit systems
+-            sortind = np.array(rows.argsort(), dtype='i8', copy=False)
++            sortind = np.array(rows.argsort(), dtype='i8', copy=copy_if_needed)
+ 
+             maxrow = self._info['nrows']-1
+             if rows.size > 0:
+@@ -1583,7 +1584,7 @@ def _maybe_decode_fits_ascii_strings_to_unicode_py3(self, array):
+                 else:
+                     new_dt.append(_dt)
+             if do_conversion:
+-                array = array.astype(new_dt, copy=False)
++                array = array.astype(new_dt, copy=copy_if_needed)
+         return array
+ 
+     def _convert_bool_array(self, array):
+@@ -1721,7 +1722,7 @@ def _read_var_column(self, colnum, rows, sortind, vstorage):
+                 descr = 'S%d' % max_size
+                 array = np.fromiter(dlist, descr)
+                 if IS_PY3:
+-                    array = array.astype('U', copy=False)
++                    array = array.astype('U', copy=copy_if_needed)
+             else:
+                 descr = dlist[0].dtype.str
+                 array = np.zeros((len(dlist), max_size), dtype=descr)
+diff --git a/fitsio/util.py b/fitsio/util.py
+index 562b609..5d337be 100644
+--- a/fitsio/util.py
++++ b/fitsio/util.py
+@@ -41,7 +41,10 @@ def cfitsio_version(asfloat=False):
+             numpy.uint64, numpy.int64)
+ 
+ # different for py3
+-_stypes += (numpy.string_, numpy.str_)
++if numpy.lib.NumpyVersion(numpy.__version__) < "1.28.0":
++    _stypes += (numpy.string_, numpy.str_,)
++else:
++    _stypes += (numpy.bytes_, numpy.str_,)
+ 
+ # for header keywords
+ _ftypes = (float, numpy.float32, numpy.float64)
+@@ -134,9 +137,22 @@ def array_to_native(array, inplace=False):
+     return output
+ 
+ 
++if numpy.lib.NumpyVersion(numpy.__version__) >= "2.0.0":
++    copy_if_needed = None
++elif numpy.lib.NumpyVersion(numpy.__version__) < "1.28.0":
++    copy_if_needed = False
++else:
++    # 2.0.0 dev versions, handle cases where copy may or may not exist
++    try:
++        numpy.array([1]).__array__(copy=None)
++        copy_if_needed = None
++    except TypeError:
++        copy_if_needed = False
++
++
+ def array_to_native_c(array_in, inplace=False):
+     # copy only made if not C order
+-    arr = numpy.array(array_in, order='C', copy=False)
++    arr = numpy.array(array_in, order='C', copy=copy_if_needed)
+     return array_to_native(arr, inplace=inplace)
+ 
+ 

diff --git a/dev-python/fitsio/fitsio-1.2.1-r2.ebuild b/dev-python/fitsio/fitsio-1.2.1-r2.ebuild
new file mode 100644
index 000000000000..5ad63bf814ce
--- /dev/null
+++ b/dev-python/fitsio/fitsio-1.2.1-r2.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python library to read from and write to FITS files"
+HOMEPAGE="
+	https://github.com/esheldon/fitsio/
+	https://pypi.org/project/fitsio/
+"
+SRC_URI="
+	https://github.com/esheldon/fitsio/archive/${PV}.tar.gz
+		-> ${P}.gh.tar.gz
+	https://github.com/esheldon/fitsio/pull/394.patch
+		-> fitsio-1.2.1-gcc-14.patch
+"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+
+DEPEND="
+	>=dev-python/numpy-1.11:=[${PYTHON_USEDEP}]
+	sci-libs/cfitsio:0=
+"
+RDEPEND="
+	${DEPEND}
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+	# https://github.com/esheldon/fitsio/pull/394
+	"${DISTDIR}/${P}-gcc-14.patch"
+	# https://github.com/esheldon/fitsio/pull/390
+	"${FILESDIR}/${P}-numpy-2.patch"
+)
+
+export FITSIO_USE_SYSTEM_FITSIO=1
+
+python_test() {
+	cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+	epytest
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-10 17:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13 19:16 [gentoo-commits] repo/gentoo:master commit in: dev-python/fitsio/files/, dev-python/fitsio/ Sebastien Fabbro
  -- strict thread matches above, loose matches on Subject: below --
2024-06-10 17:01 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox