SHA256
1
0
forked from pool/plplot

Compare commits

4 Commits

4 changed files with 300 additions and 1 deletions

View File

@@ -0,0 +1,239 @@
From 0bf0fe35c044326c6720e14c7ab3df8c55868f2a Mon Sep 17 00:00:00 2001
From: Jan Kohnert <jan@jan-kohnert.de>
Date: Sun, 14 Jul 2024 14:46:48 +0200
Subject: [PATCH] Patch to make PLplot work with Numpy-2.0.0.
---
.gitignore | 4 ++++
bindings/python/Pltk_init.i | 2 +-
bindings/python/plplotc.i | 2 +-
cmake/modules/python.cmake | 12 +++++-------
examples/python/x08.py | 6 +++---
examples/python/x21.py | 8 ++++----
examples/python/x33.py | 24 ++++++++++++------------
7 files changed, 30 insertions(+), 28 deletions(-)
Index: plplot-5.15.0/.gitignore
===================================================================
--- plplot-5.15.0.orig/.gitignore
+++ plplot-5.15.0/.gitignore
@@ -29,3 +29,7 @@ tmp/
# Ignore Mac OS X generated file/directory attribute storage files
\.DS_Store
\._\.DS_Store
+
+# Ignore CLion config/buils directory
+.idea/
+cmake-build-debug/
Index: plplot-5.15.0/bindings/python/Pltk_init.i
===================================================================
--- plplot-5.15.0.orig/bindings/python/Pltk_init.i
+++ plplot-5.15.0/bindings/python/Pltk_init.i
@@ -24,7 +24,7 @@
%{
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <Python.h>
-#include <arrayobject.h>
+#include <numpy/arrayobject.h>
#include "plplot.h"
#include "plplotP.h"
Index: plplot-5.15.0/bindings/python/plplotc.i
===================================================================
--- plplot-5.15.0.orig/bindings/python/plplotc.i
+++ plplot-5.15.0/bindings/python/plplotc.i
@@ -46,7 +46,7 @@
%{
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
-#include <arrayobject.h>
+#include <numpy/arrayobject.h>
#include "plplot.h"
#include "plplotP.h"
Index: plplot-5.15.0/cmake/modules/python.cmake
===================================================================
--- plplot-5.15.0.orig/cmake/modules/python.cmake
+++ plplot-5.15.0/cmake/modules/python.cmake
@@ -107,20 +107,18 @@ if(ENABLE_python)
execute_process(
COMMAND
${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_include())"
- OUTPUT_VARIABLE NUMPY_INCLUDE_PATH_PARENT
+ OUTPUT_VARIABLE NUMPY_GET_INCLUDE
RESULT_VARIABLE NUMPY_ERR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NUMPY_ERR)
set(NUMPY_INCLUDE_PATH)
else(NUMPY_ERR)
- # We use the full path name (including numpy on the end), but
- # Double-check that all is well with that choice.
find_path(
- NUMPY_INCLUDE_PATH
- arrayobject.h
- ${NUMPY_INCLUDE_PATH_PARENT}/numpy
- )
+ NUMPY_INCLUDE_PATH
+ numpy/arrayobject.h
+ ${NUMPY_GET_INCLUDE}
+ )
endif(NUMPY_ERR)
endif(NOT NUMPY_INCLUDE_PATH)
Index: plplot-5.15.0/examples/python/x08.py
===================================================================
--- plplot-5.15.0.orig/examples/python/x08.py
+++ plplot-5.15.0/examples/python/x08.py
@@ -104,13 +104,13 @@ def main(w):
y0 = 0.5*(YPTS - 1)
b = 0.7*y0
for i in range(indexxmin, indexxmax):
- square_root = sqrt(1. - min(1., ((double(i) - x0)/a)**2))
+ square_root = sqrt(1. - min([1., ((double(i) - x0)/a**2)]))
# Add 0.5 to find nearest integer and therefore preserve symmetry
# with regard to lower and upper bound of y range.
- indexymin[i] = max(0, int(0.5 + y0 - b*square_root))
+ indexymin[i] = max([0, int(0.5 + y0 - b*square_root)])
# indexymax calculated with the convention that it is 1
# greater than highest valid index.
- indexymax[i] = min(YPTS, 1 + int(0.5 + y0 + b*square_root))
+ indexymax[i] = min([YPTS, 1 + int(0.5 + y0 + b*square_root)])
zlimited[i][indexymin[i]:indexymax[i]] = z[i][indexymin[i]:indexymax[i]]
w.pllightsource(1., 1., 1.)
Index: plplot-5.15.0/examples/python/x21.py
===================================================================
--- plplot-5.15.0.orig/examples/python/x21.py
+++ plplot-5.15.0/examples/python/x21.py
@@ -131,8 +131,8 @@ def main(w):
if isnan(zg[i][j]):
zg[i][j] = 0.0
dist = 0.0
- for ii in range(max(i-1,0),min(i+2,xp)):
- for jj in range(max(j-1,0),min(j+2,yp)):
+ for ii in range(max([i-1,0]),min([i+2,xp])):
+ for jj in range(max([j-1,0]),min([j+2,yp])):
if (not isnan(zg[ii][jj])):
d = abs(ii-i) + abs(jj-j)
if (d != 1.0) :
@@ -148,8 +148,8 @@ def main(w):
lzM = max(zg.flat)
lzm = min(zg.flat)
- lzm = min(lzm,zmin)
- lzM = max(lzM,zmax)
+ lzm = min([lzm,zmin])
+ lzM = max([lzM,zmax])
lzm = lzm - 0.01
lzM = lzM + 0.01
Index: plplot-5.15.0/examples/python/x33.py
===================================================================
--- plplot-5.15.0.orig/examples/python/x33.py
+++ plplot-5.15.0/examples/python/x33.py
@@ -435,7 +435,7 @@ def main(w):
nlegend += 1
else:
nlegend -= 1
- nlegend = max(1, nlegend)
+ nlegend = max([1, nlegend])
opt_array = zeros(nlegend, "int")
text_colors = zeros(nlegend, "int")
text = zeros(nlegend, "S200")
@@ -469,12 +469,12 @@ def main(w):
w.plsfont(w.PL_FCI_MONO, -1, -1)
w.plscol0a( 15, 32, 32, 32, 0.70 )
- nrow = min(3, nlegend)
+ nrow = min([3, nlegend])
ncolumn = 0
(legend_width, legend_height) = \
w.pllegend( opt, position, x, y,
- 0.025, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5,
+ 0.025, 15, 1, 1, int(nrow), ncolumn, opt_array, 1.0, 1.0, 1.5,
1., text_colors, text,
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
@@ -572,7 +572,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up symbol legend entries with various symbols.
for i in range(nlegend):
@@ -595,7 +595,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up symbol legend entries with various numbers of symbols.
for i in range(nlegend):
@@ -617,7 +617,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up box legend entries with various colours.
for i in range(nlegend):
@@ -642,7 +642,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up box legend entries with various patterns.
for i in range(nlegend):
@@ -664,7 +664,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up box legend entries with various box pattern line widths.
for i in range(nlegend):
@@ -686,7 +686,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up line legend entries with various colours.
for i in range(nlegend):
@@ -710,7 +710,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up line legend entries with various styles
for i in range(nlegend):
@@ -731,7 +731,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Set up line legend entries with various widths.
for i in range(nlegend):
@@ -752,7 +752,7 @@ def main(w):
box_colors, box_patterns, box_scales, box_line_widths,
line_colors, line_styles, line_widths,
symbol_colors, symbol_scales, symbol_numbers, symbols )
- max_height = max(max_height, legend_height)
+ max_height = max([max_height, legend_height])
# Color bar examples
values_small = [ -1.0e-20, 1.0e-20 ]

View File

@@ -0,0 +1,28 @@
--- plplot-5.15.0/examples/java/CMakeLists.txt 2024-09-26 18:42:42.679062899 +0200
+++ plplot-5.15.0/examples/java/CMakeLists.txt 2024-09-26 19:09:37.234642501 +0200
@@ -60,6 +60,15 @@
"33"
)
+if (DEFINED ENV{SOURCE_DATE_EPOCH})
+ execute_process(
+ COMMAND "date" "-u" "-d" "@$ENV{SOURCE_DATE_EPOCH}" "+%Y-%m-%dT%H:%M:%SZ"
+ OUTPUT_VARIABLE COMPILATION_DATE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+else ()
+ string (TIMESTAMP COMPILATION_DATE "+%Y-%m-%dT%H:%M:%SZ")
+endif ()
+
if(CORE_BUILD)
set(java_SRCS)
foreach(STRING_INDEX ${java_STRING_INDICES})
@@ -133,7 +142,8 @@
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplot.jar
COMMAND ${CMAKE_Java_ARCHIVE}
- -cf ${CMAKE_CURRENT_BINARY_DIR}/plplot.jar -C ${CMAKE_BINARY_DIR}/bindings/java plplot/core -C ${CMAKE_CURRENT_BINARY_DIR} plplot/examples
+ --date=${COMPILATION_DATE} --create --file=${CMAKE_CURRENT_BINARY_DIR}/plplot.jar
+ -C ${CMAKE_BINARY_DIR}/bindings/java plplot/core -C ${CMAKE_CURRENT_BINARY_DIR} plplot/examples
DEPENDS ${java_CLASSES} ${java_CORE_CLASSES}
)

View File

@@ -1,3 +1,18 @@
-------------------------------------------------------------------
Thu Sep 26 17:17:45 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* plplot-reproducible-jar-mtime.patch
+ Use SOURCE_DATE_EPOCH for reproducible jar mtime
+ Applied if building with Java >= 17
-------------------------------------------------------------------
Sun Sep 15 22:27:50 UTC 2024 - Atri Bhattacharya <badshah400@gmail.com>
- Add plplot-numpy-2.0-compat.patch for compatibility with numpy
>= 2.0 (gh#PLplot/PLplot#10); patch taken from upstream PR and
updated to fix tests.
-------------------------------------------------------------------
Mon Apr 8 05:34:11 UTC 2024 - Atri Bhattacharya <badshah400@gmail.com>

View File

@@ -81,6 +81,10 @@ Patch5: support-python3-pythondemos.patch
Patch6: plplot-libharu-version-check.patch
# PATCH-FIX-UPSTREAM plplot-pkgconfig-includedir.patch badshah400@gmail.com -- Fix includedir in pkgconfig files
Patch7: plplot-pkgconfig-includedir.patch
# PATCH-FIX-UPSTREAM plplot-numpy-2.0-compat.patch gh#PLplot/PLplot#10 badshah400@gmail.com -- Make plplot compilation compatible with numpy >= 2.0
Patch8: plplot-numpy-2.0-compat.patch
# PATCH-FIX-SUSE
Patch9: plplot-reproducible-jar-mtime.patch
# List based on build_ada in gcc.spec
ExclusiveArch: %ix86 x86_64 ppc ppc64 ppc64le s390 s390x ia64 aarch64 riscv64
BuildRequires: cmake >= 3.13.2
@@ -1080,7 +1084,20 @@ This package provides the xwin driver for plotting using PLplot.
##########################################################################
%prep
%autosetup -p1
%setup
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%patch -P 8 -p1
# The "--date" option was added into jar in OpenJDK 17
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
%patch -P 9 -p1
%endif
%build
for file in NEWS README.release