aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Panov <fluffy@FreeBSD.org>2022-07-26 19:54:21 +0000
committerDima Panov <fluffy@FreeBSD.org>2022-07-26 19:55:47 +0000
commitacf1b6bc938dd7f25869d635414f41df6270b9da (patch)
tree9d9cee9a19c977d4de96cf5785be406c52d0ec02
parent42acfc66a0dd9a53982aa8fd3d02d516ab7537a4 (diff)
downloadports-acf1b6bc938dd7f25869d635414f41df6270b9da.tar.gz
ports-acf1b6bc938dd7f25869d635414f41df6270b9da.zip
-rw-r--r--graphics/py-cairo/Makefile14
-rw-r--r--graphics/py-cairo/distinfo6
-rw-r--r--graphics/py-cairo/files/patch-cairo_surface.c215
-rw-r--r--graphics/py-cairo/pkg-plist18
4 files changed, 18 insertions, 235 deletions
diff --git a/graphics/py-cairo/Makefile b/graphics/py-cairo/Makefile
index 4d1232751647..18eb9ba78a82 100644
--- a/graphics/py-cairo/Makefile
+++ b/graphics/py-cairo/Makefile
@@ -1,6 +1,5 @@
PORTNAME= cairo
-PORTVERSION= 1.18.1
-PORTREVISION= 2
+PORTVERSION= 1.21.0
PORTEPOCH= 1
CATEGORIES= graphics python
MASTER_SITES= https://github.com/pygobject/pycairo/releases/download/v${PORTVERSION}/
@@ -15,15 +14,20 @@ LICENSE_COMB= multi
LICENSE_FILE_LGPL21= ${WRKSRC}/COPYING-LGPL-2.1
LICENSE_FILE_MPL11= ${WRKSRC}/COPYING-MPL-1.1
+USES= compiler:c11 gnome meson pkgconfig python:3.7+
+USE_PYTHON= flavors py3kplist
+USE_GNOME= cairo
+MESON_ARGS+= -Dpython=${PYTHON_VERSION}
+
PORTSCOUT= limitw:1,even
-USES= compiler:c11 gnome pkgconfig python:3.6+
-USE_PYTHON= distutils py3kplist
-USE_GNOME= cairo
+BINARY_ALIAS= python3=${PYTHON_CMD}
PLIST_SUB= PORTVER=${PORTVERSION}
post-install:
+ ${PYTHON_CMD} -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
+ ${PYTHON_CMD} -O -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
@${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/cairo/_cairo*.so
.include <bsd.port.mk>
diff --git a/graphics/py-cairo/distinfo b/graphics/py-cairo/distinfo
index c06d9a1f93be..41c6ffad7ae1 100644
--- a/graphics/py-cairo/distinfo
+++ b/graphics/py-cairo/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1560185779
-SHA256 (pycairo-1.18.1.tar.gz) = 70172e58b6bad7572a3518c26729b074acdde15e6fee6cbab6d3528ad552b786
-SIZE (pycairo-1.18.1.tar.gz) = 200610
+TIMESTAMP = 1658861204
+SHA256 (pycairo-1.21.0.tar.gz) = 251907f18a552df938aa3386657ff4b5a4937dde70e11aa042bc297957f4b74b
+SIZE (pycairo-1.21.0.tar.gz) = 340712
diff --git a/graphics/py-cairo/files/patch-cairo_surface.c b/graphics/py-cairo/files/patch-cairo_surface.c
deleted file mode 100644
index b4ab64c6fe21..000000000000
--- a/graphics/py-cairo/files/patch-cairo_surface.c
+++ /dev/null
@@ -1,215 +0,0 @@
-https://github.com/pygobject/pycairo/commit/0f8cdc058239
-https://github.com/pygobject/pycairo/commit/4c5377787624
-https://github.com/pygobject/pycairo/commit/590bcd2ecc9c
-
---- cairo/surface.c.orig 2018-11-03 09:30:34 UTC
-+++ cairo/surface.c
-@@ -142,6 +142,7 @@ _write_func (void *closure, const unsigned char *data,
-
- static const cairo_user_data_key_t surface_base_object_key;
- static const cairo_user_data_key_t surface_is_mapped_image;
-+static const cairo_user_data_key_t surface_buffer_view_key;
-
- static void
- surface_dealloc (PycairoSurface *o) {
-@@ -439,28 +440,30 @@ _destroy_mime_user_data_func (PyObject *user_data) {
- static void
- _destroy_mime_data_func (PyObject *user_data) {
- cairo_surface_t *surface;
-+ Py_buffer *view;
- PyObject *mime_intern;
-
- PyGILState_STATE gstate = PyGILState_Ensure();
-
- /* Remove the user data holding the source object */
- surface = PyCapsule_GetPointer(PyTuple_GET_ITEM(user_data, 0), NULL);
-- mime_intern = PyTuple_GET_ITEM(user_data, 2);
-+ view = PyCapsule_GetPointer(PyTuple_GET_ITEM(user_data, 1), NULL);
-+ mime_intern = PyTuple_GET_ITEM(user_data, 3);
- cairo_surface_set_user_data(
- surface, (cairo_user_data_key_t *)mime_intern, NULL, NULL);
-
- /* Destroy the user data */
-- _destroy_mime_user_data_func(user_data);
-+ PyBuffer_Release (view);
-+ PyMem_Free (view);
-+ Py_DECREF(user_data);
-
- PyGILState_Release(gstate);
- }
-
- static PyObject *
- surface_set_mime_data (PycairoSurface *o, PyObject *args) {
-- PyObject *obj, *user_data, *mime_intern, *capsule;
-- const unsigned char *buffer;
-+ PyObject *obj, *user_data, *mime_intern, *surface_capsule, *view_capsule;
- const char *mime_type;
-- Py_ssize_t buffer_len;
- int res;
- cairo_status_t status;
-
-@@ -475,38 +478,58 @@ surface_set_mime_data (PycairoSurface *o, PyObject *ar
- Py_RETURN_NONE;
- }
-
--PYCAIRO_BEGIN_IGNORE_DEPRECATED
-- res = PyObject_AsReadBuffer (obj, (const void **)&buffer, &buffer_len);
--PYCAIRO_END_IGNORE_DEPRECATED
-- if (res == -1)
-+ Py_buffer *view = PyMem_Malloc (sizeof (Py_buffer));
-+ if (view == NULL) {
-+ PyErr_NoMemory ();
- return NULL;
-+ }
-
-+ res = PyObject_GetBuffer (obj, view, PyBUF_READ);
-+ if (res == -1) {
-+ PyMem_Free (view);
-+ return NULL;
-+ }
-+
- /* We use the interned mime type string as user data key and store the
- * passed in object with it. This allows us to return the same object in
- * surface_get_mime_data().
- */
- mime_intern = PYCAIRO_PyUnicode_InternFromString(mime_type);
-- capsule = PyCapsule_New(o->surface, NULL, NULL);
-- user_data = Py_BuildValue("(NOO)", capsule, obj, mime_intern);
-- if (user_data == NULL)
-+ surface_capsule = PyCapsule_New(o->surface, NULL, NULL);
-+ view_capsule = PyCapsule_New(view, NULL, NULL);
-+ user_data = Py_BuildValue("(NNOO)", surface_capsule, view_capsule, obj, mime_intern);
-+ if (user_data == NULL) {
-+ PyBuffer_Release (view);
-+ PyMem_Free (view);
- return NULL;
-+ }
-
- status = cairo_surface_set_user_data(
- o->surface, (cairo_user_data_key_t *)mime_intern, user_data,
- (cairo_destroy_func_t)_destroy_mime_user_data_func);
-- if (status != CAIRO_STATUS_SUCCESS)
-+
-+ if (status != CAIRO_STATUS_SUCCESS) {
-+ PyBuffer_Release (view);
-+ PyMem_Free (view);
- Py_DECREF(user_data);
-- RETURN_NULL_IF_CAIRO_ERROR(status);
-+ Pycairo_Check_Status (status);
-+ return NULL;
-+ }
-
-+ Py_INCREF(user_data);
- status = cairo_surface_set_mime_data (
-- o->surface, mime_type, buffer, (unsigned long)buffer_len,
-+ o->surface, mime_type, view->buf, (unsigned long)view->len,
- (cairo_destroy_func_t)_destroy_mime_data_func, user_data);
-+
- if (status != CAIRO_STATUS_SUCCESS) {
- cairo_surface_set_user_data(
- o->surface, (cairo_user_data_key_t *)mime_intern, NULL, NULL);
-+ PyBuffer_Release (view);
-+ PyMem_Free (view);
-+ Py_DECREF(user_data);
-+ Pycairo_Check_Status (status);
-+ return NULL;
- }
-- RETURN_NULL_IF_CAIRO_ERROR(status);
-- Py_INCREF(user_data);
-
- Py_RETURN_NONE;
- }
-@@ -534,7 +557,7 @@ surface_get_mime_data (PycairoSurface *o, PyObject *ar
- /* In case the mime data wasn't set through the Python API just copy it */
- return Py_BuildValue(PYCAIRO_DATA_FORMAT "#", buffer, buffer_len);
- } else {
-- obj = PyTuple_GET_ITEM(user_data, 1);
-+ obj = PyTuple_GET_ITEM(user_data, 2);
- Py_INCREF(obj);
- return obj;
- }
-@@ -804,14 +827,22 @@ image_surface_new (PyTypeObject *type, PyObject *args,
- NULL);
- }
-
-+static void
-+_release_buffer_destroy_func (void *user_data) {
-+ Py_buffer *view = (Py_buffer *)user_data;
-+ PyGILState_STATE gstate = PyGILState_Ensure();
-+ PyBuffer_Release (view);
-+ PyMem_Free (view);
-+ PyGILState_Release(gstate);
-+}
-+
- /* METH_CLASS */
- static PyObject *
- image_surface_create_for_data (PyTypeObject *type, PyObject *args) {
- cairo_surface_t *surface;
- cairo_format_t format;
-- unsigned char *buffer;
-+ cairo_status_t status;
- int width, height, stride = -1, res, format_arg;
-- Py_ssize_t buffer_len;
- PyObject *obj;
-
- if (!PyArg_ParseTuple (args, "Oiii|i:ImageSurface.create_for_data",
-@@ -820,12 +851,6 @@ image_surface_create_for_data (PyTypeObject *type, PyO
-
- format = (cairo_format_t)format_arg;
-
--PYCAIRO_BEGIN_IGNORE_DEPRECATED
-- res = PyObject_AsWriteBuffer (obj, (void **)&buffer, &buffer_len);
--PYCAIRO_END_IGNORE_DEPRECATED
-- if (res == -1)
-- return NULL;
--
- if (width <= 0) {
- PyErr_SetString(PyExc_ValueError, "width must be positive");
- return NULL;
-@@ -843,15 +868,42 @@ PYCAIRO_END_IGNORE_DEPRECATED
- return NULL;
- }
- }
-- if (height * stride > buffer_len) {
-+
-+ Py_buffer *view = PyMem_Malloc (sizeof (Py_buffer));
-+ if (view == NULL) {
-+ PyErr_NoMemory ();
-+ return NULL;
-+ }
-+
-+ res = PyObject_GetBuffer (obj, view, PyBUF_WRITABLE);
-+ if (res == -1) {
-+ PyMem_Free (view);
-+ return NULL;
-+ }
-+
-+ if (height * stride > view->len) {
-+ PyBuffer_Release (view);
-+ PyMem_Free (view);
- PyErr_SetString(PyExc_TypeError, "buffer is not long enough");
- return NULL;
- }
-+
- Py_BEGIN_ALLOW_THREADS;
-- surface = cairo_image_surface_create_for_data (buffer, format, width,
-- height, stride);
-+ surface = cairo_image_surface_create_for_data (view->buf, format, width,
-+ height, stride);
- Py_END_ALLOW_THREADS;
-- return _surface_create_with_object(surface, obj);
-+
-+ status = cairo_surface_set_user_data(
-+ surface, &surface_buffer_view_key, view,
-+ (cairo_destroy_func_t)_release_buffer_destroy_func);
-+ if (Pycairo_Check_Status (status)) {
-+ cairo_surface_destroy (surface);
-+ PyBuffer_Release (view);
-+ PyMem_Free (view);
-+ return NULL;
-+ }
-+
-+ return PycairoSurface_FromSurface(surface, NULL);
- }
-
-
diff --git a/graphics/py-cairo/pkg-plist b/graphics/py-cairo/pkg-plist
index 02fce6c3bcb4..27a01ada6383 100644
--- a/graphics/py-cairo/pkg-plist
+++ b/graphics/py-cairo/pkg-plist
@@ -1,16 +1,10 @@
-%%PYTHON2%%include/pycairo/pycairo.h
-%%PYTHON3%%include/pycairo/py3cairo.h
+include/pycairo/py3cairo.h
%%PYTHON_SITELIBDIR%%/cairo/__init__.py
-%%PYTHON_SITELIBDIR%%/cairo/__init__.pyc
%%PYTHON_SITELIBDIR%%/cairo/__init__.pyi
-%%PYTHON_SITELIBDIR%%/cairo/__init__.pyo
+%%PYTHON_SITELIBDIR%%/cairo/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.opt-1.pyc
+%%PYTHON_SITELIBDIR%%/cairo/__pycache__/__init__%%PYTHON_EXT_SUFFIX%%.pyc
%%PYTHON_SITELIBDIR%%/cairo/_cairo%%PYTHON_EXT_SUFFIX%%.so
-%%PYTHON2%%%%PYTHON_SITELIBDIR%%/cairo/include/pycairo.h
-%%PYTHON3%%%%PYTHON_SITELIBDIR%%/cairo/include/py3cairo.h
+%%PYTHON_SITELIBDIR%%/cairo/include/py3cairo.h
%%PYTHON_SITELIBDIR%%/cairo/py.typed
-%%PYTHON_SITELIBDIR%%/pycairo-%%PORTVER%%-py%%PYTHON_VER%%.egg-info/PKG-INFO
-%%PYTHON_SITELIBDIR%%/pycairo-%%PORTVER%%-py%%PYTHON_VER%%.egg-info/SOURCES.txt
-%%PYTHON_SITELIBDIR%%/pycairo-%%PORTVER%%-py%%PYTHON_VER%%.egg-info/dependency_links.txt
-%%PYTHON_SITELIBDIR%%/pycairo-%%PORTVER%%-py%%PYTHON_VER%%.egg-info/top_level.txt
-%%PYTHON2%%libdata/pkgconfig/pycairo.pc
-%%PYTHON3%%libdata/pkgconfig/py3cairo.pc
+%%PYTHON_SITELIBDIR%%/pycairo-%%PORTVER%%.egg-info
+libdata/pkgconfig/py3cairo.pc