Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pycairo for openSUSE:Factory checked in at 2022-12-10 21:17:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pycairo (Old) and /work/SRC/openSUSE:Factory/.python-pycairo.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pycairo" Sat Dec 10 21:17:26 2022 rev:10 rq:1041746 version:1.23.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pycairo/python-pycairo.changes 2022-11-29 10:52:28.328521221 +0100 +++ /work/SRC/openSUSE:Factory/.python-pycairo.new.1835/python-pycairo.changes 2022-12-10 21:17:30.373443482 +0100 @@ -1,0 +2,17 @@ +Wed Dec 7 20:50:28 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 1.23.0 + * Reminder to distro packagers: Building/installing pycairo using setup.py is deprecated, please use meson instead. + * git: changed default branch from âmasterâ to âmainâ + * Windows: Update the cairo version included in the wheels from 1.17.2 to 1.17.6 #pr-243 + * docs: Document how to look up pycairo headers without loading the module #pr-300 + * tests: donât error out if cairo wasnât built with all features #pr-293 + New APIs: + * Status.DWRITE_ERROR #pr-294 + * Format.RGB96F, Format.RGBA128F #pr-295 + * PDFVersion.VERSION_1_6, PDFVersion.VERSION_1_7 #pr-296 + * HAS_DWRITE_FONT #pr-297 + * Context.set_hairline(), Context.get_hairline() #pr-298 + * PDFSurface.set_custom_metadata() #pr-299 + +------------------------------------------------------------------- Old: ---- pycairo-1.22.0.tar.gz New: ---- pycairo-1.23.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pycairo.spec ++++++ --- /var/tmp/diff_new_pack.OCgiyC/_old 2022-12-10 21:17:31.469449891 +0100 +++ /var/tmp/diff_new_pack.OCgiyC/_new 2022-12-10 21:17:31.473449914 +0100 @@ -20,7 +20,7 @@ %define skip_python2 1 %define oldpython python Name: python-pycairo -Version: 1.22.0 +Version: 1.23.0 Release: 0 Summary: Python Bindings for Cairo License: LGPL-2.1-or-later OR MPL-1.1 ++++++ pycairo-1.22.0.tar.gz -> pycairo-1.23.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/NEWS new/pycairo-1.23.0/NEWS --- old/pycairo-1.22.0/NEWS 2022-11-19 14:14:24.000000000 +0100 +++ new/pycairo-1.23.0/NEWS 2022-11-28 17:58:31.000000000 +0100 @@ -1,5 +1,23 @@ Since version 1.11.0 Pycairo uses `Semantic Versioning <http://semver.org/>`__ +.. _v1.23.0: + +1.23.0 - 2022-11-28 +------------------- + +* git: changed default branch from "master" to "main" +* Windows: Update the cairo version included in the wheels from 1.17.2 to 1.17.6 :pr:`243` +* docs: Document how to look up pycairo headers without loading the module :pr:`300` +* tests: don't error out if cairo wasn't built with all features :pr:`293` +* New APIs: + + * :attr:`Status.DWRITE_ERROR` :pr:`294` + * :attr:`Format.RGB96F`, :attr:`Format.RGBA128F` :pr:`295` + * :attr:`PDFVersion.VERSION_1_6`, :attr:`PDFVersion.VERSION_1_7` :pr:`296` + * :attr:`HAS_DWRITE_FONT` :pr:`297` + * :meth:`Context.set_hairline`, :meth:`Context.get_hairline` :pr:`298` + * :meth:`PDFSurface.set_custom_metadata` :pr:`299` + .. _v1.22.0: 1.22.0 - 2022-11-19 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/PKG-INFO new/pycairo-1.23.0/PKG-INFO --- old/pycairo-1.22.0/PKG-INFO 2022-11-19 14:16:05.907942000 +0100 +++ new/pycairo-1.23.0/PKG-INFO 2022-11-28 18:26:54.798887500 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pycairo -Version: 1.22.0 +Version: 1.23.0 Summary: Python interface for cairo Home-page: https://pycairo.readthedocs.io Maintainer: Christoph Reiter @@ -27,8 +27,8 @@ Pycairo is a Python module providing bindings for the `cairo graphics library <https://cairographics.org/>`__. It depends on **cairo >= 1.15.10** and works -with **Python 3.7+**. Pycairo, including this documentation, is licensed under -the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. +with **Python 3.7+** and **PyPy3**. Pycairo, including this documentation, is +licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in @@ -76,17 +76,8 @@ * Provides an object oriented interface to cairo. * Queries the error status of objects and translates them to exceptions. * Provides a C API that can be used by other Python extensions. - -If Pycairo is not what you need, have a look at `cairocffi -<https://cairocffi.readthedocs.io>`__, which is an API compatible package -using `cffi <https://cffi.readthedocs.io/>`__ or `Qahirah -<https://github.com/ldo/qahirah>`__, which is using `ctypes -<https://docs.python.org/3/library/ctypes.html>`__ and provides a more -"pythonic" API with less focus on matching the cairo C API. +* Fully typed and documented API. For more information visit https://pycairo.readthedocs.io -.. image:: https://codecov.io/gh/pygobject/pycairo/branch/master/graph/badge.svg - :target: https://codecov.io/gh/pygobject/pycairo - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/README.rst new/pycairo-1.23.0/README.rst --- old/pycairo-1.22.0/README.rst 2022-02-26 16:52:42.000000000 +0100 +++ new/pycairo-1.23.0/README.rst 2022-11-22 19:24:09.000000000 +0100 @@ -6,8 +6,8 @@ Pycairo is a Python module providing bindings for the `cairo graphics library <https://cairographics.org/>`__. It depends on **cairo >= 1.15.10** and works -with **Python 3.7+**. Pycairo, including this documentation, is licensed under -the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. +with **Python 3.7+** and **PyPy3**. Pycairo, including this documentation, is +licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in @@ -55,15 +55,6 @@ * Provides an object oriented interface to cairo. * Queries the error status of objects and translates them to exceptions. * Provides a C API that can be used by other Python extensions. - -If Pycairo is not what you need, have a look at `cairocffi -<https://cairocffi.readthedocs.io>`__, which is an API compatible package -using `cffi <https://cffi.readthedocs.io/>`__ or `Qahirah -<https://github.com/ldo/qahirah>`__, which is using `ctypes -<https://docs.python.org/3/library/ctypes.html>`__ and provides a more -"pythonic" API with less focus on matching the cairo C API. +* Fully typed and documented API. For more information visit https://pycairo.readthedocs.io - -.. image:: https://codecov.io/gh/pygobject/pycairo/branch/master/graph/badge.svg - :target: https://codecov.io/gh/pygobject/pycairo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/cairo/__init__.pyi new/pycairo-1.23.0/cairo/__init__.pyi --- old/pycairo-1.22.0/cairo/__init__.pyi 2022-11-19 11:28:50.000000000 +0100 +++ new/pycairo-1.23.0/cairo/__init__.pyi 2022-11-22 18:33:03.000000000 +0100 @@ -32,6 +32,10 @@ HAS_WIN32_SURFACE: bool = ... HAS_XCB_SURFACE: bool = ... HAS_XLIB_SURFACE: bool = ... +HAS_DWRITE_FONT: bool = ... +""" +.. versionadded:: 1.23.0 +""" PDF_OUTLINE_ROOT: int = ... """ @@ -309,6 +313,20 @@ like :data:`RGB24` but with 10bpc. """ + RGB96F: "Format" = ... + """ + 3 floats, R, G, B. + + .. versionadded:: 1.23 Only available with cairo 1.17.2+ + """ + + RGBA128F: "Format" = ... + """ + 4 floats, R, G, B, A. + + .. versionadded:: 1.23 Only available with cairo 1.17.2+ + """ + class HintMetrics(_IntEnum): """ These constants specify whether to hint font metrics; hinting font metrics @@ -738,6 +756,10 @@ """ .. versionadded:: 1.18.0 Only available with cairo 1.15.10+ """ + DWRITE_ERROR: "Status" = ... + """ + .. versionadded:: 1.23.0 Only available with cairo 1.17.6+ + """ class PDFVersion(_IntEnum): """ @@ -753,6 +775,20 @@ VERSION_1_5: "PDFVersion" = ... """The version 1.5 of the PDF specification.""" + VERSION_1_6: "PDFVersion" = ... + """ + The version 1.6 of the PDF specification. + + .. versionadded:: 1.23.0 Only available with cairo 1.17.6+ + """ + + VERSION_1_7: "PDFVersion" = ... + """ + The version 1.7 of the PDF specification. + + .. versionadded:: 1.23.0 Only available with cairo 1.17.6+ + """ + class PSLevel(_IntEnum): """ These constants are used to describe the language level of the PostScript @@ -2725,6 +2761,16 @@ .. versionadded:: 1.2 """ + def get_hairline(self) -> bool: + """ + :returns: whether hairline mode is set. + + Returns whether or not hairline mode is set, as set by + :meth:`Context.set_hairline`. + + .. versionadded:: 1.23 Only available with cairo 1.17.6+ + """ + def get_line_cap(self) -> LineCap: """ :returns: the current line cap style, as @@ -3350,6 +3396,33 @@ size is 10.0. """ + def set_hairline(self, set_hairline: bool) -> None: + """ + :param set_hairline: whether or not to set hairline mode + + Sets lines within the cairo context to be hairlines. Hairlines are + logically zero-width lines that are drawn at the thinnest renderable + width possible in the current context. On surfaces with native hairline + support, the native hairline functionality will be used. Surfaces that + support hairlines include: + + - pdf/ps: Encoded as 0-width line. + - win32_printing: Rendered with PS_COSMETIC pen. + - svg: Encoded as 1px non-scaling-stroke. + - script: Encoded with set-hairline function. + + Cairo will always render hairlines at 1 device unit wide, even if an + anisotropic scaling was applied to the stroke width. In the wild, + handling of this situation is not well-defined. Some PDF, PS, and SVG + renderers match Cairo's output, but some very popular implementations + (Acrobat, Chrome, rsvg) will scale the hairline unevenly. As such, best + practice is to reset any anisotropic scaling before calling + :meth:`.stroke`. See https://cairographics.org/cookbook/ellipses/ for an + example. + + .. versionadded:: 1.23 Only available with cairo 1.17.6+ + """ + def set_line_cap(self, line_cap: LineCap) -> None: """ :param line_cap: a line cap style @@ -4273,6 +4346,25 @@ .. versionadded:: 1.2 """ + def set_custom_metadata(self, name: str, value: Optional[str]) -> None: + """ + :param name: The name of the custom metadata item to set. + :param value: The value of the metadata. + + Set custom document metadata. *name* may be any string except for the + following names reserved by PDF: "Title", "Author", "Subject", + "Keywords", "Creator", "Producer", "CreationDate", "ModDate", "Trapped". + + If *value* is :obj:`None` or an empty string, the *name* metadata will + not be set. + + For example:: + + surface.set_custom_metadata("ISBN", "978-0123456789") + + .. versionadded:: 1.23.0 Only available with cairo 1.17.6+ + """ + def set_size(self, width_in_points: float, height_in_points: float) -> None: """ :param width_in_points: new surface width, in points @@ -5467,6 +5559,8 @@ FORMAT_RGB16_565 = Format.RGB16_565 FORMAT_RGB24 = Format.RGB24 FORMAT_RGB30 = Format.RGB30 +FORMAT_RGB96F = Format.RGB96F +FORMAT_RGBA128F = Format.RGBA128F HINT_METRICS_DEFAULT = HintMetrics.DEFAULT HINT_METRICS_OFF = HintMetrics.OFF HINT_METRICS_ON = HintMetrics.ON @@ -5516,6 +5610,8 @@ PATH_MOVE_TO = PathDataType.MOVE_TO PDF_VERSION_1_4 = PDFVersion.VERSION_1_4 PDF_VERSION_1_5 = PDFVersion.VERSION_1_5 +PDF_VERSION_1_6 = PDFVersion.VERSION_1_6 +PDF_VERSION_1_7 = PDFVersion.VERSION_1_7 PS_LEVEL_2 = PSLevel.LEVEL_2 PS_LEVEL_3 = PSLevel.LEVEL_3 REGION_OVERLAP_IN = RegionOverlap.IN @@ -5594,6 +5690,7 @@ STATUS_FREETYPE_ERROR = Status.FREETYPE_ERROR STATUS_WIN32_GDI_ERROR = Status.WIN32_GDI_ERROR STATUS_PNG_ERROR = Status.PNG_ERROR +STATUS_DWRITE_ERROR = Status.DWRITE_ERROR PDF_OUTLINE_FLAG_OPEN = PDFOutlineFlags.OPEN PDF_OUTLINE_FLAG_BOLD = PDFOutlineFlags.BOLD PDF_OUTLINE_FLAG_ITALIC = PDFOutlineFlags.ITALIC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/cairo/cairomodule.c new/pycairo-1.23.0/cairo/cairomodule.c --- old/pycairo-1.22.0/cairo/cairomodule.c 2022-03-26 21:34:56.000000000 +0100 +++ new/pycairo-1.23.0/cairo/cairomodule.c 2022-11-20 19:02:46.000000000 +0100 @@ -513,6 +513,11 @@ #else PyModule_AddIntConstant(m, "HAS_TEE_SURFACE", 0); #endif +#ifdef CAIRO_HAS_DWRITE_FONT + PyModule_AddIntConstant(m, "HAS_DWRITE_FONT", 1); +#else + PyModule_AddIntConstant(m, "HAS_DWRITE_FONT", 0); +#endif PyModule_AddIntConstant(m, "CAIRO_VERSION", CAIRO_VERSION); PyModule_AddIntConstant(m, "CAIRO_VERSION_MAJOR", CAIRO_VERSION_MAJOR); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/cairo/context.c new/pycairo-1.23.0/cairo/context.c --- old/pycairo-1.22.0/cairo/context.c 2020-04-01 16:03:19.000000000 +0200 +++ new/pycairo-1.23.0/cairo/context.c 2022-11-20 19:06:26.000000000 +0100 @@ -74,6 +74,27 @@ return PycairoContext_FromContext (cairo_create (s->surface), type, NULL); } +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 6) +static PyObject * +pycairo_set_hairline (PycairoContext *o, PyObject *args) { + PyObject *py_hairline; + if (!PyArg_ParseTuple(args, "O!:Context.set_hairline", + &PyBool_Type, &py_hairline)) + return NULL; + cairo_set_hairline (o->ctx, (py_hairline == Py_True)); + RETURN_NULL_IF_CAIRO_CONTEXT_ERROR(o->ctx); + Py_RETURN_NONE; +} + +static PyObject * +pycairo_get_hairline (PycairoContext *o, PyObject *ignored) { + PyObject *set_hairline = cairo_get_hairline (o->ctx) ? Py_True : Py_False; + RETURN_NULL_IF_CAIRO_CONTEXT_ERROR(o->ctx); + Py_INCREF(set_hairline); + return set_hairline; +} +#endif + #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) static PyObject * pycairo_tag_begin (PycairoContext *o, PyObject *args) { @@ -1351,6 +1372,10 @@ * - not needed since Pycairo calls Pycairo_Check_Status() to check * for errors and raise exceptions */ +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 6) + {"set_hairline", (PyCFunction)pycairo_set_hairline, METH_VARARGS}, + {"get_hairline", (PyCFunction)pycairo_get_hairline, METH_NOARGS}, +#endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) {"tag_begin", (PyCFunction)pycairo_tag_begin, METH_VARARGS}, {"tag_end", (PyCFunction)pycairo_tag_end, METH_VARARGS}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/cairo/enums.c new/pycairo-1.23.0/cairo/enums.c --- old/pycairo-1.22.0/cairo/enums.c 2020-04-01 16:03:19.000000000 +0200 +++ new/pycairo-1.23.0/cairo/enums.c 2022-11-20 17:24:26.000000000 +0100 @@ -325,6 +325,10 @@ CONSTANT(Format, FORMAT, A1); CONSTANT(Format, FORMAT, RGB16_565); CONSTANT(Format, FORMAT, RGB30); +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 2) + CONSTANT(Format, FORMAT, RGB96F); + CONSTANT(Format, FORMAT, RGBA128F); +#endif ENUM(HintMetrics); CONSTANT(HintMetrics, HINT_METRICS, DEFAULT); @@ -425,6 +429,9 @@ CONSTANT(Status, STATUS, WIN32_GDI_ERROR); CONSTANT(Status, STATUS, TAG_ERROR); #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 6) + CONSTANT(Status, STATUS, DWRITE_ERROR); +#endif CONSTANT(Status, STATUS, LAST_STATUS); ENUM(PathDataType); @@ -475,6 +482,10 @@ ENUM(PDFVersion); CONSTANT(PDFVersion, PDF, VERSION_1_4); CONSTANT(PDFVersion, PDF, VERSION_1_5); +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 6) + CONSTANT(PDFVersion, PDF, VERSION_1_6); + CONSTANT(PDFVersion, PDF, VERSION_1_7); +#endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) ENUM(PDFMetadata); CONSTANT(PDFMetadata, PDF_METADATA, TITLE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/cairo/surface.c new/pycairo-1.23.0/cairo/surface.c --- old/pycairo-1.22.0/cairo/surface.c 2022-11-11 15:17:45.000000000 +0100 +++ new/pycairo-1.23.0/cairo/surface.c 2022-11-22 18:33:03.000000000 +0100 @@ -1254,6 +1254,25 @@ Py_RETURN_NONE; } +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 6) +static PyObject * +pdf_surface_set_custom_metadata (PycairoPDFSurface *o, PyObject *args) { + const char *name; + const char *value; + + if (!PyArg_ParseTuple (args, "sz:PDFSurface.set_custom_metadata", + &name, &value)) + return NULL; + + Py_BEGIN_ALLOW_THREADS; + cairo_pdf_surface_set_custom_metadata (o->surface, name, value); + Py_END_ALLOW_THREADS; + + RETURN_NULL_IF_CAIRO_SURFACE_ERROR (o->surface); + Py_RETURN_NONE; +} +#endif + static PyObject * pdf_get_versions (PyObject *self, PyObject *ignored) { PyObject *list, *num; @@ -1418,6 +1437,9 @@ #endif static PyMethodDef pdf_surface_methods[] = { +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 6) + {"set_custom_metadata", (PyCFunction)pdf_surface_set_custom_metadata, METH_VARARGS}, +#endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) {"set_page_label", (PyCFunction)pdf_surface_set_page_label, METH_VARARGS}, {"set_metadata", (PyCFunction)pdf_surface_set_metadata, METH_VARARGS}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/docs/c_api/c_build.rst new/pycairo-1.23.0/docs/c_api/c_build.rst --- old/pycairo-1.22.0/docs/c_api/c_build.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pycairo-1.23.0/docs/c_api/c_build.rst 2022-11-27 21:46:21.000000000 +0100 @@ -0,0 +1,57 @@ +.. currentmodule:: cairo + +Build Integration +================= + +To compile a Python extension using Pycairo you need to know where Pycairo and +cairo are located and what flags to pass to the compiler and linker. + +1. Variant: + + Similar to variant 2 but doesn't require pycairo to be loaded, which can be + problematic on Windows where by default cairo isn't in the dll search path + since Python 3.8. + + .. code:: python + + def get_include_path(): + import os + from importlib.util import find_spec + spec = find_spec("cairo") + assert spec is not None + return os.path.join(os.path.dirname(spec.origin), 'include') + + Compiler Flags: + * ``python -c "get_include_path()"`` + * ``pkg-config --cflags cairo`` + + Linker Flags: + * ``pkg-config --libs cairo`` + +2. Variant: + + Only available since version 1.16.0. + + While Pycairo installs a pkg-config file, in case of virtualenvs, + installation to the user directory or when using wheels/eggs, pkg-config + will not be able to locate the .pc file. The :func:`get_include` function + should work in all cases, as long as Pycairo is in your Python search path. + + Compiler Flags: + * ``python -c "import cairo; print(cairo.get_include())"`` + * ``pkg-config --cflags cairo`` + + Linker Flags: + * ``pkg-config --libs cairo`` + +3. Variant: + + This works with older versions, but with the limitations mentioned above. + Use it as a fallback if you want to support older versions or if your + module does not require virtualenv/pip support. + + Compiler Flags: + * ``pkg-config --cflags py3cairo`` + + Linker Flags: + * ``pkg-config --libs py3cairo`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/docs/c_api/index.rst new/pycairo-1.23.0/docs/c_api/index.rst --- old/pycairo-1.22.0/docs/c_api/index.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pycairo-1.23.0/docs/c_api/index.rst 2022-11-27 21:46:21.000000000 +0100 @@ -0,0 +1,8 @@ +C API +===== + +.. toctree:: + :titlesonly: + + pycairo_c_api + c_build \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/docs/c_api/pycairo_c_api.rst new/pycairo-1.23.0/docs/c_api/pycairo_c_api.rst --- old/pycairo-1.22.0/docs/c_api/pycairo_c_api.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pycairo-1.23.0/docs/c_api/pycairo_c_api.rst 2022-11-27 21:46:21.000000000 +0100 @@ -0,0 +1,385 @@ +.. highlight:: c + + +*************** +C API Reference +*************** + +.. _api-includes: + +Example showing how to import the pycairo API:: + + #include "py3cairo.h" + + PyMODINIT_FUNC + PyInit_client(void) + { + PyObject *m; + + m = PyModule_Create(&clientmodule); + if (m == NULL) + return NULL; + if (import_cairo() < 0) + return NULL; + /* additional initialization can happen here */ + return m; + } + +In case you want to use the API from another compilation unit:: + + #define PYCAIRO_NO_IMPORT + #include <py3cairo.h> + + ... + +.. versionadded:: 1.17.0 + + The ``PYCAIRO_NO_IMPORT`` macro is used since 1.17.0 + + +Misc Functions +============== + +.. c:function:: int Pycairo_Check_Status(cairo_status_t status) + + :param cairo_status_t status: + :returns: + -1 in case of an error, otherwise 0. + Sets an exception in case of an error. + + Takes a status value and converts it to an exception if it represents an + error status. + + +Cairo Context +============= + +.. c:type:: PyObject PycairoContext + +.. c:member:: cairo_t* PycairoContext.ctx + + The wrapped :any:`cairo_t` + +.. c:type:: PyTypeObject *PycairoContext_Type + +.. c:macro:: PycairoContext_GET(obj) + + :param PycairoContext obj: + :returns: :any:`cairo_t` [transfer none] + + Get the :any:`cairo_t` object out of the :any:`PycairoContext`. + +.. c:function:: PyObject * PycairoContext_FromContext(cairo_t *ctx, PyTypeObject *type, PyObject *base) + + :param cairo_t ctx: + a cairo_t to 'wrap' into a Python object. + It is unreferenced if the PycairoContext creation fails, or if + the cairo_t has an error status. [transfer full] + :param PyTypeObject type: + a pointer to the type to instantiate. + It can be &PycairoContext_Type, or a PycairoContext_Type subtype. + (cairo.Context or a cairo.Context subclass) + [transfer none] + :param PyObject base: + the base object used to create the context, or NULL. + it is referenced to keep it alive while the cairo_t is being used + [transfer none] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoContext from a :any:`cairo_t` + + +Cairo Font Face +=============== + +.. c:type:: PyObject PycairoFontFace + +.. c:member:: cairo_font_face_t* PycairoFontFace.font_face + +The wrapped :any:`cairo_font_face_t` + +.. c:type:: PyTypeObject *PycairoFontFace_Type + +.. c:function:: PyObject * PycairoFontFace_FromFontFace(cairo_font_face_t *font_face) + + :param cairo_font_face_t font_face: + a cairo_font_face_t to 'wrap' into a Python object. + it is unreferenced if the PycairoFontFace creation fails + [transfer full] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoFontFace from a cairo_font_face_t + +.. c:type:: PycairoFontFace PycairoToyFontFace + +.. c:type:: PyTypeObject *PycairoToyFontFace_Type + + +Cairo Font Options +================== + +.. c:type:: PyObject PycairoFontOptions + +.. c:member:: cairo_font_options_t* PycairoFontOptions.font_options + +.. c:type:: PyTypeObject *PycairoFontOptions_Type + +.. c:function:: PyObject * PycairoFontOptions_FromFontOptions(cairo_font_options_t *font_options) + + :param cairo_font_options_t font_options: + a cairo_font_options_t to 'wrap' into a Python object. + it is unreferenced if the PycairoFontOptions creation fails + [transfer full] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoFontOptions from a cairo_font_options_t + + +Cairo Matrix +============ + +.. c:type:: PyObject PycairoMatrix + +.. c:member:: cairo_matrix_t PycairoMatrix.matrix + +.. c:type:: PyTypeObject *PycairoMatrix_Type + +.. c:function:: PyObject * PycairoMatrix_FromMatrix(const cairo_matrix_t *matrix) + + :param cairo_matrix_t matrix: + a cairo_matrix_t to 'wrap' into a Python object. + the cairo_matrix_t values are copied. + [transfer none] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoMatrix from a cairo_matrix_t + + +Cairo Path +========== + +.. c:type:: PyObject PycairoPath + +.. c:member:: cairo_path_t* PycairoPath.path + +.. c:type:: PyTypeObject *PycairoPath_Type + +.. c:function:: PyObject * PycairoPath_FromPath(cairo_path_t *path) + + :param cairo_path_t path: + a cairo_path_t to 'wrap' into a Python object. + path is unreferenced if the PycairoPath creation fails, or if path + is in an error status. + [transfer full] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoPath from a cairo_path_t + + +Cairo Pattern +============= + +.. c:type:: PyObject PycairoPattern + +.. c:member:: cairo_pattern_t* PycairoPattern.pattern + +.. c:type:: PyTypeObject *PycairoPattern_Type + +.. c:type:: PycairoPattern PycairoSolidPattern + +.. c:type:: PyTypeObject *PycairoSolidPattern_Type + +.. c:type:: PycairoPattern PycairoSurfacePattern + +.. c:type:: PyTypeObject *PycairoSurfacePattern_Type + +.. c:type:: PycairoPattern PycairoGradient + +.. c:type:: PyTypeObject *PycairoGradient_Type + +.. c:type:: PycairoGradient PycairoLinearGradient + +.. c:type:: PyTypeObject *PycairoLinearGradient_Type + +.. c:type:: PycairoGradient PycairoRadialGradient + +.. c:type:: PyTypeObject *PycairoRadialGradient_Type + +.. c:function:: PyObject * PycairoPattern_FromPattern(cairo_pattern_t *pattern, PyObject *base) + + :param cairo_pattern_t pattern: + a cairo_pattern_t to 'wrap' into a Python object. + It is unreferenced if the PycairoPattern creation fails, or if the + pattern has an error status. + [transfer full] + :param PyObject base: + the base object used to create the pattern, or NULL. + It is referenced to keep it alive while the cairo_pattern_t is being + used. + [transfer none] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoSolidPattern, PycairoSurfacePattern, + PycairoLinearGradient, or PycairoRadialGradient from a cairo_pattern_t. + + +Cairo Region +============ + +.. c:type:: PyObject PycairoRegion + +.. c:member:: cairo_region_t* PycairoRegion.region + +.. c:type:: PyTypeObject *PycairoRegion_Type + +.. c:function:: PyObject * PycairoRegion_FromRegion(cairo_region_t *region) + + :param cairo_region_t region: + a cairo_region_t to 'wrap' into a Python object. + region is unreferenced if the PycairoRegion creation fails, or if + region is in an error status. + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoRegion from a cairo_region_t + + +Cairo RectangleInt +================== + +.. c:type:: PyObject PycairoRectangleInt + +.. c:member:: cairo_rectangle_int_t* PycairoRectangleInt.rectangle_int + +.. c:type:: PyTypeObject *PycairoRectangleInt_Type + +.. c:function:: PyObject * PycairoRectangleInt_FromRectangleInt(const cairo_rectangle_int_t *rectangle_int) + + :param cairo_rectangle_int_t rectangle_int: + a cairo_rectangle_int_t to 'wrap' into a Python object. + rectangle_int is unreferenced if the PycairoRectangleInt creation + fails. + [transfer none] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoRectangleInt from a cairo_rectangle_int_t + + +Scaled Font +=========== + +.. c:type:: PyObject PycairoScaledFont + +.. c:member:: cairo_scaled_font_t* PycairoScaledFont.scaled_font + +.. c:type:: PyTypeObject *PycairoScaledFont_Type + +.. c:function:: PyObject * PycairoScaledFont_FromScaledFont(cairo_scaled_font_t *scaled_font) + + :param cairo_scaled_font_t scaled_font: + a cairo_scaled_font_t to 'wrap' into a Python object. + it is unreferenced if the PycairoScaledFont creation fails + [transfer full] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoScaledFont from a cairo_scaled_font_t + + +Cairo Surface +============= + +.. c:type:: PyObject PycairoSurface + +.. c:member:: cairo_surface_t* PycairoSurface.surface + +.. c:type:: PyTypeObject *PycairoSurface_Type + +.. c:type:: PycairoSurface PycairoImageSurface +.. c:type:: PyTypeObject *PycairoImageSurface_Type + +.. c:type:: PycairoSurface PycairoPDFSurface +.. c:type:: PyTypeObject *PycairoPDFSurface_Type + +.. c:type:: PycairoSurface PycairoPSSurface +.. c:type:: PyTypeObject *PycairoPSSurface_Type + +.. c:type:: PycairoSurface PycairoRecordingSurface +.. c:type:: PyTypeObject *PycairoRecordingSurface_Type + +.. c:type:: PycairoSurface PycairoSVGSurface +.. c:type:: PyTypeObject *PycairoSVGSurface_Type + +.. c:type:: PycairoSurface PycairoWin32Surface +.. c:type:: PyTypeObject *PycairoWin32Surface_Type + +.. c:type:: PycairoSurface PycairoXCBSurface +.. c:type:: PyTypeObject *PycairoXCBSurface_Type + +.. c:type:: PycairoSurface PycairoXlibSurface +.. c:type:: PyTypeObject *PycairoXlibSurface_Type + +.. c:function:: PyObject * PycairoSurface_FromSurface(cairo_surface_t *surface, PyObject *base) + + :param cairo_surface_t surface: + a cairo_surface_t to 'wrap' into a Python object. + It is unreferenced if the PycairoSurface creation fails, or if the + cairo_surface_t has an error status. + [transfer full] + :param PyObject base: + the base object used to create the surface, or NULL. + It is referenced to keep it alive while the cairo_surface_t is being + used. + [transfer none] + :returns: + New reference or NULL on failure and sets an exception + [transfer full] + + Create a new PycairoImageSurface, PycairoPDFSurface, PycairoPSSurface, + PycairoRecordingSurface, PycairoSVGSurface, PycairoWin32Surface, + PycairoWin32PrintingSurface, PycairoXCBSurface, or PycairoXlibSurface from + a cairo_surface_t. + + +Cairo Types +=========== + +These are only listed here so they can be referenced in the documentation. + +See https://www.cairographics.org/manual/ for details. + +.. c:type:: cairo_t + cairo_status_t + cairo_surface_t + cairo_scaled_font_t + cairo_rectangle_int_t + cairo_region_t + cairo_pattern_t + cairo_matrix_t + cairo_font_options_t + cairo_path_t + cairo_font_face_t + + +CPython Types +============= + +.. c:type:: PyObject + +.. c:type:: PyTypeObject \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/docs/index.rst new/pycairo-1.23.0/docs/index.rst --- old/pycairo-1.22.0/docs/index.rst 2022-02-27 22:07:02.000000000 +0100 +++ new/pycairo-1.23.0/docs/index.rst 2022-11-27 21:46:21.000000000 +0100 @@ -18,7 +18,7 @@ changelog Tutorial <tutorial> reference/index - pycairo_c_api + c_api/index resources faq @@ -45,3 +45,17 @@ For examples of pycairo code see the 'examples' directory that comes with the pycairo distribution. + +---- + +Alternatives: + +* `cairocffi <https://cairocffi.readthedocs.io>`__ provides a large subset of + the pycairo API but instead of being implemented in C it uses `cffi + <https://cffi.readthedocs.io/>`__ to talk to cairo. In case you'd prefer not + to use a C extension then give this a try. Or if you use PyPy and want to + benefit from the lower overhead of cffi compared to C extensions. +* `Qahirah <https://github.com/ldo/qahirah>`__ provides a more "pythonic" API + with less focus on matching the cairo C API. It also isn't a C extension and + uses the Python builtin `ctypes + <https://docs.python.org/3/library/ctypes.html>`__ module to talk to cairo. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/docs/pycairo_c_api.rst new/pycairo-1.23.0/docs/pycairo_c_api.rst --- old/pycairo-1.22.0/docs/pycairo_c_api.rst 2021-04-30 05:39:59.000000000 +0200 +++ new/pycairo-1.23.0/docs/pycairo_c_api.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,429 +0,0 @@ -.. highlight:: c - - -*************** -C API Reference -*************** - -.. currentmodule:: cairo - -This manual documents the API used by C and C++ programmers who want to write -extension modules that use pycairo. - - -Pycairo Compiler Flags -====================== - -To compile a Python extension using Pycairo you need to know where Pycairo and -cairo are located and what flags to pass to the compiler and linker. - -1. Variant: - - Only available since version 1.16.0. - - While Pycairo installs a pkg-config file, in case of virtualenvs, - installation to the user directory or when using wheels/eggs, pkg-config - will not be able to locate the .pc file. The :func:`get_include` function - should work in all cases, as long as Pycairo is in your Python search path. - - Compiler Flags: - * ``python -c "import cairo; print(cairo.get_include())"`` - * ``pkg-config --cflags cairo`` - - Linker Flags: - * ``pkg-config --libs cairo`` - -2. Variant: - - This works with older versions, but with the limitations mentioned above. - Use it as a fallback if you want to support older versions or if your - module does not require virtualenv/pip support. - - Compiler Flags: - * ``pkg-config --cflags pycairo`` or ``pkg-config --cflags py3cairo`` - - Linker Flags: - * ``pkg-config --libs pycairo`` or ``pkg-config --libs py3cairo`` - - -.. _api-includes: - -To access the Pycairo C API under Python 3 -========================================== - -Example showing how to import the pycairo API:: - - #include "py3cairo.h" - - PyMODINIT_FUNC - PyInit_client(void) - { - PyObject *m; - - m = PyModule_Create(&clientmodule); - if (m == NULL) - return NULL; - if (import_cairo() < 0) - return NULL; - /* additional initialization can happen here */ - return m; - } - -In case you want to use the API from another compilation unit:: - - #define PYCAIRO_NO_IMPORT - #include <py3cairo.h> - - ... - -.. versionadded:: 1.17.0 - - The ``PYCAIRO_NO_IMPORT`` macro is used since 1.17.0 - - -Misc Functions -============== - -.. c:function:: int Pycairo_Check_Status(cairo_status_t status) - - :param cairo_status_t status: - :returns: - -1 in case of an error, otherwise 0. - Sets an exception in case of an error. - - Takes a status value and converts it to an exception if it represents an - error status. - - -Cairo Context -============= - -.. c:type:: PyObject PycairoContext - -.. c:member:: cairo_t* PycairoContext.ctx - - The wrapped :any:`cairo_t` - -.. c:type:: PyTypeObject *PycairoContext_Type - -.. c:macro:: PycairoContext_GET(obj) - - :param PycairoContext obj: - :returns: :any:`cairo_t` [transfer none] - - Get the :any:`cairo_t` object out of the :any:`PycairoContext`. - -.. c:function:: PyObject * PycairoContext_FromContext(cairo_t *ctx, PyTypeObject *type, PyObject *base) - - :param cairo_t ctx: - a cairo_t to 'wrap' into a Python object. - It is unreferenced if the PycairoContext creation fails, or if - the cairo_t has an error status. [transfer full] - :param PyTypeObject type: - a pointer to the type to instantiate. - It can be &PycairoContext_Type, or a PycairoContext_Type subtype. - (cairo.Context or a cairo.Context subclass) - [transfer none] - :param PyObject base: - the base object used to create the context, or NULL. - it is referenced to keep it alive while the cairo_t is being used - [transfer none] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoContext from a :any:`cairo_t` - - -Cairo Font Face -=============== - -.. c:type:: PyObject PycairoFontFace - -.. c:member:: cairo_font_face_t* PycairoFontFace.font_face - -The wrapped :any:`cairo_font_face_t` - -.. c:type:: PyTypeObject *PycairoFontFace_Type - -.. c:function:: PyObject * PycairoFontFace_FromFontFace(cairo_font_face_t *font_face) - - :param cairo_font_face_t font_face: - a cairo_font_face_t to 'wrap' into a Python object. - it is unreferenced if the PycairoFontFace creation fails - [transfer full] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoFontFace from a cairo_font_face_t - -.. c:type:: PycairoFontFace PycairoToyFontFace - -.. c:type:: PyTypeObject *PycairoToyFontFace_Type - - -Cairo Font Options -================== - -.. c:type:: PyObject PycairoFontOptions - -.. c:member:: cairo_font_options_t* PycairoFontOptions.font_options - -.. c:type:: PyTypeObject *PycairoFontOptions_Type - -.. c:function:: PyObject * PycairoFontOptions_FromFontOptions(cairo_font_options_t *font_options) - - :param cairo_font_options_t font_options: - a cairo_font_options_t to 'wrap' into a Python object. - it is unreferenced if the PycairoFontOptions creation fails - [transfer full] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoFontOptions from a cairo_font_options_t - - -Cairo Matrix -============ - -.. c:type:: PyObject PycairoMatrix - -.. c:member:: cairo_matrix_t PycairoMatrix.matrix - -.. c:type:: PyTypeObject *PycairoMatrix_Type - -.. c:function:: PyObject * PycairoMatrix_FromMatrix(const cairo_matrix_t *matrix) - - :param cairo_matrix_t matrix: - a cairo_matrix_t to 'wrap' into a Python object. - the cairo_matrix_t values are copied. - [transfer none] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoMatrix from a cairo_matrix_t - - -Cairo Path -========== - -.. c:type:: PyObject PycairoPath - -.. c:member:: cairo_path_t* PycairoPath.path - -.. c:type:: PyTypeObject *PycairoPath_Type - -.. c:function:: PyObject * PycairoPath_FromPath(cairo_path_t *path) - - :param cairo_path_t path: - a cairo_path_t to 'wrap' into a Python object. - path is unreferenced if the PycairoPath creation fails, or if path - is in an error status. - [transfer full] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoPath from a cairo_path_t - - -Cairo Pattern -============= - -.. c:type:: PyObject PycairoPattern - -.. c:member:: cairo_pattern_t* PycairoPattern.pattern - -.. c:type:: PyTypeObject *PycairoPattern_Type - -.. c:type:: PycairoPattern PycairoSolidPattern - -.. c:type:: PyTypeObject *PycairoSolidPattern_Type - -.. c:type:: PycairoPattern PycairoSurfacePattern - -.. c:type:: PyTypeObject *PycairoSurfacePattern_Type - -.. c:type:: PycairoPattern PycairoGradient - -.. c:type:: PyTypeObject *PycairoGradient_Type - -.. c:type:: PycairoGradient PycairoLinearGradient - -.. c:type:: PyTypeObject *PycairoLinearGradient_Type - -.. c:type:: PycairoGradient PycairoRadialGradient - -.. c:type:: PyTypeObject *PycairoRadialGradient_Type - -.. c:function:: PyObject * PycairoPattern_FromPattern(cairo_pattern_t *pattern, PyObject *base) - - :param cairo_pattern_t pattern: - a cairo_pattern_t to 'wrap' into a Python object. - It is unreferenced if the PycairoPattern creation fails, or if the - pattern has an error status. - [transfer full] - :param PyObject base: - the base object used to create the pattern, or NULL. - It is referenced to keep it alive while the cairo_pattern_t is being - used. - [transfer none] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoSolidPattern, PycairoSurfacePattern, - PycairoLinearGradient, or PycairoRadialGradient from a cairo_pattern_t. - - -Cairo Region -============ - -.. c:type:: PyObject PycairoRegion - -.. c:member:: cairo_region_t* PycairoRegion.region - -.. c:type:: PyTypeObject *PycairoRegion_Type - -.. c:function:: PyObject * PycairoRegion_FromRegion(cairo_region_t *region) - - :param cairo_region_t region: - a cairo_region_t to 'wrap' into a Python object. - region is unreferenced if the PycairoRegion creation fails, or if - region is in an error status. - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoRegion from a cairo_region_t - - -Cairo RectangleInt -================== - -.. c:type:: PyObject PycairoRectangleInt - -.. c:member:: cairo_rectangle_int_t* PycairoRectangleInt.rectangle_int - -.. c:type:: PyTypeObject *PycairoRectangleInt_Type - -.. c:function:: PyObject * PycairoRectangleInt_FromRectangleInt(const cairo_rectangle_int_t *rectangle_int) - - :param cairo_rectangle_int_t rectangle_int: - a cairo_rectangle_int_t to 'wrap' into a Python object. - rectangle_int is unreferenced if the PycairoRectangleInt creation - fails. - [transfer none] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoRectangleInt from a cairo_rectangle_int_t - - -Scaled Font -=========== - -.. c:type:: PyObject PycairoScaledFont - -.. c:member:: cairo_scaled_font_t* PycairoScaledFont.scaled_font - -.. c:type:: PyTypeObject *PycairoScaledFont_Type - -.. c:function:: PyObject * PycairoScaledFont_FromScaledFont(cairo_scaled_font_t *scaled_font) - - :param cairo_scaled_font_t scaled_font: - a cairo_scaled_font_t to 'wrap' into a Python object. - it is unreferenced if the PycairoScaledFont creation fails - [transfer full] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoScaledFont from a cairo_scaled_font_t - - -Cairo Surface -============= - -.. c:type:: PyObject PycairoSurface - -.. c:member:: cairo_surface_t* PycairoSurface.surface - -.. c:type:: PyTypeObject *PycairoSurface_Type - -.. c:type:: PycairoSurface PycairoImageSurface -.. c:type:: PyTypeObject *PycairoImageSurface_Type - -.. c:type:: PycairoSurface PycairoPDFSurface -.. c:type:: PyTypeObject *PycairoPDFSurface_Type - -.. c:type:: PycairoSurface PycairoPSSurface -.. c:type:: PyTypeObject *PycairoPSSurface_Type - -.. c:type:: PycairoSurface PycairoRecordingSurface -.. c:type:: PyTypeObject *PycairoRecordingSurface_Type - -.. c:type:: PycairoSurface PycairoSVGSurface -.. c:type:: PyTypeObject *PycairoSVGSurface_Type - -.. c:type:: PycairoSurface PycairoWin32Surface -.. c:type:: PyTypeObject *PycairoWin32Surface_Type - -.. c:type:: PycairoSurface PycairoXCBSurface -.. c:type:: PyTypeObject *PycairoXCBSurface_Type - -.. c:type:: PycairoSurface PycairoXlibSurface -.. c:type:: PyTypeObject *PycairoXlibSurface_Type - -.. c:function:: PyObject * PycairoSurface_FromSurface(cairo_surface_t *surface, PyObject *base) - - :param cairo_surface_t surface: - a cairo_surface_t to 'wrap' into a Python object. - It is unreferenced if the PycairoSurface creation fails, or if the - cairo_surface_t has an error status. - [transfer full] - :param PyObject base: - the base object used to create the surface, or NULL. - It is referenced to keep it alive while the cairo_surface_t is being - used. - [transfer none] - :returns: - New reference or NULL on failure and sets an exception - [transfer full] - - Create a new PycairoImageSurface, PycairoPDFSurface, PycairoPSSurface, - PycairoRecordingSurface, PycairoSVGSurface, PycairoWin32Surface, - PycairoWin32PrintingSurface, PycairoXCBSurface, or PycairoXlibSurface from - a cairo_surface_t. - - -Cairo Types -=========== - -These are only listed here so they can be referenced in the documentation. - -See https://www.cairographics.org/manual/ for details. - -.. c:type:: cairo_t - cairo_status_t - cairo_surface_t - cairo_scaled_font_t - cairo_rectangle_int_t - cairo_region_t - cairo_pattern_t - cairo_matrix_t - cairo_font_options_t - cairo_path_t - cairo_font_face_t - - -CPython Types -============= - -.. c:type:: PyObject - -.. c:type:: PyTypeObject \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/docs/reference/constants.rst new/pycairo-1.23.0/docs/reference/constants.rst --- old/pycairo-1.22.0/docs/reference/constants.rst 2022-11-19 11:28:50.000000000 +0100 +++ new/pycairo-1.23.0/docs/reference/constants.rst 2022-11-20 19:02:46.000000000 +0100 @@ -59,6 +59,7 @@ .. autodata:: HAS_MIME_SURFACE .. autodata:: HAS_SCRIPT_SURFACE .. autodata:: HAS_TEE_SURFACE +.. autodata:: HAS_DWRITE_FONT .. _constants_TAG: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/meson.build new/pycairo-1.23.0/meson.build --- old/pycairo-1.22.0/meson.build 2022-11-19 13:04:34.000000000 +0100 +++ new/pycairo-1.23.0/meson.build 2022-11-28 17:58:36.000000000 +0100 @@ -1,6 +1,6 @@ project( 'pycairo', 'c', - version: '1.22.0', + version: '1.23.0', meson_version: '>= 0.53.0', license: 'LGPL-2.1-only OR MPL-1.1', default_options: [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/pycairo.egg-info/PKG-INFO new/pycairo-1.23.0/pycairo.egg-info/PKG-INFO --- old/pycairo-1.22.0/pycairo.egg-info/PKG-INFO 2022-11-19 14:16:05.000000000 +0100 +++ new/pycairo-1.23.0/pycairo.egg-info/PKG-INFO 2022-11-28 18:26:54.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pycairo -Version: 1.22.0 +Version: 1.23.0 Summary: Python interface for cairo Home-page: https://pycairo.readthedocs.io Maintainer: Christoph Reiter @@ -27,8 +27,8 @@ Pycairo is a Python module providing bindings for the `cairo graphics library <https://cairographics.org/>`__. It depends on **cairo >= 1.15.10** and works -with **Python 3.7+**. Pycairo, including this documentation, is licensed under -the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. +with **Python 3.7+** and **PyPy3**. Pycairo, including this documentation, is +licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in @@ -76,17 +76,8 @@ * Provides an object oriented interface to cairo. * Queries the error status of objects and translates them to exceptions. * Provides a C API that can be used by other Python extensions. - -If Pycairo is not what you need, have a look at `cairocffi -<https://cairocffi.readthedocs.io>`__, which is an API compatible package -using `cffi <https://cffi.readthedocs.io/>`__ or `Qahirah -<https://github.com/ldo/qahirah>`__, which is using `ctypes -<https://docs.python.org/3/library/ctypes.html>`__ and provides a more -"pythonic" API with less focus on matching the cairo C API. +* Fully typed and documented API. For more information visit https://pycairo.readthedocs.io -.. image:: https://codecov.io/gh/pygobject/pycairo/branch/master/graph/badge.svg - :target: https://codecov.io/gh/pygobject/pycairo - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/pycairo.egg-info/SOURCES.txt new/pycairo-1.23.0/pycairo.egg-info/SOURCES.txt --- old/pycairo-1.22.0/pycairo.egg-info/SOURCES.txt 2022-11-19 14:16:05.000000000 +0100 +++ new/pycairo-1.23.0/pycairo.egg-info/SOURCES.txt 2022-11-28 18:26:54.000000000 +0100 @@ -43,9 +43,11 @@ docs/getting_started.rst docs/index.rst docs/integration.rst -docs/pycairo_c_api.rst docs/resources.rst docs/tutorial.rst +docs/c_api/c_build.rst +docs/c_api/index.rst +docs/c_api/pycairo_c_api.rst docs/images/example.svg docs/images/pycairo.svg docs/reference/constants.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/pyproject.toml new/pycairo-1.23.0/pyproject.toml --- old/pycairo-1.22.0/pyproject.toml 2022-11-19 11:29:06.000000000 +0100 +++ new/pycairo-1.23.0/pyproject.toml 2022-11-22 18:51:50.000000000 +0100 @@ -8,14 +8,15 @@ python = "^3.7" [tool.poetry.dev-dependencies] -pytest = "^7.0.1" -hypothesis = "^6.0.0" -mypy = {version = "^0.982", markers = "platform_python_implementation != 'PyPy'"} +pytest = "^7.2.0" +hypothesis = "^6.58.0" +mypy = {version = "^0.991", markers = "platform_python_implementation != 'PyPy'"} flake8 = "^5.0.4" Sphinx = "^4.3.2" -sphinx-rtd-theme = "^1.0.0" -coverage = "^6.3.2" +sphinx-rtd-theme = "^1.1.1" +coverage = "^6.5.0" sphinx-autobuild = "^2021.3.14" [build-system] -requires = ["setuptools", "wheel"] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/setup.py new/pycairo-1.23.0/setup.py --- old/pycairo-1.22.0/setup.py 2022-11-19 13:04:33.000000000 +0100 +++ new/pycairo-1.23.0/setup.py 2022-11-28 17:58:41.000000000 +0100 @@ -15,9 +15,12 @@ from distutils import sysconfig -PYCAIRO_VERSION = '1.22.0' +PYCAIRO_VERSION = '1.23.0' CAIRO_VERSION_REQUIRED = '1.15.10' +PYCAIRO_BUILD_NO_PKGCONFIG = os.environ.get("PYCAIRO_BUILD_NO_PKGCONFIG", False) +PYCAIRO_BUILD_MSVC_STATIC = os.environ.get("PYCAIRO_BUILD_MSVC_STATIC", True) + def get_command_class(name): # in case pip loads with setuptools this returns the extended commands @@ -169,12 +172,14 @@ def initialize_options(self): self.force = False self.build_base = None + self.compiler_type = None def finalize_options(self): self.set_undefined_options( 'build', ('build_base', 'build_base')) self.force = bool(self.force) + self.compiler_type = new_compiler().compiler_type def run(self): cmd = self.reinitialize_command("build_ext") @@ -207,13 +212,14 @@ add_ext_cflags(ext, compiler) - if compiler.compiler_type == "msvc": - ext.libraries += ['cairo'] - else: + if not PYCAIRO_BUILD_NO_PKGCONFIG: pkg_config_version_check('cairo', CAIRO_VERSION_REQUIRED) ext.include_dirs += pkg_config_parse('--cflags-only-I', 'cairo') ext.library_dirs += pkg_config_parse('--libs-only-L', 'cairo') ext.libraries += pkg_config_parse('--libs-only-l', 'cairo') + if self.compiler_type == "msvc" and PYCAIRO_BUILD_MSVC_STATIC: + ext.libraries += ['user32', 'advapi32', 'ole32'] + ext.define_macros += [('CAIRO_WIN32_STATIC_BUILD', 1)] dist = Distribution({"ext_modules": [ext]}) @@ -459,21 +465,19 @@ def run(self): ext = self.extensions[0] - # If we are using MSVC, don't use pkg-config, - # just assume that INCLUDE and LIB contain - # the paths to the Cairo headers and libraries, - # respectively. - if self.compiler_type == "msvc": - ext.libraries += ['cairo'] - else: + if not PYCAIRO_BUILD_NO_PKGCONFIG: pkg_config_version_check('cairo', CAIRO_VERSION_REQUIRED) ext.include_dirs += pkg_config_parse('--cflags-only-I', 'cairo') ext.library_dirs += pkg_config_parse('--libs-only-L', 'cairo') ext.libraries += pkg_config_parse('--libs-only-l', 'cairo') - + if not self.compiler_type == "msvc": compiler = new_compiler(compiler=self.compiler) customize_compiler(compiler) add_ext_cflags(ext, compiler) + elif self.compiler_type == "msvc" and PYCAIRO_BUILD_MSVC_STATIC: + # these extra libs are needed since we are linking statically + ext.libraries += ['user32', 'advapi32', 'ole32'] + ext.define_macros += [('CAIRO_WIN32_STATIC_BUILD', 1)] du_build_ext.run(self) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/tests/test_cmod.py new/pycairo-1.23.0/tests/test_cmod.py --- old/pycairo-1.22.0/tests/test_cmod.py 2019-08-24 23:37:20.000000000 +0200 +++ new/pycairo-1.23.0/tests/test_cmod.py 2022-11-27 21:46:21.000000000 +0100 @@ -3,8 +3,12 @@ from __future__ import absolute_import import cairo +import pytest -from . import cmod +try: + from . import cmod +except ImportError: + pytest.skip("cmod not built", allow_module_level=True) def test_foo(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/tests/test_context.py new/pycairo-1.23.0/tests/test_context.py --- old/pycairo-1.22.0/tests/test_context.py 2022-10-16 19:11:13.000000000 +0200 +++ new/pycairo-1.23.0/tests/test_context.py 2022-11-20 19:02:46.000000000 +0100 @@ -533,3 +533,12 @@ assert isinstance(context.get_tolerance(), float) assert isinstance(context.get_miter_limit(), float) assert isinstance(context.get_matrix(), cairo.Matrix) + + +@pytest.mark.skipif(not hasattr(cairo.Context, "set_hairline"), + reason="too old cairo") +def test_hairline(context: cairo.Context): + assert not context.get_hairline() + context.set_hairline(True) + assert isinstance(context.get_hairline(), bool) + assert context.get_hairline() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/tests/test_surface.py new/pycairo-1.23.0/tests/test_surface.py --- old/pycairo-1.22.0/tests/test_surface.py 2022-11-19 11:28:50.000000000 +0100 +++ new/pycairo-1.23.0/tests/test_surface.py 2022-11-22 18:33:03.000000000 +0100 @@ -211,6 +211,16 @@ surface.set_metadata(cairo.PDFMetadata.AUTHOR, "author") +@pytest.mark.skipif(not hasattr(cairo.PDFSurface, "set_custom_metadata"), + reason="too old cairo") +def test_pdf_set_custom_metadata(): + fileobj = io.BytesIO() + with cairo.PDFSurface(fileobj, 128, 128) as surface: + surface.set_custom_metadata("ISBN", "978-0123456789") + with pytest.raises(cairo.Error): + surface.set_custom_metadata("Author", "Author isn't allowed") + + @pytest.mark.skipif(not hasattr(cairo.PDFSurface, "add_outline"), reason="too old cairo") def test_pdf_add_outline(): @@ -739,3 +749,11 @@ surface = cairo.RecordingSurface(cairo.CONTENT_COLOR, None) assert surface.ink_extents() == (0.0, 0.0, 0.0, 0.0) + + +@pytest.mark.skipif(not hasattr(cairo.Format, "RGB96F"), reason="too old cairo") +def test_format_rgbf(): + surface = cairo.ImageSurface(cairo.Format.RGB96F, 3, 3) + assert surface.get_format() == cairo.Format.RGB96F + surface = cairo.ImageSurface(cairo.Format.RGBA128F, 3, 3) + assert surface.get_format() == cairo.Format.RGBA128F diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.22.0/tests/test_typing.py new/pycairo-1.23.0/tests/test_typing.py --- old/pycairo-1.22.0/tests/test_typing.py 2022-02-27 16:55:29.000000000 +0100 +++ new/pycairo-1.23.0/tests/test_typing.py 2022-11-20 16:28:42.000000000 +0100 @@ -36,10 +36,4 @@ names.add(key) return names - # We expose all potential API in the typing stubs, so only check - # if it exactly matches the Python module with a new enough cairo - cairo_version = tuple(map(int, cairo.cairo_version_string().split("."))) - if cairo_version >= (1, 16, 0): - assert collect_names(cairo) == collect_names(mod) - else: - assert collect_names(cairo) <= collect_names(mod) + assert collect_names(cairo) <= collect_names(mod)