From ff8eaf749b83a9842b5e424d9973c1dc16e1db42 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Thu, 16 Feb 2023 15:19:17 +0000 Subject: [PATCH 1/7] Remove support for Numeric (as opposed to NumPy) from Kiva. --- kiva/agg/src/affine_matrix.i | 4 -- kiva/agg/src/graphics_context.i | 2 - kiva/agg/src/gtk1/agg_bmp.cpp | 8 --- kiva/agg/src/numeric.i | 15 +--- kiva/agg/src/numeric_ext.i | 120 -------------------------------- kiva/agg/src/readme.txt | 1 - kiva/agg/src/x11/agg_bmp.cpp | 8 --- kiva/quartz/numpy.pxi | 2 +- 8 files changed, 3 insertions(+), 157 deletions(-) delete mode 100644 kiva/agg/src/numeric_ext.i diff --git a/kiva/agg/src/affine_matrix.i b/kiva/agg/src/affine_matrix.i index 12dd03355..2caa2aea5 100644 --- a/kiva/agg/src/affine_matrix.i +++ b/kiva/agg/src/affine_matrix.i @@ -54,11 +54,7 @@ %{ -#ifdef NUMPY #include "numpy/arrayobject.h" -#else -#include "Numeric/arrayobject.h" -#endif #include "agg_trans_affine.h" // These factories mimic the functionality of like-named classes in agg. diff --git a/kiva/agg/src/graphics_context.i b/kiva/agg/src/graphics_context.i index da4ba7cae..ac58a5dbc 100644 --- a/kiva/agg/src/graphics_context.i +++ b/kiva/agg/src/graphics_context.i @@ -58,8 +58,6 @@ agg24::rgba _clear_color = agg24::rgba(1,1,1,1); %} -%include "numeric_ext.i" - %typemap(out) PyObject* { $result = $1; diff --git a/kiva/agg/src/gtk1/agg_bmp.cpp b/kiva/agg/src/gtk1/agg_bmp.cpp index 7cce5e53e..42bfe10d5 100644 --- a/kiva/agg/src/gtk1/agg_bmp.cpp +++ b/kiva/agg/src/gtk1/agg_bmp.cpp @@ -17,15 +17,7 @@ #include "agg_pixfmt_rgba.h" #include "agg_color_rgba.h" -#ifdef NUMPY #include "numpy/arrayobject.h" -# ifndef PyArray_SBYTE -# include "numpy/noprefix.h" -# include "numpy/oldnumeric.h" -# include "numpy/old_defines.h" -# endif -#else -#include "Numeric/arrayobject.h" #define PyArray_UBYTELTR 'b' #endif diff --git a/kiva/agg/src/numeric.i b/kiva/agg/src/numeric.i index cf584d114..ab701fd3a 100644 --- a/kiva/agg/src/numeric.i +++ b/kiva/agg/src/numeric.i @@ -30,14 +30,7 @@ Here are the typemap helper functions for numeric arrays: */ %{ -#ifdef NUMPY #include "numpy/arrayobject.h" -# ifndef PyArray_SBYTE -# include "numpy/oldnumeric.h" -# include "numpy/old_defines.h" -# endif -#else -#include "Numeric/arrayobject.h" #define PyArray_UBYTELTR 'b' #endif @@ -85,8 +78,8 @@ int type_match(int actual_type, int desired_type) // Make sure input has correct numeric type. Allow character and byte to // match also allow int and long to match. if ( actual_type != desired_type && - !(desired_type == PyArray_CHAR && actual_type == PyArray_SBYTE) && - !(desired_type == PyArray_SBYTE && actual_type == PyArray_CHAR) && + !(desired_type == PyArray_CHAR && actual_type == PyArray_BYTE) && + !(desired_type == PyArray_BYTE && actual_type == PyArray_CHAR) && !(desired_type == PyArray_INT && actual_type == PyArray_LONG) && !(desired_type == PyArray_LONG && actual_type == PyArray_INT)) { @@ -369,9 +362,5 @@ def numpy_check(obj, typecode, %init %{ Py_Initialize(); import_array(); -#ifdef NUMPY PyImport_ImportModule("numpy"); -#else - PyImport_ImportModule("Numeric"); -#endif %} diff --git a/kiva/agg/src/numeric_ext.i b/kiva/agg/src/numeric_ext.i deleted file mode 100644 index 45c9363e0..000000000 --- a/kiva/agg/src/numeric_ext.i +++ /dev/null @@ -1,120 +0,0 @@ -// (C) Copyright 2005-2022 Enthought, Inc., Austin, TX -// All rights reserved. -// -// This software is provided without warranty under the terms of the BSD -// license included in LICENSE.txt and may be redistributed only under -// the conditions described in the aforementioned license. The license -// is also available online at http://www.enthought.com/licenses/BSD.txt -// -// Thanks for using Enthought open source! -%include "numeric.i" - -%{ -#ifndef NUMPY -#include "Numeric/arrayobject.h" - -/* This is the basic array allocation function. */ -PyObject *PyArray_FromDimsAndStridesAndDataAndDescr(int nd, int *d, int* st, - PyArray_Descr *descr, - char *data) -{ - PyArrayObject *self; - int i,sd; - int *dimensions, *strides; - int flags= CONTIGUOUS | OWN_DIMENSIONS | OWN_STRIDES; - - dimensions = strides = NULL; - - if (nd < 0) - { - PyErr_SetString(PyExc_ValueError, - "number of dimensions must be >= 0"); - return NULL; - } - - if (nd > 0) - { - if ((dimensions = (int *)malloc(nd*sizeof(int))) == NULL) { - PyErr_SetString(PyExc_MemoryError, "can't allocate memory for array"); - goto fail; - } - if ((strides = (int *)malloc(nd*sizeof(int))) == NULL) { - PyErr_SetString(PyExc_MemoryError, "can't allocate memory for array"); - goto fail; - } - memmove(dimensions, d, sizeof(int)*nd); - memmove(strides, st, sizeof(int)*nd); - } - - // This test for continguity - sd = descr->elsize; - for(i=nd-1;i>=0;i--) - { - if (strides[i] <= 0) - { - PyErr_SetString(PyExc_ValueError, "strides must be positive"); - goto fail; - } - if (dimensions[i] <= 0) - { - /* only allow positive dimensions in this function */ - PyErr_SetString(PyExc_ValueError, "dimensions must be positive"); - goto fail; - } - if (strides[i] != sd) - { - flags &= !CONTIGUOUS; - } - /* - This may waste some space, but it seems to be - (unsuprisingly) unhealthy to allow strides that are - longer than sd. - */ - sd *= dimensions[i] ? dimensions[i] : 1; - } - - /* Make sure we're alligned on ints. */ - sd += sizeof(int) - sd%sizeof(int); - - if (data == NULL) - { - if ((data = (char *)malloc(sd)) == NULL) - { - PyErr_SetString(PyExc_MemoryError, "can't allocate memory for array"); - goto fail; - } - flags |= OWN_DATA; - } - - if((self = PyObject_NEW(PyArrayObject, &PyArray_Type)) == NULL) - goto fail; - if (flags & OWN_DATA) - memset(data, 0, sd); - - self->data=data; - self->dimensions = dimensions; - self->strides = strides; - self->nd=nd; - self->descr=descr; - self->base = (PyObject *)NULL; - self->flags = flags; - -/* Numeric versions prior to 23.3 do not have the weakreflist field. - By default we include it. You must explicitly define: - NUMERIC_DOES_NOT_HAVE_WEAKREF -*/ -#ifndef NUMERIC_DOES_NOT_HAVE_WEAKREF - self->weakreflist = (PyObject *)NULL; -#endif - - return (PyObject*)self; - - fail: - if (flags & OWN_DATA) free(data); - if (dimensions != NULL) free(dimensions); - if (strides != NULL) free(strides); - return NULL; -} -#endif - -%} \ No newline at end of file diff --git a/kiva/agg/src/readme.txt b/kiva/agg/src/readme.txt index b898a7958..da6d2198c 100644 --- a/kiva/agg/src/readme.txt +++ b/kiva/agg/src/readme.txt @@ -16,7 +16,6 @@ constants.i common enumerations and constants used by Agg and Kiva font_type.i wrapper for kiva_font_type.h graphic_context.i the main wrapper defining the Agg graphics context numeric.i typemaps and wrappers for Numeric array used in kiva -numeric_ext.i same as numeric.i rect.i wrapper for kiva_rect.h rgba.i RGBA color class and utility functions rgba_array.i maps Numeric 3- and 4-tuples into RGBA color instances diff --git a/kiva/agg/src/x11/agg_bmp.cpp b/kiva/agg/src/x11/agg_bmp.cpp index dc0513b5d..9aad81fd3 100644 --- a/kiva/agg/src/x11/agg_bmp.cpp +++ b/kiva/agg/src/x11/agg_bmp.cpp @@ -19,15 +19,7 @@ #include "bytesobject.h" -#ifdef NUMPY #include "numpy/arrayobject.h" -# ifndef PyArray_SBYTE -# include "numpy/noprefix.h" -# include "numpy/oldnumeric.h" -# include "numpy/old_defines.h" -# endif -#else -#include "Numeric/arrayobject.h" #define PyArray_UBYTELTR 'b' #endif diff --git a/kiva/quartz/numpy.pxi b/kiva/quartz/numpy.pxi index 8636a0df6..71aebc80c 100644 --- a/kiva/quartz/numpy.pxi +++ b/kiva/quartz/numpy.pxi @@ -12,7 +12,7 @@ cdef extern from "numpy/oldnumeric.h": ctypedef enum PyArray_TYPES: PyArray_CHAR PyArray_UBYTE - PyArray_SBYTE + PyArray_BYTE PyArray_SHORT PyArray_USHORT PyArray_INT From aa29602d1d9ac6b2091f4041cfdb99d452616c92 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Thu, 16 Feb 2023 16:09:11 +0000 Subject: [PATCH 2/7] Remove oldnumeric from quartz wrappers. --- kiva/quartz/numpy.pxi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiva/quartz/numpy.pxi b/kiva/quartz/numpy.pxi index 71aebc80c..21e32b3a4 100644 --- a/kiva/quartz/numpy.pxi +++ b/kiva/quartz/numpy.pxi @@ -8,7 +8,7 @@ # # Thanks for using Enthought open source! -cdef extern from "numpy/oldnumeric.h": +cdef extern from "numpy/arrayobject.h": ctypedef enum PyArray_TYPES: PyArray_CHAR PyArray_UBYTE From 405ce302389d6d20fdeaf8135d3e0e997a0d336e Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 18 Apr 2023 16:10:41 +0100 Subject: [PATCH 3/7] Remove custom Cython numpy interface. --- kiva/quartz/ABCGI.pyx | 36 +++++------ kiva/quartz/c_numpy.pxd | 134 ---------------------------------------- setup.py | 1 - 3 files changed, 18 insertions(+), 153 deletions(-) delete mode 100644 kiva/quartz/c_numpy.pxd diff --git a/kiva/quartz/ABCGI.pyx b/kiva/quartz/ABCGI.pyx index ffd85fa5b..91d715d78 100644 --- a/kiva/quartz/ABCGI.pyx +++ b/kiva/quartz/ABCGI.pyx @@ -14,7 +14,7 @@ include "CoreFoundation.pxi" include "CoreGraphics.pxi" include "CoreText.pxi" -cimport c_numpy +cimport numpy import os import warnings @@ -138,7 +138,7 @@ class URLPathStyle: hfs = kCFURLHFSPathStyle windows = kCFURLWindowsPathStyle -c_numpy.import_array() +numpy.import_array() import numpy from kiva import constants @@ -486,7 +486,7 @@ cdef class CGContext: cdef int n cdef int i - cdef c_numpy.ndarray apoints + cdef numpy.ndarray apoints cdef float x, y n = len(points) @@ -495,18 +495,18 @@ cdef class CGContext: if n < 2: return - apoints = (numpy.asarray(points, dtype=numpy.float32)) + apoints = (numpy.asarray(points, dtype=numpy.float32)) if apoints.nd != 2 or apoints.dimensions[1] != 2: msg = "must pass array of 2-D points" raise ValueError(msg) - x = (c_numpy.PyArray_GETPTR2(apoints, 0, 0))[0] - y = (c_numpy.PyArray_GETPTR2(apoints, 0, 1))[0] + x = (numpy.PyArray_GETPTR2(apoints, 0, 0))[0] + y = (numpy.PyArray_GETPTR2(apoints, 0, 1))[0] CGContextMoveToPoint(self.context, x, y) for i from 1 <= i < n: - x = (c_numpy.PyArray_GETPTR2(apoints, i, 0))[0] - y = (c_numpy.PyArray_GETPTR2(apoints, i, 1))[0] + x = (numpy.PyArray_GETPTR2(apoints, i, 0))[0] + y = (numpy.PyArray_GETPTR2(apoints, i, 1))[0] CGContextAddLineToPoint(self.context, x, y) def line_set(self, object starts, object ends): @@ -1057,10 +1057,10 @@ cdef class CGContext: cdef int i cdef int n - cdef c_numpy.ndarray apoints + cdef numpy.ndarray apoints cdef float x, y - apoints = (numpy.asarray(points, dtype=numpy.float32)) + apoints = (numpy.asarray(points, dtype=numpy.float32)) if apoints.nd != 2 or apoints.dimensions[1] != 2: msg = "must pass array of 2-D points" @@ -1070,8 +1070,8 @@ cdef class CGContext: n = len(points) for i from 0 <= i < n: - x = (c_numpy.PyArray_GETPTR2(apoints, i, 0))[0] - y = (c_numpy.PyArray_GETPTR2(apoints, i, 1))[0] + x = (numpy.PyArray_GETPTR2(apoints, i, 0))[0] + y = (numpy.PyArray_GETPTR2(apoints, i, 1))[0] CGContextSaveGState(self.context) CGContextTranslateCTM(self.context, x, y) CGContextAddPath(self.context, marker.path) @@ -1653,7 +1653,7 @@ cdef class CGBitmapContext(CGContext): cdef class CGImage: cdef CGImageRef image cdef void* data - cdef readonly c_numpy.ndarray bmp_array + cdef readonly numpy.ndarray bmp_array def __cinit__(self, *args, **kwds): self.image = NULL @@ -1734,9 +1734,9 @@ cdef class CGImage: alpha_info = kCGImageAlphaPremultipliedLast arr = numpy.zeros((height, width, lastdim), dtype=numpy.uint8) - self.bmp_array = arr + self.bmp_array = arr Py_INCREF(self.bmp_array) - self.data = c_numpy.PyArray_DATA(self.bmp_array) + self.data = numpy.PyArray_DATA(self.bmp_array) if grey_scale: alpha_info = kCGImageAlphaNone @@ -1769,7 +1769,7 @@ cdef class CGImage: cdef CGDataProviderRef provider provider = CGDataProviderCreateWithData( - NULL, self.data, c_numpy.PyArray_SIZE(self.bmp_array), NULL) + NULL, self.data, numpy.PyArray_SIZE(self.bmp_array), NULL) if provider == NULL: raise RuntimeError("could not make provider") @@ -1835,7 +1835,7 @@ cdef class CGImageFile(CGImage): dims[1] = width dims[2] = bits_per_pixel/bits_per_component - self.bmp_array = c_numpy.PyArray_SimpleNew(3, &(dims[0]), c_numpy.NPY_UBYTE) + self.bmp_array = numpy.PyArray_SimpleNew(3, &(dims[0]), numpy.NPY_UBYTE) data = self.bmp_array.data bs = img.tobytes() @@ -2598,7 +2598,7 @@ cdef class PiecewiseLinearColorFunction(ShadingFunction): cdef CGFloat* alpha def __init__(self, object stop_colors): - cdef c_numpy.ndarray stop_array + cdef numpy.ndarray stop_array cdef int i stop_colors = numpy.array(stop_colors).astype(numpy.float32) diff --git a/kiva/quartz/c_numpy.pxd b/kiva/quartz/c_numpy.pxd deleted file mode 100644 index 244fc2955..000000000 --- a/kiva/quartz/c_numpy.pxd +++ /dev/null @@ -1,134 +0,0 @@ -# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX -# All rights reserved. -# -# This software is provided without warranty under the terms of the BSD -# license included in LICENSE.txt and may be redistributed only under -# the conditions described in the aforementioned license. The license -# is also available online at http://www.enthought.com/licenses/BSD.txt -# -# Thanks for using Enthought open source! - -cdef extern from "numpy/arrayobject.h": - - cdef enum NPY_TYPES: - NPY_BOOL - NPY_BYTE - NPY_UBYTE - NPY_SHORT - NPY_USHORT - NPY_INT - NPY_UINT - NPY_LONG - NPY_ULONG - NPY_LONGLONG - NPY_ULONGLONG - NPY_FLOAT - NPY_DOUBLE - NPY_LONGDOUBLE - NPY_CFLOAT - NPY_CDOUBLE - NPY_CLONGDOUBLE - NPY_OBJECT - NPY_STRING - NPY_UNICODE - NPY_VOID - NPY_NTYPES - NPY_NOTYPE - - cdef enum requirements: - NPY_CONTIGUOUS - NPY_FORTRAN - NPY_OWNDATA - NPY_FORCECAST - NPY_ENSURECOPY - NPY_ENSUREARRAY - NPY_ELEMENTSTRIDES - NPY_ALIGNED - NPY_NOTSWAPPED - NPY_WRITEABLE - NPY_UPDATEIFCOPY - NPY_ARR_HAS_DESCR - - NPY_BEHAVED - NPY_BEHAVED_NS - NPY_CARRAY - NPY_CARRAY_RO - NPY_FARRAY - NPY_FARRAY_RO - NPY_DEFAULT - - NPY_IN_ARRAY - NPY_OUT_ARRAY - NPY_INOUT_ARRAY - NPY_IN_FARRAY - NPY_OUT_FARRAY - NPY_INOUT_FARRAY - - NPY_UPDATE_ALL - - cdef enum defines: - # Note: as of Pyrex 0.9.5, enums are type-checked more strictly, so this - # can't be used as an integer. - NPY_MAXDIMS - - ctypedef struct npy_cdouble: - double real - double imag - - ctypedef struct npy_cfloat: - double real - double imag - - ctypedef int npy_intp - - ctypedef extern class numpy.dtype [object PyArray_Descr]: - cdef int type_num, elsize, alignment - cdef char type, kind, byteorder, hasobject - cdef object fields, typeobj - - ctypedef extern class numpy.ndarray [object PyArrayObject]: - cdef char *data - cdef int nd - cdef npy_intp *dimensions - cdef npy_intp *strides - cdef object base - cdef dtype descr - cdef int flags - - ctypedef extern class numpy.flatiter [object PyArrayIterObject]: - cdef int nd_m1 - cdef npy_intp index, size - cdef ndarray ao - cdef char *dataptr - - ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]: - cdef int numiter - cdef npy_intp size, index - cdef int nd - # These next two should be arrays of [NPY_MAXITER], but that is - # difficult to cleanly specify in Pyrex. Fortunately, it doesn't matter. - cdef npy_intp *dimensions - cdef void **iters - - object PyArray_ZEROS(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran) - object PyArray_EMPTY(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran) - dtype PyArray_DescrFromTypeNum(NPY_TYPES type_num) - object PyArray_SimpleNew(int ndims, npy_intp* dims, NPY_TYPES type_num) - int PyArray_Check(object obj) - object PyArray_ContiguousFromAny(object obj, NPY_TYPES type, - int mindim, int maxdim) - npy_intp PyArray_SIZE(ndarray arr) - npy_intp PyArray_NBYTES(ndarray arr) - void *PyArray_DATA(ndarray arr) - object PyArray_FromAny(object obj, dtype newtype, int mindim, int maxdim, - int requirements, object context) - object PyArray_FROMANY(object obj, NPY_TYPES type_num, int min, - int max, int requirements) - object PyArray_NewFromDescr(object subtype, dtype newtype, int nd, - npy_intp* dims, npy_intp* strides, void* data, - int flags, object parent) - void* PyArray_GETPTR2(object obj, int i, int j) - - void PyArray_ITER_NEXT(flatiter it) - - void import_array() diff --git a/setup.py b/setup.py index de76a7fbe..9a6884a50 100644 --- a/setup.py +++ b/setup.py @@ -395,7 +395,6 @@ def macos_extensions(): 'kiva/quartz/ABCGI.pyx', 'kiva/quartz/Python.pxi', 'kiva/quartz/numpy.pxi', - 'kiva/quartz/c_numpy.pxd', 'kiva/quartz/CoreFoundation.pxi', 'kiva/quartz/CoreGraphics.pxi', 'kiva/quartz/CoreText.pxi', From 2b12cda8962e8502791a8dd712cf3eb410b3f337 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 18 Apr 2023 16:45:20 +0100 Subject: [PATCH 4/7] Remove more uses of numeric. --- kiva/agg/src/numeric.i | 1 - kiva/agg/src/readme.txt | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kiva/agg/src/numeric.i b/kiva/agg/src/numeric.i index ab701fd3a..13b1509e9 100644 --- a/kiva/agg/src/numeric.i +++ b/kiva/agg/src/numeric.i @@ -32,7 +32,6 @@ Here are the typemap helper functions for numeric arrays: %{ #include "numpy/arrayobject.h" #define PyArray_UBYTELTR 'b' -#endif #include diff --git a/kiva/agg/src/readme.txt b/kiva/agg/src/readme.txt index da6d2198c..ac8527d26 100644 --- a/kiva/agg/src/readme.txt +++ b/kiva/agg/src/readme.txt @@ -15,7 +15,11 @@ compiled_path.i wrapper for kiva_compiled_path.h constants.i common enumerations and constants used by Agg and Kiva font_type.i wrapper for kiva_font_type.h graphic_context.i the main wrapper defining the Agg graphics context +<<<<<<< HEAD numeric.i typemaps and wrappers for Numeric array used in kiva +======= +numeric.i typemaps and wrappers for Numpy array used in kiva +>>>>>>> 0579b063 (Remove more uses of numeric.) rect.i wrapper for kiva_rect.h rgba.i RGBA color class and utility functions rgba_array.i maps Numeric 3- and 4-tuples into RGBA color instances From 6cc846e96826aeb1f382a40465ab49230e2f9d33 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 2 May 2023 12:12:09 +0100 Subject: [PATCH 5/7] Clean up som stray endifs --- kiva/agg/src/gtk1/agg_bmp.cpp | 1 - kiva/agg/src/x11/agg_bmp.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/kiva/agg/src/gtk1/agg_bmp.cpp b/kiva/agg/src/gtk1/agg_bmp.cpp index 42bfe10d5..9cd4ff939 100644 --- a/kiva/agg/src/gtk1/agg_bmp.cpp +++ b/kiva/agg/src/gtk1/agg_bmp.cpp @@ -19,7 +19,6 @@ #include "numpy/arrayobject.h" #define PyArray_UBYTELTR 'b' -#endif #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); diff --git a/kiva/agg/src/x11/agg_bmp.cpp b/kiva/agg/src/x11/agg_bmp.cpp index 9aad81fd3..f27093214 100644 --- a/kiva/agg/src/x11/agg_bmp.cpp +++ b/kiva/agg/src/x11/agg_bmp.cpp @@ -21,7 +21,6 @@ #include "numpy/arrayobject.h" #define PyArray_UBYTELTR 'b' -#endif #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); From 95312dc56079ac1f28ccd89f4187692e6a0a29b7 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 2 May 2023 12:14:09 +0100 Subject: [PATCH 6/7] Fix missed merge conflict. --- kiva/agg/src/readme.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kiva/agg/src/readme.txt b/kiva/agg/src/readme.txt index ac8527d26..d3cdf55f3 100644 --- a/kiva/agg/src/readme.txt +++ b/kiva/agg/src/readme.txt @@ -15,11 +15,7 @@ compiled_path.i wrapper for kiva_compiled_path.h constants.i common enumerations and constants used by Agg and Kiva font_type.i wrapper for kiva_font_type.h graphic_context.i the main wrapper defining the Agg graphics context -<<<<<<< HEAD -numeric.i typemaps and wrappers for Numeric array used in kiva -======= numeric.i typemaps and wrappers for Numpy array used in kiva ->>>>>>> 0579b063 (Remove more uses of numeric.) rect.i wrapper for kiva_rect.h rgba.i RGBA color class and utility functions rgba_array.i maps Numeric 3- and 4-tuples into RGBA color instances From 4312233a00dc18893511874583d6b3e9c5e7ecbf Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Fri, 5 May 2023 10:19:31 +0100 Subject: [PATCH 7/7] Remove PyArray_UBYTELTR (shouldn't be needed). --- kiva/agg/src/gtk1/agg_bmp.cpp | 1 - kiva/agg/src/numeric.i | 2 -- kiva/agg/src/x11/agg_bmp.cpp | 2 -- 3 files changed, 5 deletions(-) diff --git a/kiva/agg/src/gtk1/agg_bmp.cpp b/kiva/agg/src/gtk1/agg_bmp.cpp index 9cd4ff939..a80d3b62f 100644 --- a/kiva/agg/src/gtk1/agg_bmp.cpp +++ b/kiva/agg/src/gtk1/agg_bmp.cpp @@ -18,7 +18,6 @@ #include "agg_color_rgba.h" #include "numpy/arrayobject.h" -#define PyArray_UBYTELTR 'b' #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n"); diff --git a/kiva/agg/src/numeric.i b/kiva/agg/src/numeric.i index 13b1509e9..9b933070e 100644 --- a/kiva/agg/src/numeric.i +++ b/kiva/agg/src/numeric.i @@ -31,8 +31,6 @@ Here are the typemap helper functions for numeric arrays: %{ #include "numpy/arrayobject.h" -#define PyArray_UBYTELTR 'b' - #include #define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) diff --git a/kiva/agg/src/x11/agg_bmp.cpp b/kiva/agg/src/x11/agg_bmp.cpp index f27093214..66bac29ca 100644 --- a/kiva/agg/src/x11/agg_bmp.cpp +++ b/kiva/agg/src/x11/agg_bmp.cpp @@ -18,9 +18,7 @@ #include "agg_color_rgba.h" #include "bytesobject.h" - #include "numpy/arrayobject.h" -#define PyArray_UBYTELTR 'b' #if 0 #define DEBUG_MTH(NAME) fprintf(stderr, NAME "\n");