Compare commits

..

No commits in common. "rawhide" and "f41" have entirely different histories.

9 changed files with 214 additions and 7 deletions

1
.gitignore vendored
View file

@ -10,4 +10,3 @@
/APLpy-1.1.1.tar.gz
/APLpy-2.0.tar.gz
/APLpy-2.0.3.tar.gz
/aplpy-2.2.0.tar.gz

View file

@ -0,0 +1,59 @@
From c9049261b3724821f4d309d85fe73cabcc04d890 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 29 Apr 2024 18:46:08 -0400
Subject: [PATCH] Fix cmap handling with Matplotlib 3.9
The `matplotlib.cm.get_cmap` API was deprecated in 3.7, and removed in
3.9, but `matplotlib.pyplot.get_cmap` remains available.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
aplpy/core.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/aplpy/core.py b/aplpy/core.py
index c946e97..8b87b50 100644
--- a/aplpy/core.py
+++ b/aplpy/core.py
@@ -664,7 +664,7 @@ class FITSFigure(Layers, Regions):
max_auto = vmax is None
# The set of available functions
- cmap = plt.cm.get_cmap(cmap)
+ cmap = plt.get_cmap(cmap)
if min_auto or max_auto:
@@ -915,9 +915,9 @@ class FITSFigure(Layers, Regions):
self.remove_layer(layer, raise_exception=False)
if cmap:
- cmap = plt.cm.get_cmap(cmap)
+ cmap = plt.get_cmap(cmap)
elif not colors:
- cmap = plt.cm.get_cmap('viridis')
+ cmap = plt.get_cmap('viridis')
if data is not None:
data_contour, header_contour, wcs_contour, wcsaxes_slices = \
@@ -1844,7 +1844,7 @@ class FITSFigure(Layers, Regions):
self._figure.apl_grayscale_invert_default = False
self._figure.apl_colorscale_cmap_default = 'viridis'
if self.image:
- self.image.set_cmap(cmap=plt.cm.get_cmap('viridis'))
+ self.image.set_cmap(cmap=plt.get_cmap('viridis'))
elif theme == 'publication':
self.frame.set_color('black')
self.frame.set_linewidth(1.0)
@@ -1853,7 +1853,7 @@ class FITSFigure(Layers, Regions):
self._figure.apl_grayscale_invert_default = True
self._figure.apl_colorscale_cmap_default = 'gist_heat'
if self.image:
- self.image.set_cmap(cmap=plt.cm.get_cmap('gist_yarg'))
+ self.image.set_cmap(cmap=plt.get_cmap('gist_yarg'))
def world2pixel(self, xw, yw, wcs=None):
"""
--
2.44.0

View file

@ -1,14 +1,25 @@
%global srcname aplpy
%global srcname APLpy
Name: APLpy
Version: 2.2.0
Version: 2.0.3
Release: %autorelease
Summary: The Astronomical Plotting Library in Python
# SPDX license is MIT
License: MIT
URL: http://aplpy.github.com
Source0: %{pypi_source}
Patch0: aplpy-moved-function.patch
# https://github.com/aplpy/aplpy/pull/469
Patch1: aplpy-wraps-from-functools.patch
# Workaround for python 3.12 change of imp module removal
Patch2: astropy_helpers-py312-imp-deprecation.patch
# related:
# https://github.com/astropy/astropy/pull/12633
# astropy 5.1 removes astropy.tests.plugins.display and so on
Patch3: aplpy-astropy-5.1-tests-plugins-removal.patch
Patch4: aplpy-deps.patch
# https://github.com/aplpy/aplpy/pull/500
Patch5: 0001-Fix-cmap-handling-with-Matplotlib-3.9.patch
BuildArch: noarch
BuildRequires: python3-devel
@ -23,7 +34,7 @@ PDF, PS, PNG, and SVG.
%package -n python3-APLpy
Summary: The Astronomical Plotting Library in Python
%{?python_provide:%python_provide python3-%{srcname}}
BuildRequires: python3dist(setuptools)
BuildRequires: python3-setuptools
%description -n python3-APLpy
APLpy (the Astronomical Plotting Library in Python) is a Python module aimed at
@ -49,8 +60,9 @@ PDF, PS, PNG, and SVG.
%check
%pyproject_check_import -t
%files -n python3-APLpy -f %{pyproject_files}
%doc CHANGES.md CITATION README.rst
%doc CHANGES.rst README.rst
%changelog
%autochangelog

View file

@ -0,0 +1,36 @@
--- APLpy-2.0.3/aplpy/conftest.py.old 2019-02-19 20:20:49.000000000 +0900
+++ APLpy-2.0.3/aplpy/conftest.py 2023-07-13 00:18:27.256633975 +0900
@@ -13,14 +13,19 @@
# With older versions of Astropy, we actually need to import the pytest
# plugins themselves in order to make them discoverable by pytest.
from astropy.tests.pytest_plugins import * # noqa
-else:
+elif astropy_version < '5.1':
# As of Astropy 3.0, the pytest plugins provided by Astropy are
# automatically made available when Astropy is installed. This means it's
# not necessary to import them here, but we still need to import global
# variables that are used for configuration.
from astropy.tests.plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
+else:
+ from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
-from astropy.tests.helper import enable_deprecations_as_exceptions
+try:
+ from astropy.tests.helper import enable_deprecations_as_exceptions
+except:
+ pass
# Uncomment the following line to treat all DeprecationWarnings as
# exceptions. For Astropy v2.0 or later, there are 2 additional keywords,
@@ -32,7 +37,10 @@
# To ignore some specific deprecation warning messages for Python version
# MAJOR.MINOR or later, add:
# warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']}
-enable_deprecations_as_exceptions()
+try:
+ enable_deprecations_as_exceptions()
+except:
+ pass
# Uncomment and customize the following lines to add/remove entries from
# the list of packages for which version numbers are displayed when running

24
aplpy-deps.patch Normal file
View file

@ -0,0 +1,24 @@
diff -ur a/aplpy/_astropy_init.py b/aplpy/_astropy_init.py
--- a/aplpy/_astropy_init.py 2024-06-22 19:31:12.726171055 +0200
+++ b/aplpy/_astropy_init.py 2024-06-22 19:49:02.749642003 +0200
@@ -112,7 +112,7 @@
import os
from warnings import warn
from astropy.config.configuration import (
- update_default_config,
+# update_default_config,
ConfigurationDefaultMissingError,
ConfigurationDefaultMissingWarning)
diff -ur a/setup.cfg b/setup.cfg
--- a/setup.cfg 2024-06-22 19:31:12.726171055 +0200
+++ b/setup.cfg 2024-06-22 19:31:51.507812458 +0200
@@ -28,7 +28,7 @@
url = http://aplpy.github.io
edit_on_github = False
github_project = aplpy/aplpy
-install_requires = numpy, astropy>=3.1, matplotlib>=2.0, reproject>=0.4, pyregion>=2.0, pillow>=4.0, pyavm>=0.9.4, scikit-image>=0.14, shapely>=1.6
+install_requires = numpy, astropy>=3.1, matplotlib>=2.0, reproject>=0.4, pillow>=4.0, scikit-image>=0.14, shapely>=1.6
# version should be PEP440 compatible (https://www.python.org/dev/peps/pep-0440/)
version = 2.0.3

View file

@ -0,0 +1,12 @@
diff -ur APLpy-2.0.3/aplpy/core.py APLpy-2.0.3.astr/aplpy/core.py
--- APLpy-2.0.3/aplpy/core.py 2019-02-19 12:42:15.000000000 +0100
+++ APLpy-2.0.3.astr/aplpy/core.py 2022-02-17 01:26:12.893457814 +0100
@@ -17,7 +17,7 @@
from astropy.wcs import WCS
from astropy.wcs.utils import proj_plane_pixel_scales
from astropy.io import fits
-from astropy.nddata.utils import block_reduce
+from astropy.nddata import block_reduce
from astropy.visualization import AsymmetricPercentileInterval
from astropy.visualization.wcsaxes import WCSAxes, WCSAxesSubplot
from astropy.coordinates import ICRS

View file

@ -0,0 +1,23 @@
From b31b4f32d01b7f38d417fd42be5f5d52b18be575 Mon Sep 17 00:00:00 2001
From: Ole Streicher <olebole@debian.org>
Date: Sat, 29 Jan 2022 20:14:56 +0100
Subject: [PATCH] Get wraps from functools instead of astropy
This fixes compatibility with astropy 5.0.1
---
aplpy/decorators.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aplpy/decorators.py b/aplpy/decorators.py
index f29056db..3c22f87b 100644
--- a/aplpy/decorators.py
+++ b/aplpy/decorators.py
@@ -2,7 +2,7 @@
import threading
-from astropy.utils.decorators import wraps
+from functools import wraps
mydata = threading.local()

View file

@ -0,0 +1,42 @@
--- APLpy-2.0.3/astropy_helpers/astropy_helpers/utils.py.orig 2018-12-12 20:36:12.000000000 +0900
+++ APLpy-2.0.3/astropy_helpers/astropy_helpers/utils.py 2023-07-12 23:41:04.228876992 +0900
@@ -3,7 +3,6 @@
import contextlib
import functools
-import imp
import inspect
import os
import sys
@@ -60,9 +59,9 @@
import builtins
if hasattr(builtins, '__NUMPY_SETUP__'):
del builtins.__NUMPY_SETUP__
- import imp
+ import importlib
import numpy
- imp.reload(numpy)
+ importlib.reload(numpy)
try:
numpy_include = numpy.get_include()
--- APLpy-2.0.3/astropy_helpers/astropy_helpers/version_helpers.py.orig 2023-07-12 23:43:28.923036099 +0900
+++ APLpy-2.0.3/astropy_helpers/astropy_helpers/version_helpers.py 2023-07-12 23:43:41.692050140 +0900
@@ -21,7 +21,7 @@
from __future__ import division
import datetime
-import imp
+import importlib
import os
import pkgutil
import sys
@@ -278,7 +278,7 @@
invalidate_caches()
if version_module:
- imp.reload(version_module)
+ importlib.reload(version_module)
def get_pkg_version_module(packagename, fromlist=None):

View file

@ -1 +1 @@
SHA512 (aplpy-2.2.0.tar.gz) = efb5af12da698861c596d3935580ca5dbe168779382702064ed8c728f9a56e82c06eb6ee101a0c66afaf35e7e55c7a9f53fa07aba379b91e13f2fa4ddce0ec98
SHA512 (APLpy-2.0.3.tar.gz) = ad9e2079bc5cc3d60c88b49d11ef452d674a2223753d3c4b39db55bdb7b0ec598cff1edcd27d0539c3a3127b4c3bc7e0d57a3723841850fd49ed2206db5893d2