pytroll / aggdraw

Python package wrapping AGG2 drawing functionality
https://aggdraw.readthedocs.io/en/latest/
Other
98 stars 48 forks source link

Python 3.12 support #95

Closed steinuil closed 3 months ago

steinuil commented 3 months ago

Some of the APIs used in aggdraw.cxx have been removed in Python 3.12 and the library doesn't compile anymore.

In file included from agg2/font_freetype/agg_font_freetype.h:28,
                 from aggdraw.cxx:86:
agg2/include/agg_scanline_storage_bin.h: In member function ‘unsigned int agg::scanline_storage_bin::byte_size() const’:
agg2/include/agg_scanline_storage_bin.h:247:38: warning: unused variable ‘sp’ [-Wunused-variable]
  247 |                     const span_data& sp = m_spans[span_idx++];
      |                                      ^~
aggdraw.cxx: In function ‘int text_getchar(PyObject*, int, long unsigned int*)’:
aggdraw.cxx:338:25: error: ‘PyUnicode_AS_UNICODE’ was not declared in this scope; did you mean ‘PyUnicode_AsUCS4’?
  338 |         Py_UNICODE* p = PyUnicode_AS_UNICODE(string);
      |                         ^~~~~~~~~~~~~~~~~~~~
      |                         PyUnicode_AsUCS4
aggdraw.cxx:339:20: error: ‘PyUnicode_GET_SIZE’ was not declared in this scope; did you mean ‘PyDict_GET_SIZE’?
  339 |         int size = PyUnicode_GET_SIZE(string);
      |                    ^~~~~~~~~~~~~~~~~~
      |                    PyDict_GET_SIZE
djhoese commented 3 months ago

How are you installing aggdraw? Python 3.12 support was fixed in #90. Although I'm not sure if/when that was released.

steinuil commented 3 months ago

Oh, I was installing it through Nix and it turns out the package hasn't been updated. Sorry, I just searched for those function names in the repo and assumed they hadn't been fixed!