diff --git a/python-healpy-fix-cfitsio-4.0.patch b/python-healpy-fix-cfitsio-4.0.patch new file mode 100644 index 0000000..30979aa --- /dev/null +++ b/python-healpy-fix-cfitsio-4.0.patch @@ -0,0 +1,29 @@ +diff -Naur healpy-1.15.0/healpixsubmodule/src/cxx/cxxsupport/fitshandle.cc healpy-1.15.0.new/healpixsubmodule/src/cxx/cxxsupport/fitshandle.cc +--- healpy-1.15.0/healpixsubmodule/src/cxx/cxxsupport/fitshandle.cc 2021-06-22 13:20:56.000000000 +0200 ++++ healpy-1.15.0.new/healpixsubmodule/src/cxx/cxxsupport/fitshandle.cc 2021-12-31 21:31:30.439657095 +0100 +@@ -801,10 +801,25 @@ + "error calling fits_get_version()"); + int v_header = nearest(1000.*CFITSIO_VERSION), + v_library = nearest(1000.*fitsversion); ++ /* CFITSIO 4.x switched to a three version format (4.0.0), as opposed ++ * to previous two-number versions (3.47). Version 4 defines a new macro ++ * CFITSIO_MICRO to track the patch level in the version. We check if ++ * macro is defined, and fall back to the old behaviour if it is not. ++ * If it is, we adapt to the new value returned by 'fits_get_version'. ++ */ ++#ifdef CFITSIO_MICRO ++ int v_header = nearest(1E6*CFITSIO_MAJOR + 1000.*CFITSIO_MINOR + CFITSIO_MICRO), ++ v_library = nearest(1E6*fitsversion); ++ if (v_header!=v_library) ++ cerr << endl << "WARNING: version mismatch between CFITSIO header (v" ++ << dataToString(v_header*1.0E-6) << ") and linked library (v" ++ << dataToString(v_library*1.0E-6) << ")." << endl << endl; ++#else + if (v_header!=v_library) + cerr << endl << "WARNING: version mismatch between CFITSIO header (v" + << dataToString(v_header*0.001) << ") and linked library (v" + << dataToString(v_library*0.001) << ")." << endl << endl; ++#endif + } + }; + diff --git a/python-healpy.spec b/python-healpy.spec index 9f8c021..62c1c40 100644 --- a/python-healpy.spec +++ b/python-healpy.spec @@ -10,6 +10,9 @@ License: GPLv2+ URL: https://pypi.python.org/pypi/%{srcname} Source0: https://files.pythonhosted.org/packages/source/h/%{srcname}/%{srcname}-%{version}.tar.gz +# Fix build with cfitsio 4.0, backported healpix patch https://sourceforge.net/p/healpix/code/1189/tree//branches/branch_v380r1183/src/cxx/cxxsupport/fitshandle.cc?diff=50dae5f434309d7d74da16d0:1188 +Patch0: python-healpy-fix-cfitsio-4.0.patch + # Upstream only supports 64 bit architectures, 32 Bit builds, but tests fail # and we don't want to provide a non reliable software. # Check https://github.com/healpy/healpy/issues/194 @@ -18,10 +21,7 @@ ExclusiveArch: aarch64 ppc64 ppc64le x86_64 s390x ExcludeArch: %{ix86} %{arm} # Common build requirements -# Use bundled cfitsio until healpy is compatible with cftision 4.0 -# https://github.com/healpy/healpy/issues/722 -Provides: bundled(cfitsio) = 3.48 -#BuildRequires: cfitsio-devel +BuildRequires: cfitsio-devel BuildRequires: gcc-c++ # Python 3 build requirements