Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build issues with enable #1070

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/test-with-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
test-ets:
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
toolkit: ['null', 'pyside2', 'pyside6', 'pyqt5', 'wx']
os: ['ubuntu-latest'] # 'macos-latest', 'windows-latest']
toolkit: ['null'] #, 'pyside2', 'pyside6', 'pyqt5', 'wx']
python-version: ['3.8', '3.10', '3.11']
exclude:
# No Wx wheels available for Python 3.11
Expand All @@ -30,6 +30,9 @@ jobs:
toolkit: 'wx'
- os: 'macos-latest'
toolkit: 'wx'
# No PySide2 wheels for macos-latest
- os: 'macos-latest'
toolkit: 'pyside2'
# Kiva tests hanging on windows, see #1038
- os: 'windows-latest'
toolkit: 'pyqt5'
Expand Down
7 changes: 5 additions & 2 deletions kiva/_cython_speedups.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
#
# Thanks for using Enthought open source!
import numpy as np
from numpy cimport uint8_t
cimport _hit_test

from numpy cimport uint8_t, import_array
cimport cython
from . cimport _hit_test

import_array()

def points_in_polygon(pts, poly_pts, use_winding=False):
"""Test whether point pairs in pts are within the polygon, poly_pts.
Expand Down
8 changes: 5 additions & 3 deletions kiva/_marker_renderer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
import cython
import numpy as np
from numpy cimport uint8_t

cimport _marker_renderer
from numpy cimport uint8_t, import_array
cimport cython
from . cimport _marker_renderer

import_array()

ctypedef _marker_renderer.marker_renderer_base renderer_base_t

Expand Down
3 changes: 2 additions & 1 deletion kiva/agg/src/osx/plat_support.i
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ namespace agg24
end_of_pix_formats
};

%name(PixelMap) class pixel_map
%rename(PixelMap) pixel_map;
class pixel_map
{
public:
~pixel_map();
Expand Down
20 changes: 20 additions & 0 deletions kiva/compatibility.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# (C) Copyright 2025 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!
""" Compatibility workaround module

Module to workaround compatibility issues with different versions of
the enable dependencies.

"""

try:
from numpy import sometrue
except ImportError:
from numpy import any as sometrue
5 changes: 3 additions & 2 deletions kiva/line_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2023 Enthought, Inc., Austin, TX
# (C) Copyright 2005-2025 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand All @@ -14,8 +14,9 @@
state (eg. Wx, SVG and PDF backends, but not Agg or QPainter).
"""

from numpy import array, asarray, shape, sometrue
from numpy import array, asarray, shape

from .compatibility import sometrue
from .constants import NO_DASH


Expand Down
18 changes: 9 additions & 9 deletions kiva/quartz/ABCGI.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cimport numpy
import os
import warnings

from CTFont import default_font_info
from .CTFont import default_font_info

cdef extern from "math.h":
double sqrt(double arg)
Expand Down Expand Up @@ -1479,7 +1479,7 @@ cdef class CGBitmapContext(CGContext):
raise ValueError("bits_per_component must be 5 or 8")

cdef int min_bytes
min_bytes = (width*bits_per_pixel + 7) / 8
min_bytes = (width*bits_per_pixel + 7) // 8
if bytes_per_row < min_bytes:
bytes_per_row = min_bytes

Expand Down Expand Up @@ -1763,7 +1763,7 @@ cdef class CGImage:
raise ValueError("bits_per_component must be 5 or 8")

cdef int min_bytes
min_bytes = (width*bits_per_pixel + 7) / 8
min_bytes = (width*bits_per_pixel + 7) // 8
if bytes_per_row < min_bytes:
bytes_per_row = min_bytes

Expand Down Expand Up @@ -1826,16 +1826,16 @@ cdef class CGImageFile(CGImage):
bits_per_pixel = 8
alpha_info = kCGImageAlphaNone

bytes_per_row = (bits_per_pixel*width + 7)/ 8
bytes_per_row = (bits_per_pixel*width + 7) // 8

cdef char* data
cdef char* py_data
cdef int dims[3]
cdef numpy.npy_intp dims[3]
dims[0] = height
dims[1] = width
dims[2] = bits_per_pixel/bits_per_component
dims[2] = bits_per_pixel // bits_per_component

self.bmp_array = numpy.PyArray_SimpleNew(3, &(dims[0]), numpy.NPY_UBYTE)
self.bmp_array = numpy.PyArray_SimpleNew(3, dims, numpy.NPY_UBYTE)

data = self.bmp_array.data
bs = img.tobytes()
Expand Down Expand Up @@ -2672,15 +2672,15 @@ cdef int bisect_left(PiecewiseLinearColorFunction self, CGFloat t):
hi = self.num_stops
lo = 0
while lo < hi:
mid = (lo + hi)/2
mid = (lo + hi) // 2
stop = self.stops[mid]
if t < stop:
hi = mid
else:
lo = mid + 1
return lo

cdef void piecewise_callback(void* obj, CGFloat* t, CGFloat* out):
cdef void piecewise_callback(void* obj, CGFloat* t, CGFloat* out) noexcept:
cdef int i
cdef CGFloat eps
cdef PiecewiseLinearColorFunction self
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["cython<3", "oldest-supported-numpy", "setuptools", "swig", "wheel"]
requires = ["cython", "numpy>2", "setuptools", "swig", "wheel"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
Expand Down
8 changes: 0 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,6 @@ def macos_extensions():
'kiva.quartz.ABCGI',
sources=[
'kiva/quartz/ABCGI.pyx',
'kiva/quartz/Python.pxi',
'kiva/quartz/numpy.pxi',
'kiva/quartz/CoreFoundation.pxi',
'kiva/quartz/CoreGraphics.pxi',
'kiva/quartz/CoreText.pxi',
],
extra_link_args=extra_link_args,
include_dirs=[numpy.get_include()],
Expand All @@ -333,9 +328,6 @@ def macos_extensions():
'kiva.quartz.CTFont',
sources=[
'kiva/quartz/CTFont.pyx',
'kiva/quartz/CoreFoundation.pxi',
'kiva/quartz/CoreGraphics.pxi',
'kiva/quartz/CoreText.pxi',
],
extra_link_args=extra_link_args,
),
Expand Down
Loading