python313Packages.spectral-cube: fix build (#381027)
This commit is contained in:
@@ -17,15 +17,12 @@
|
||||
setuptools,
|
||||
setuptools-scm,
|
||||
shapely,
|
||||
wheel,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "aplpy";
|
||||
version = "2.2.0";
|
||||
format = "pyproject";
|
||||
|
||||
disabled = pythonOlder "3.6";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "aplpy";
|
||||
@@ -33,37 +30,12 @@ buildPythonPackage rec {
|
||||
hash = "sha256-oUylUM7/6OyEJFrpkr9MjXilXC/ZIdBQ5au4cvyZiA0=";
|
||||
};
|
||||
|
||||
# Fix build with Astropy 6.1, Python 3.12 and matplotlib 3.9
|
||||
patches = [
|
||||
# https://github.com/aplpy/aplpy/pull/496
|
||||
(fetchpatch {
|
||||
url = "https://github.com/aplpy/aplpy/commit/d232a4984bc6a83ec86dfdc3ab3bc1b05de44c48.patch";
|
||||
hash = "sha256-jGUTzIrVdGNPy0BV8w46jzz045fDXBisiwIn90bn7oY=";
|
||||
})
|
||||
# https://github.com/aplpy/aplpy/pull/497
|
||||
(fetchpatch {
|
||||
url = "https://github.com/aplpy/aplpy/commit/468be394970b39f1aaa6debef51eb674e2dd86d8.patch";
|
||||
hash = "sha256-/ovLrFOKb3RQ8TZSviuOV6EYNgz0gtrhVWZLFJBrzFg=";
|
||||
})
|
||||
# https://github.com/aplpy/aplpy/pull/500
|
||||
(fetchpatch {
|
||||
url = "https://github.com/aplpy/aplpy/commit/c9049261b3724821f4d309d85fe73cabcc04d890.patch";
|
||||
hash = "sha256-ivdXLh1Z+WG3EL5u1wO+lqz6X1AP6WpyoZix5YiqW0w=";
|
||||
})
|
||||
# https://github.com/aplpy/aplpy/pull/503
|
||||
(fetchpatch {
|
||||
url = "https://github.com/aplpy/aplpy/commit/edc2aa9770b72bd3ac42db95a6e027b276be9c31.patch";
|
||||
hash = "sha256-QUZenY3XQ/T2tl5apxZUqjf4ACjOzJWb+1AUp5limi4=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
build-system = [
|
||||
setuptools
|
||||
setuptools-scm
|
||||
wheel
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
astropy
|
||||
matplotlib
|
||||
numpy
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
fetchFromGitHub,
|
||||
# needed to build
|
||||
cython,
|
||||
extension-helpers,
|
||||
oldest-supported-numpy,
|
||||
setuptools,
|
||||
setuptools-scm,
|
||||
wheel,
|
||||
# needed to run
|
||||
astropy,
|
||||
numpy,
|
||||
@@ -20,36 +20,30 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pyregion";
|
||||
version = "2.2.0";
|
||||
version = "2.3.0";
|
||||
pyproject = true;
|
||||
|
||||
# pypi src contains cython-produced .c files which don't compile
|
||||
# with python3.9
|
||||
src = fetchFromGitHub {
|
||||
owner = "astropy";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
hash = "sha256-r2STKnZwNvonXATrQ5q9NVD9QftlWI1RWl4F+GZSxVg=";
|
||||
repo = "pyregion";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-mEO2PbUSTVy7Qmm723/lGL6PYQzbRazIPZH51SWebvs=";
|
||||
};
|
||||
|
||||
env = lib.optionalAttrs stdenv.cc.isClang {
|
||||
# Try to remove on next update. generated code returns a NULL in a
|
||||
# function where an int is expected.
|
||||
NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
astropy
|
||||
numpy
|
||||
pyparsing
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
build-system = [
|
||||
cython
|
||||
extension-helpers
|
||||
oldest-supported-numpy
|
||||
setuptools
|
||||
setuptools-scm
|
||||
wheel
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
@@ -66,7 +60,7 @@ buildPythonPackage rec {
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
changelog = "https://github.com/astropy/pyregion/blob/${version}/CHANGES.rst";
|
||||
changelog = "https://github.com/astropy/pyregion/blob/${src.tag}/CHANGES.rst";
|
||||
description = "Python parser for ds9 region files";
|
||||
homepage = "https://github.com/astropy/pyregion";
|
||||
license = licenses.mit;
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
casa-formats-io,
|
||||
dask,
|
||||
joblib,
|
||||
looseversion,
|
||||
numpy,
|
||||
packaging,
|
||||
radio-beam,
|
||||
tqdm,
|
||||
|
||||
# checks
|
||||
aplpy,
|
||||
@@ -27,15 +29,12 @@ buildPythonPackage rec {
|
||||
version = "0.6.6";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
pname = "spectral_cube";
|
||||
inherit version;
|
||||
hash = "sha256-bjBghr5WrfC4NH5cyiy9RUiCmJSUHBtyD61bd1i/4kM=";
|
||||
};
|
||||
|
||||
patches = [ ./distutils-looseversion.patch ];
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
dependencies = [
|
||||
@@ -43,9 +42,11 @@ buildPythonPackage rec {
|
||||
casa-formats-io
|
||||
dask
|
||||
joblib
|
||||
looseversion
|
||||
numpy
|
||||
packaging
|
||||
radio-beam
|
||||
];
|
||||
tqdm
|
||||
] ++ dask.optional-dependencies.array;
|
||||
|
||||
nativeCheckInputs = [
|
||||
aplpy
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
diff --git a/spectral_cube/conftest.py b/spectral_cube/conftest.py
|
||||
index 0d7c158..6fac9b4 100644
|
||||
--- a/spectral_cube/conftest.py
|
||||
+++ b/spectral_cube/conftest.py
|
||||
@@ -4,7 +4,7 @@
|
||||
from __future__ import print_function, absolute_import, division
|
||||
|
||||
import os
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
from astropy.units.equivalencies import pixel_scale
|
||||
|
||||
# Import casatools and casatasks here if available as they can otherwise
|
||||
diff --git a/spectral_cube/lower_dimensional_structures.py b/spectral_cube/lower_dimensional_structures.py
|
||||
index f0e3745..1b1e1f8 100644
|
||||
--- a/spectral_cube/lower_dimensional_structures.py
|
||||
+++ b/spectral_cube/lower_dimensional_structures.py
|
||||
@@ -526,7 +526,7 @@ class Projection(LowerDimensionalObject, SpatialCoordMixinClass,
|
||||
" installed.")
|
||||
|
||||
# Need version > 0.2 to work with cubes
|
||||
- from distutils.version import LooseVersion
|
||||
+ from looseversion import LooseVersion
|
||||
if LooseVersion(version) < "0.3":
|
||||
raise Warning("Requires version >=0.3 of reproject. The current "
|
||||
"version is: {}".format(version))
|
||||
diff --git a/spectral_cube/np_compat.py b/spectral_cube/np_compat.py
|
||||
index ed4a134..39aa320 100644
|
||||
--- a/spectral_cube/np_compat.py
|
||||
+++ b/spectral_cube/np_compat.py
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import print_function, absolute_import, division
|
||||
|
||||
import numpy as np
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
def allbadtonan(function):
|
||||
"""
|
||||
diff --git a/spectral_cube/spectral_cube.py b/spectral_cube/spectral_cube.py
|
||||
index 771a2d4..af752b4 100644
|
||||
--- a/spectral_cube/spectral_cube.py
|
||||
+++ b/spectral_cube/spectral_cube.py
|
||||
@@ -57,7 +57,7 @@ from .spectral_axis import (determine_vconv_from_ctype, get_rest_value_from_wcs,
|
||||
doppler_beta, doppler_gamma, doppler_z)
|
||||
from .io.core import SpectralCubeRead, SpectralCubeWrite
|
||||
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
|
||||
__all__ = ['BaseSpectralCube', 'SpectralCube', 'VaryingResolutionSpectralCube']
|
||||
@@ -2659,7 +2659,7 @@ class BaseSpectralCube(BaseNDClass, MaskableArrayMixinClass,
|
||||
|
||||
reproj_kwargs = kwargs
|
||||
# Need version > 0.2 to work with cubes, >= 0.5 for memmap
|
||||
- from distutils.version import LooseVersion
|
||||
+ from looseversion import LooseVersion
|
||||
if LooseVersion(version) < "0.5":
|
||||
raise Warning("Requires version >=0.5 of reproject. The current "
|
||||
"version is: {}".format(version))
|
||||
diff --git a/spectral_cube/tests/test_masks.py b/spectral_cube/tests/test_masks.py
|
||||
index c38ba27..1d6895d 100644
|
||||
--- a/spectral_cube/tests/test_masks.py
|
||||
+++ b/spectral_cube/tests/test_masks.py
|
||||
@@ -14,7 +14,7 @@ from .. import (BooleanArrayMask, LazyMask, LazyComparisonMask,
|
||||
FunctionMask, CompositeMask)
|
||||
from ..masks import is_broadcastable_and_smaller, dims_to_skip, view_of_subset
|
||||
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
|
||||
def test_spectral_cube_mask():
|
||||
diff --git a/spectral_cube/tests/test_moments.py b/spectral_cube/tests/test_moments.py
|
||||
index 3043dd5..7e05c5b 100644
|
||||
--- a/spectral_cube/tests/test_moments.py
|
||||
+++ b/spectral_cube/tests/test_moments.py
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import print_function, absolute_import, division
|
||||
|
||||
import warnings
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
import pytest
|
||||
import numpy as np
|
||||
diff --git a/spectral_cube/tests/test_performance.py b/spectral_cube/tests/test_performance.py
|
||||
index bdee040..a778abc 100644
|
||||
--- a/spectral_cube/tests/test_performance.py
|
||||
+++ b/spectral_cube/tests/test_performance.py
|
||||
@@ -20,7 +20,7 @@ except ImportError:
|
||||
|
||||
# The comparison of Quantities in test_memory_usage
|
||||
# fail with older versions of numpy
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
NPY_VERSION_CHECK = LooseVersion(np.version.version) >= "1.13"
|
||||
|
||||
diff --git a/spectral_cube/tests/test_regrid.py b/spectral_cube/tests/test_regrid.py
|
||||
index 496ddd5..5b1fec7 100644
|
||||
--- a/spectral_cube/tests/test_regrid.py
|
||||
+++ b/spectral_cube/tests/test_regrid.py
|
||||
@@ -18,7 +18,7 @@ except ImportError:
|
||||
|
||||
# The comparison of Quantities in test_memory_usage
|
||||
# fail with older versions of numpy
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
NPY_VERSION_CHECK = LooseVersion(np.version.version) >= "1.13"
|
||||
|
||||
diff --git a/spectral_cube/tests/test_spectral_cube.py b/spectral_cube/tests/test_spectral_cube.py
|
||||
index 9ebeb7d..93e5647 100644
|
||||
--- a/spectral_cube/tests/test_spectral_cube.py
|
||||
+++ b/spectral_cube/tests/test_spectral_cube.py
|
||||
@@ -6,7 +6,7 @@ import operator
|
||||
import itertools
|
||||
import warnings
|
||||
import mmap
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
diff --git a/spectral_cube/tests/test_subcubes.py b/spectral_cube/tests/test_subcubes.py
|
||||
index 6f74f68..217c324 100644
|
||||
--- a/spectral_cube/tests/test_subcubes.py
|
||||
+++ b/spectral_cube/tests/test_subcubes.py
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import print_function, absolute_import, division
|
||||
|
||||
import pytest
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
from astropy import units as u
|
||||
from astropy import wcs
|
||||
diff --git a/spectral_cube/tests/test_visualization.py b/spectral_cube/tests/test_visualization.py
|
||||
index 85ea038..0ac8d58 100644
|
||||
--- a/spectral_cube/tests/test_visualization.py
|
||||
+++ b/spectral_cube/tests/test_visualization.py
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import print_function, absolute_import, division
|
||||
|
||||
import pytest
|
||||
-from distutils.version import LooseVersion
|
||||
+from looseversion import LooseVersion
|
||||
|
||||
from .test_spectral_cube import cube_and_raw
|
||||
|
||||
Reference in New Issue
Block a user