Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Factory:Rebuild
plplot
plplot-numpy-2.0-compat.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File plplot-numpy-2.0-compat.patch of Package plplot
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 ]
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor