Accepting request 888258 from devel:languages:python:numeric

OBS-URL: https://build.opensuse.org/request/show/888258
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=8
This commit is contained in:
Dominique Leuenberger 2021-04-25 19:27:20 +00:00 committed by Git OBS Bridge
commit b40171e0be
3 changed files with 190 additions and 23 deletions

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Sat Apr 24 18:40:06 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Fix python3 flavor multibuild:
* Compile bundled libs for every flavor
* Fix bundled lib location configuration
* Use system fftw3
- Enable tests with matplotlib and astropy
- Add sherpa-mpl-3.4.patch for Matplotlib 3.4 gh#sherpa/sherpa#1125
-------------------------------------------------------------------
Wed Feb 17 00:07:40 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>

View File

@ -31,27 +31,28 @@ Patch1: reproducible.patch
Patch2: sherpa-fix-aarch64.patch
# PATCH-FIX-UPSTREAM sherpa-numpy-1.20.patch badshah400@gmail.com - Fix test errors with numpy 1.20 [https://github.com/sherpa/sherpa/pull/1092]
Patch3: sherpa-numpy-1.20.patch
# PATCH-FIX-UPSTREAM sherpa-mpl-3.4.patch -- https://github.com/sherpa/sherpa/pull/1125
Patch4: sherpa-mpl-3.4.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy-devel}
BuildRequires: %{python_module setuptools}
BuildRequires: bison
BuildRequires: fdupes
BuildRequires: fftw3-devel
BuildRequires: flex
BuildRequires: gcc-c++
BuildRequires: gcc-fortran
BuildRequires: python-rpm-macros
Requires: python-numpy
Requires: python-six
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires(postun):update-alternatives
ExcludeArch: %{ix86}
# SECTION test requirements
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest >= 3.3}
BuildRequires: %{python_module pytest-xvfb}
BuildRequires: %{python_module six}
BuildRequires: xauth
BuildRequires: xorg-x11-server
# Highly recommended by upstream when building from source https://sherpa.readthedocs.io/en/latest/install.html#building-from-source
BuildRequires: %{python_module astropy}
BuildRequires: %{python_module matplotlib}
# /SECTION
%python_subpackages
@ -63,37 +64,40 @@ data, using a variety of statistics and optimization methods.
%prep
%setup -q -n sherpa-%{version}
%autopatch -p1
sed -i 's|#stk-location|stk-location|' setup.cfg
sed -i 's|#group-location|group-location|' setup.cfg
sed -i "s|#fftw=local|fftw=local|" setup.cfg
sed -i "s|#fftw-include[-_]dirs.*$|fftw-include-dirs=%{_includedir}|" setup.cfg
sed -i "s|#fftw-lib-dirs.*$|fftw-lib-dirs=%{_libdir}|" setup.cfg
sed -i "s|#fftw-libraries|fftw-libraries|" setup.cfg
sed -i "s|/lib/|/%{_lib}/|" helpers/sherpa_config.py
%build
%{python_expand sed -i 's|stk-location=.*|stk-location=build/%{_lib}/python%{$python_version}/site-packages/stk.so|' setup.cfg
sed -i 's|group-location=.*|group-location=build/%{_lib}/python%{$python_version}/site-packages/group.so|' setup.cfg
%{$python_build}
cp -r extern extern0
%{python_expand %{$python_build}
rm -r extern
cp -r extern0 extern
}
%install
%{python_expand sed -i 's|stk-location=.*|stk-location=build/%{_lib}/python%{$python_version}/site-packages/stk.so|' setup.cfg
sed -i 's|group-location=.*|group-location=build/%{_lib}/python%{$python_version}/site-packages/group.so|' setup.cfg
%{$python_install}
}
%python_install
%python_clone -a %{buildroot}%{_bindir}/sherpa_test
%python_clone -a %{buildroot}%{_bindir}/sherpa_smoke
%python_expand %fdupes %{buildroot}%{$python_sitearch}
# REMOVE HASHBANGS FROM NON-EXEC FILES
%{python_expand sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/ncoresde.py
%{python_expand # REMOVE HASHBANGS FROM NON-EXEC FILES
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/ncoresde.py
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/ncoresnm.py
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/opt.py
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/utils/akima.py
}
%check
export PYTHONDONTWRITEBYTECODE=x
# avoid conftest import mismatch
mv sherpa sherpa_temp
%python_expand ls -l %{buildroot}%{$python_sitearch}/sherpa/utils/
ls -l *build*/*/*/
%pytest_arch %{buildroot}%{$python_sitearch}/sherpa/
mv sherpa_temp sherpa
# astropy 4.2 fits header warning
donttest+="test_load_case_3"
%pytest_arch --pyargs sherpa -k "not ($donttest)"
%post
%python_install_alternative sherpa_smoke
@ -108,6 +112,9 @@ mv sherpa_temp sherpa
%license LICENSE
%python_alternative %{_bindir}/sherpa_test
%python_alternative %{_bindir}/sherpa_smoke
%{python_sitearch}/*
%{python_sitearch}/sherpa
%{python_sitearch}/sherpa-%{version}*-info
%{python_sitearch}/stk.so
%{python_sitearch}/group.so
%changelog

150
sherpa-mpl-3.4.patch Normal file
View File

@ -0,0 +1,150 @@
From 0187ded7223bbaded8022a28561182846b17ceb3 Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
Date: Tue, 13 Apr 2021 16:29:45 -0400
Subject: [PATCH 1/2] matlpotlib 3.4 has removed drawstyle from axes.errorbar
The drawstyle argument has now been removed from some commands -
this appears to just be the axes.errorbar function - in matplotlib
version 3.4.
---
sherpa/plot/pylab_backend.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Index: sherpa-4.13.0/sherpa/plot/pylab_backend.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/plot/pylab_backend.py
+++ sherpa-4.13.0/sherpa/plot/pylab_backend.py
@@ -1,6 +1,6 @@
#
-# Copyright (C) 2010, 2015, 2017, 2019, 2020
-# Smithsonian Astrophysical Observatory
+# Copyright (C) 2010, 2015, 2017, 2019, 2020, 2021
+# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
@@ -316,7 +316,6 @@ def histo(xlo, xhi, y, yerr=None, title=
color=color,
alpha=alpha,
linestyle='',
- drawstyle=drawstyle,
marker=marker,
markersize=markersize,
markerfacecolor=markerfacecolor,
@@ -446,7 +445,6 @@ def plot(x, y, yerr=None, xerr=None, tit
objs = axes.errorbar(x, y, yerr, xerr,
color=color,
linestyle=linestyle,
- drawstyle=drawstyle,
marker=marker,
markersize=markersize,
markerfacecolor=markerfacecolor,
Index: sherpa-4.13.0/sherpa/astro/ui/tests/test_astro_ui_plot.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/astro/ui/tests/test_astro_ui_plot.py
+++ sherpa-4.13.0/sherpa/astro/ui/tests/test_astro_ui_plot.py
@@ -1,5 +1,6 @@
#
-# Copyright (C) 2019, 2020 Smithsonian Astrophysical Observatory
+# Copyright (C) 2019, 2020, 2021
+# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
@@ -1168,7 +1169,8 @@ def test_img_contour_function_kwarg(clea
for i, ax in enumerate(axes, 1):
- assert ax.get_geometry() == (2, 2, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 2, w, w)
assert ax.get_xscale() == 'linear'
assert ax.get_yscale() == 'linear'
Index: sherpa-4.13.0/sherpa/ui/tests/test_ui_plot.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/ui/tests/test_ui_plot.py
+++ sherpa-4.13.0/sherpa/ui/tests/test_ui_plot.py
@@ -1,5 +1,6 @@
#
-# Copyright (C) 2019, 2020 Smithsonian Astrophysical Observatory
+# Copyright (C) 2019, 2020, 2021
+# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
@@ -1113,7 +1114,7 @@ def test_plot_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == ''
assert ax.xaxis.get_label().get_text() == 'x'
assert ax.yaxis.get_label().get_text() == 'y'
@@ -1127,7 +1128,7 @@ def test_plot_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == 'Model'
assert ax.xaxis.get_label().get_text() == 'x'
assert ax.yaxis.get_label().get_text() == 'y'
@@ -1179,7 +1180,8 @@ def test_plot_multiple(session):
'Data / Model']),
1):
- assert ax.get_geometry() == (2, 3, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 3, w, w)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x'
assert ax.yaxis.get_label().get_text() == ylabel
@@ -1226,7 +1228,7 @@ def test_contour_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == ''
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1240,7 +1242,7 @@ def test_contour_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == 'Model'
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1287,7 +1289,8 @@ def test_contour_multiple(session):
'Ratio of Data to Model']),
1):
- assert ax.get_geometry() == (2, 3, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 3, w, w)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1343,7 +1346,8 @@ def test_contour_xxx(plotfunc, title, pc
['', 'Residuals']),
1):
- assert ax.get_geometry() == (2, 1, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 1, w, w)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1352,7 +1356,7 @@ def test_contour_xxx(plotfunc, title, pc
assert len(fig.axes) == 1
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'