Hello community, here is the log from the commit of package python-cairocffi for openSUSE:Factory checked in at 2019-02-15 09:55:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cairocffi (Old) and /work/SRC/openSUSE:Factory/.python-cairocffi.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-cairocffi" Fri Feb 15 09:55:09 2019 rev:12 rq:668596 version:0.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cairocffi/python-cairocffi.changes 2018-12-13 19:40:56.381274632 +0100 +++ /work/SRC/openSUSE:Factory/.python-cairocffi.new.28833/python-cairocffi.changes 2019-02-15 09:55:27.731758815 +0100 @@ -1,0 +2,13 @@ +Fri Jan 25 10:10:32 UTC 2019 - mvetter@suse.com + +- Update to 0.9.0: + * Drop Python 3.2 and 3.3 support + * Test with PyPy and PyPy3 + * Fix test compatibility with Cairo 1.15.12 + * Add cairo library name from PyGObject for Windows + * Fix pango_example.py + * Fix crash with xbc tests + * Clean documentation + * Support Cairo features up to 1.15.12 + +------------------------------------------------------------------- Old: ---- cairocffi-0.8.1.tar.gz New: ---- cairocffi-0.9.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cairocffi.spec ++++++ --- /var/tmp/diff_new_pack.Jmv8NC/_old 2019-02-15 09:55:28.091758701 +0100 +++ /var/tmp/diff_new_pack.Jmv8NC/_new 2019-02-15 09:55:28.091758701 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-cairocffi # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,23 +12,24 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-cairocffi -Version: 0.8.1 +Version: 0.9.0 Release: 0 Summary: Python cairo bindings based on cffi License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/SimonSapin/cairocffi Source: https://files.pythonhosted.org/packages/source/c/cairocffi/cairocffi-%{version}.tar.gz -BuildRequires: %{python_module cffi >= 0.6} +BuildRequires: %{python_module cffi >= 1.1.0} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module xcffib >= 0.3.2} BuildRequires: cairo +BuildRequires: fdupes BuildRequires: gdk-pixbuf BuildRequires: python-rpm-macros Requires: cairo @@ -66,6 +67,7 @@ %install %python_install +%python_expand %fdupes %{buildroot}%{$python_sitearch} %files %{python_files} %license LICENSE ++++++ cairocffi-0.8.1.tar.gz -> cairocffi-0.9.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/.coveragerc new/cairocffi-0.9.0/.coveragerc --- old/cairocffi-0.8.1/.coveragerc 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/.coveragerc 2018-07-24 10:58:07.000000000 +0200 @@ -1,16 +1,13 @@ [run] -omit = - cairocffi/compat.py - cairocffi/mkconstants.py -branch = True +include = cairocffi/* +omit = cairocffi/compat.py [report] show_missing = True exclude_lines = pragma: no cover pytest.xfail() + pytest.fail() except OSError: -partial_branches = - pragma: no branch - assert - fd.write\( + except ImportError: + raise OSError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/.gitignore new/cairocffi-0.9.0/.gitignore --- old/cairocffi-0.8.1/.gitignore 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/.gitignore 2018-07-23 23:07:25.000000000 +0200 @@ -5,7 +5,7 @@ *.egg-info /.eggs /dist -/.tox +/.cache /.coverage -/htmlcov +/.pytest_cache /docs/_build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/.travis.yml new/cairocffi-0.9.0/.travis.yml --- old/cairocffi-0.8.1/.travis.yml 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/.travis.yml 2018-07-24 10:29:29.000000000 +0200 @@ -1,17 +1,22 @@ language: python +sudo: false + python: - - "2.6" - - "2.7" - - "3.2" - - "3.3" - - "3.4" - - "3.5" + - 2.6 + - 2.7 + - 3.4 + - 3.5 + - 3.6 + - pypy + - pypy3 + before_install: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + install: - - "pip install xcffib" - - "pip install ." - - "python cairocffi/ffi_build.py" -script: "py.test" -sudo: false + - pip install --upgrade setuptools + - pip install -e .[test,xcb] + +script: + - python setup.py test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/CHANGES new/cairocffi-0.9.0/CHANGES --- old/cairocffi-0.8.1/CHANGES 2018-05-30 14:35:43.000000000 +0200 +++ new/cairocffi-0.9.0/CHANGES 2018-08-06 17:46:31.000000000 +0200 @@ -1,6 +1,24 @@ cairocffi changelog ------------------- +Version 0.9.0 +............. + +Released on 2018-08-06 + +* Drop Python 3.2 and 3.3 support +* Test with PyPy and PyPy3 +* `#114 https://github.com/Kozea/cairocffi/pull/114`_: + Fix test compatibility with Cairo 1.15.12 +* `#112 https://github.com/Kozea/cairocffi/pull/112`_: + Add cairo library name from PyGObject for Windows +* Fix ``pango_example.py`` +* `#85 https://github.com/Kozea/cairocffi/issues/85`_: + Fix crash with xbc tests +* Clean documentation +* Support Cairo features up to 1.15.12 + + Version 0.8.1 ............. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/PKG-INFO new/cairocffi-0.9.0/PKG-INFO --- old/cairocffi-0.8.1/PKG-INFO 2018-05-30 14:40:24.000000000 +0200 +++ new/cairocffi-0.9.0/PKG-INFO 2018-08-06 17:48:19.000000000 +0200 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: cairocffi -Version: 0.8.1 +Version: 0.9.0 Summary: cffi-based cairo bindings for Python Home-page: https://github.com/SimonSapin/cairocffi Author: Simon Sapin Author-email: simon.sapin@exyr.org License: BSD -Description-Content-Type: UNKNOWN Description: cairocffi ========= @@ -19,16 +18,17 @@ to decode various image formats for use in cairo. .. _CFFI: https://cffi.readthedocs.org/ - .. _Pycairo: http://cairographics.org/pycairo/ + .. _Pycairo: https://pycairo.readthedocs.io/ .. _cairo: http://cairographics.org/ - .. _GDK-PixBuf: https://live.gnome.org/GdkPixbuf + .. _GDK-PixBuf: https://gitlab.gnome.org/GNOME/gdk-pixbuf - * `Latest documentation http://packages.python.org/cairocffi/`_ - * `Source code and issue tracker https://github.com/SimonSapin/cairocffi`_ + * `Latest documentation http://cairocffi.readthedocs.io/en/latest/`_ + * `Source code and issue tracker https://github.com/Kozea/cairocffi`_ on GitHub. * Install with ``pip install cairocffi`` - * Python 2.6, 2.7 and 3.2+. Tested with CPython and Pypy. - * API compatible with Pycairo. + * Python 2.6, 2.7 and 3.4+. `Tested with CPython, PyPy and PyPy3 + https://travis-ci.org/Kozea/cairocffi`_. + * API partially compatible with Pycairo. * Works with any version of cairo. Platform: UNKNOWN @@ -38,3 +38,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia :: Graphics +Provides-Extra: xcb +Provides-Extra: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/README.rst new/cairocffi-0.9.0/README.rst --- old/cairocffi-0.8.1/README.rst 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/README.rst 2018-07-24 18:20:25.000000000 +0200 @@ -10,14 +10,15 @@ to decode various image formats for use in cairo. .. _CFFI: https://cffi.readthedocs.org/ -.. _Pycairo: http://cairographics.org/pycairo/ +.. _Pycairo: https://pycairo.readthedocs.io/ .. _cairo: http://cairographics.org/ -.. _GDK-PixBuf: https://live.gnome.org/GdkPixbuf +.. _GDK-PixBuf: https://gitlab.gnome.org/GNOME/gdk-pixbuf -* `Latest documentation http://packages.python.org/cairocffi/`_ -* `Source code and issue tracker https://github.com/SimonSapin/cairocffi`_ +* `Latest documentation http://cairocffi.readthedocs.io/en/latest/`_ +* `Source code and issue tracker https://github.com/Kozea/cairocffi`_ on GitHub. * Install with ``pip install cairocffi`` -* Python 2.6, 2.7 and 3.2+. Tested with CPython and Pypy. -* API compatible with Pycairo. +* Python 2.6, 2.7 and 3.4+. `Tested with CPython, PyPy and PyPy3 + https://travis-ci.org/Kozea/cairocffi`_. +* API partially compatible with Pycairo. * Works with any version of cairo. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/__init__.py new/cairocffi-0.9.0/cairocffi/__init__.py --- old/cairocffi-0.8.1/cairocffi/__init__.py 2018-05-30 14:37:59.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/__init__.py 2018-07-30 18:10:30.000000000 +0200 @@ -17,10 +17,10 @@ from .compat import FileNotFoundError from ._ffi import ffi -VERSION = '0.8.1' -# pycairo compat: -version = '1.10.0' -version_info = (1, 10, 0) +VERSION = '0.9.0' +# supported version of cairo, used to be pycairo version too: +version = '1.16.0' +version_info = (1, 16, 0) def dlopen(ffi, *names): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/constants.py new/cairocffi-0.9.0/cairocffi/constants.py --- old/cairocffi-0.8.1/cairocffi/constants.py 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/constants.py 2018-07-24 22:55:44.000000000 +0200 @@ -1,6 +1,10 @@ # *** Do not edit this file *** # Generated by utils/mkconstants.py +TAG_DEST = b"cairo.dest" + +TAG_LINK = b"Link" + STATUS_SUCCESS = 0 STATUS_NO_MEMORY = 1 STATUS_INVALID_RESTORE = 2 @@ -40,7 +44,11 @@ STATUS_INVALID_MESH_CONSTRUCTION = 36 STATUS_DEVICE_FINISHED = 37 STATUS_JBIG2_GLOBAL_MISSING = 38 -STATUS_LAST_STATUS = 39 +STATUS_PNG_ERROR = 39 +STATUS_FREETYPE_ERROR = 40 +STATUS_WIN32_GDI_ERROR = 41 +STATUS_TAG_ERROR = 42 +STATUS_LAST_STATUS = 43 CONTENT_COLOR = 0x1000 CONTENT_ALPHA = 0x2000 @@ -201,16 +209,44 @@ REGION_OVERLAP_OUT = 1 REGION_OVERLAP_PART = 2 +PDF_OUTLINE_ROOT = 0 + PDF_VERSION_1_4 = 0 PDF_VERSION_1_5 = 1 +PDF_OUTLINE_FLAG_OPEN = 0x1 +PDF_OUTLINE_FLAG_BOLD = 0x2 +PDF_OUTLINE_FLAG_ITALIC = 0x4 + +PDF_METADATA_TITLE = 0 +PDF_METADATA_AUTHOR = 1 +PDF_METADATA_SUBJECT = 2 +PDF_METADATA_KEYWORDS = 3 +PDF_METADATA_CREATOR = 4 +PDF_METADATA_CREATE_DATE = 5 +PDF_METADATA_MOD_DATE = 6 + PS_LEVEL_2 = 0 PS_LEVEL_3 = 1 SVG_VERSION_1_1 = 0 SVG_VERSION_1_2 = 1 +SVG_UNIT_USER = 0 +SVG_UNIT_EM = 1 +SVG_UNIT_EX = 2 +SVG_UNIT_PX = 3 +SVG_UNIT_IN = 4 +SVG_UNIT_CM = 5 +SVG_UNIT_MM = 6 +SVG_UNIT_PT = 7 +SVG_UNIT_PC = 8 +SVG_UNIT_PERCENT = 9 + _CAIRO_HEADERS = r""" + const char* CAIRO_TAG_DEST = "cairo.dest"; + const char* CAIRO_TAG_LINK = "Link"; + int cairo_version (void); @@ -281,6 +317,10 @@ CAIRO_STATUS_INVALID_MESH_CONSTRUCTION, CAIRO_STATUS_DEVICE_FINISHED, CAIRO_STATUS_JBIG2_GLOBAL_MISSING, + CAIRO_STATUS_PNG_ERROR, + CAIRO_STATUS_FREETYPE_ERROR, + CAIRO_STATUS_WIN32_GDI_ERROR, + CAIRO_STATUS_TAG_ERROR, CAIRO_STATUS_LAST_STATUS } cairo_status_t; @@ -639,6 +679,12 @@ void cairo_rectangle_list_destroy (cairo_rectangle_list_t *rectangle_list); +void +cairo_tag_begin (cairo_t *cr, const char *tag_name, const char *attributes); + +void +cairo_tag_end (cairo_t *cr, const char *tag_name); + typedef struct _cairo_scaled_font cairo_scaled_font_t; typedef struct _cairo_font_face cairo_font_face_t; @@ -768,6 +814,13 @@ cairo_hint_metrics_t cairo_font_options_get_hint_metrics (const cairo_font_options_t *options); +const char * +cairo_font_options_get_variations (cairo_font_options_t *options); + +void +cairo_font_options_set_variations (cairo_font_options_t *options, + const char *variations); + void cairo_select_font_face (cairo_t *cr, const char *family, @@ -1854,6 +1907,8 @@ cairo_debug_reset_static_data (void); + const int CAIRO_PDF_OUTLINE_ROOT = 0; + typedef enum _cairo_pdf_version { CAIRO_PDF_VERSION_1_4, @@ -1887,6 +1942,43 @@ double width_in_points, double height_in_points); +typedef enum _cairo_pdf_outline_flags { + CAIRO_PDF_OUTLINE_FLAG_OPEN = 0x1, + CAIRO_PDF_OUTLINE_FLAG_BOLD = 0x2, + CAIRO_PDF_OUTLINE_FLAG_ITALIC = 0x4, +} cairo_pdf_outline_flags_t; + +int +cairo_pdf_surface_add_outline (cairo_surface_t *surface, + int parent_id, + const char *utf8, + const char *link_attribs, + cairo_pdf_outline_flags_t flags); + +typedef enum _cairo_pdf_metadata { + CAIRO_PDF_METADATA_TITLE, + CAIRO_PDF_METADATA_AUTHOR, + CAIRO_PDF_METADATA_SUBJECT, + CAIRO_PDF_METADATA_KEYWORDS, + CAIRO_PDF_METADATA_CREATOR, + CAIRO_PDF_METADATA_CREATE_DATE, + CAIRO_PDF_METADATA_MOD_DATE, +} cairo_pdf_metadata_t; + +void +cairo_pdf_surface_set_metadata (cairo_surface_t *surface, + cairo_pdf_metadata_t metadata, + const char *utf8); + +void +cairo_pdf_surface_set_page_label (cairo_surface_t *surface, + const char *utf8); + +void +cairo_pdf_surface_set_thumbnail_size (cairo_surface_t *surface, + int width, + int height); + typedef enum _cairo_ps_level { @@ -1945,6 +2037,19 @@ CAIRO_SVG_VERSION_1_2 } cairo_svg_version_t; +typedef enum _cairo_svg_unit { + CAIRO_SVG_UNIT_USER = 0, + CAIRO_SVG_UNIT_EM, + CAIRO_SVG_UNIT_EX, + CAIRO_SVG_UNIT_PX, + CAIRO_SVG_UNIT_IN, + CAIRO_SVG_UNIT_CM, + CAIRO_SVG_UNIT_MM, + CAIRO_SVG_UNIT_PT, + CAIRO_SVG_UNIT_PC, + CAIRO_SVG_UNIT_PERCENT +} cairo_svg_unit_t; + cairo_surface_t * cairo_svg_surface_create (const char *filename, double width_in_points, @@ -1967,6 +2072,13 @@ const char * cairo_svg_version_to_string (cairo_svg_version_t version); +void +cairo_svg_surface_set_document_unit (cairo_surface_t *surface, + cairo_svg_unit_t unit); + +cairo_svg_unit_t +cairo_svg_surface_get_document_unit (cairo_surface_t *surface); + typedef void* HDC; typedef void* HFONT; @@ -1977,6 +2089,10 @@ cairo_win32_surface_create (HDC hdc); cairo_surface_t * +cairo_win32_surface_create_with_format (HDC hdc, + cairo_format_t format); + +cairo_surface_t * cairo_win32_printing_surface_create (HDC hdc); cairo_surface_t * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/context.py new/cairocffi-0.9.0/cairocffi/context.py --- old/cairocffi-0.8.1/cairocffi/context.py 2016-08-26 18:12:11.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/context.py 2018-07-30 17:41:33.000000000 +0200 @@ -2191,3 +2191,69 @@ """ cairo.cairo_copy_page(self._pointer) self._check_status() + + # + # Tags + # + + def tag_begin(self, tag_name, attributes=None): + """Marks the beginning of the ``tag_name`` structure. + + Call :meth:`tag_end` with the same ``tag_name`` to mark the end of the + structure. + + The attributes string is of the form "key1=value2 key2=value2 ...". + Values may be boolean (true/false or 1/0), integer, float, string, or + an array. + + String values are enclosed in single quotes ('). Single quotes and + backslashes inside the string should be escaped with a backslash. + + Boolean values may be set to true by only specifying the key. eg the + attribute string "key" is the equivalent to "key=true". + + Arrays are enclosed in '[]'. eg "rect=[1.2 4.3 2.0 3.0]". + + If no attributes are required, ``attributes`` can be omitted, an empty + string or None. + + See cairo's Tags and Links Description for the list of tags and + attributes. + + Invalid nesting of tags or invalid attributes will cause the context to + shutdown with a status of ``CAIRO_STATUS_TAG_ERROR``. + + See :meth:`tag_end`. + + :param tag_name: tag name + :param attributes: tag attributes + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + if attributes is None: + attributes = '' + cairo.cairo_tag_begin( + self._pointer, _encode_string(tag_name), + _encode_string(attributes)) + self._check_status() + + def tag_end(self, tag_name): + """Marks the end of the ``tag_name`` structure. + + Invalid nesting of tags will cause @cr to shutdown with a status of + ``CAIRO_STATUS_TAG_ERROR``. + + See :meth:`tag_begin`. + + :param tag_name: tag name + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + cairo.cairo_tag_end(self._pointer, _encode_string(tag_name)) + self._check_status() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/fonts.py new/cairocffi-0.9.0/cairocffi/fonts.py --- old/cairocffi-0.8.1/cairocffi/fonts.py 2016-08-26 18:12:11.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/fonts.py 2018-07-24 18:33:22.000000000 +0200 @@ -492,3 +492,46 @@ """ return cairo.cairo_font_options_get_hint_metrics(self._pointer) + + def set_variations(self, variations): + """Sets the OpenType font variations for the font options object. + + Font variations are specified as a string with a format that is similar + to the CSS font-variation-settings. The string contains a + comma-separated list of axis assignments, which each assignment + consists of a 4-character axis name and a value, separated by + whitespace and optional equals sign. + + :param variations: the new font variations, or ``None``. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + if variations is None: + variations = ffi.NULL + else: + variations = _encode_string(variations) + cairo.cairo_font_options_set_variations(self._pointer, variations) + self._check_status() + + def get_variations(self): + """Gets the OpenType font variations for the font options object. + + See :meth:`set_variations` for details about the + string format. + + :return: the font variations for the font options object. The + returned string belongs to the ``options`` and must not be modified. + It is valid until either the font options object is destroyed or the + font variations in this object is modified with :meth:`set_variations`. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + variations = cairo.cairo_font_options_get_variations(self._pointer) + if variations != ffi.NULL: + return ffi.string(variations).decode('utf8', 'replace') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/pixbuf.py new/cairocffi-0.9.0/cairocffi/pixbuf.py --- old/cairocffi-0.8.1/cairocffi/pixbuf.py 2018-05-30 14:34:14.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/pixbuf.py 2018-07-24 10:55:02.000000000 +0200 @@ -52,7 +52,7 @@ if error.message != ffi.NULL: message = ('Pixbuf error: ' + ffi.string(error.message).decode('utf8', 'replace')) - else: + else: # pragma: no cover message = 'Pixbuf error' glib.g_error_free(error) raise ImageLoadingError(message) @@ -100,7 +100,7 @@ if format_ != ffi.NULL else None) pixbuf = gdk_pixbuf.gdk_pixbuf_loader_get_pixbuf(loader) - if pixbuf == ffi.NULL: + if pixbuf == ffi.NULL: # pragma: no cover raise ImageLoadingError('Not enough image data (got a NULL pixbuf.)') return Pixbuf(pixbuf), format_name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/surfaces.py new/cairocffi-0.9.0/cairocffi/surfaces.py --- old/cairocffi-0.8.1/cairocffi/surfaces.py 2017-12-23 13:14:08.000000000 +0100 +++ new/cairocffi-0.9.0/cairocffi/surfaces.py 2018-07-31 11:43:29.000000000 +0200 @@ -11,6 +11,7 @@ """ import io +import os import sys import ctypes import weakref @@ -46,10 +47,28 @@ return write_func -def _encode_filename(filename): - """Return a byte string, encoding Unicode with the filesystem encoding.""" +def _encode_filename(filename): # pragma: no cover + """Return a byte string suitable for a filename. + + Unicode is encoded using an encoding adapted to what both cairo and the + filesystem want. + + """ + # Don't replace unknown characters as '?' is forbidden in Windows filenames + errors = 'ignore' if os.name == 'nt' else 'replace' + if not isinstance(filename, bytes): - filename = filename.encode(sys.getfilesystemencoding()) + if os.name == 'nt' and cairo.cairo_version() >= 11510: + # Since 1.15.10, cairo uses utf-8 filenames on Windows + filename = filename.encode('utf-8', errors=errors) + else: + try: + filename = filename.encode(sys.getfilesystemencoding()) + except UnicodeEncodeError: + # Use plain ASCII filenames as fallback + filename = filename.encode('ascii', errors=errors) + + # TODO: avoid characters forbidden in filenames? return ffi.new('char[]', filename) @@ -378,7 +397,7 @@ return tuple(ppi) def get_font_options(self): - """ Retrieves the default font rendering options for the surface. + """Retrieves the default font rendering options for the surface. This allows display surfaces to report the correct subpixel order for rendering on them, @@ -393,6 +412,42 @@ self._pointer, font_options._pointer) return font_options + def set_device_scale(self, x_scale, y_scale): + """Sets a scale that is multiplied to the device coordinates determined + by the CTM when drawing to surface. + + One common use for this is to render to very high resolution display + devices at a scale factor, so that code that assumes 1 pixel will be a + certain size will still work. Setting a transformation via + cairo_translate() isn't sufficient to do this, since functions like + cairo_device_to_user() will expose the hidden scale. + + Note that the scale affects drawing to the surface as well as using the + surface in a source pattern. + + :param x_scale: the scale in the X direction, in device units. + :param y_scale: the scale in the Y direction, in device units. + + *New in cairo 1.14.* + + *New in cairocffi 0.9.* + + """ + cairo.cairo_surface_set_device_scale(self._pointer, x_scale, y_scale) + self._check_status() + + def get_device_scale(self): + """Returns the previous device offset set by :meth:`set_device_scale`. + + *New in cairo 1.14.* + + *New in cairocffi 0.9.* + + """ + size = ffi.new('double[2]') + cairo.cairo_surface_get_device_scale(self._pointer, size + 0, size + 1) + return tuple(size) + def set_mime_data(self, mime_type, data): """ Attach an image in the format :obj:`mime_type` to this surface. @@ -805,9 +860,9 @@ :meth:`~Surface.show_page` or :meth:`~Surface.copy_page`. :param width_in_points: - New width of the page, in points (1 point == 1/72.0 inch) + New width of the page, in points (1 point = 1/72.0 inch) :param height_in_points: - New height of the page, in points (1 point == 1/72.0 inch) + New height of the page, in points (1 point = 1/72.0 inch) :type width_in_points: float :type height_in_points: float @@ -816,6 +871,88 @@ self._pointer, width_in_points, height_in_points) self._check_status() + def add_outline(self, parent_id, utf8, link_attribs, flags=None): + """Add an item to the document outline hierarchy. + + The outline has the ``utf8`` name and links to the location specified + by ``link_attribs``. Link attributes have the same keys and values as + the Link Tag, excluding the ``rect`` attribute. The item will be a + child of the item with id ``parent_id``. Use ``PDF_OUTLINE_ROOT`` as + the parent id of top level items. + + :param parent_id: + the id of the parent item or ``PDF_OUTLINE_ROOT`` if this is a + top level item. + :param utf8: the name of the outline. + :param link_attribs: + the link attributes specifying where this outline links to. + :param flags: outline item flags. + + :return: the id for the added item. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + if flags is None: + flags = 0 + value = cairo.cairo_pdf_surface_add_outline( + self._pointer, parent_id, _encode_string(utf8), + _encode_string(link_attribs), flags) + self._check_status() + return value + + def set_metadata(self, metadata, utf8): + """Sets document metadata. + + The ``PDF_METADATA_CREATE_DATE`` and ``PDF_METADATA_MOD_DATE`` + values must be in ISO-8601 format: YYYY-MM-DDThh:mm:ss. An optional + timezone of the form "[+/-]hh:mm" or "Z" for UTC time can be appended. + All other metadata values can be any UTF-8 string. + + :param metadata: the metadata item to set. + :param utf8: metadata value. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + cairo.cairo_pdf_surface_set_metadata( + self._pointer, metadata, _encode_string(utf8)) + self._check_status() + + def set_page_label(self, utf8): + """Set page label for the current page. + + :param utf8: the page label. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + cairo.cairo_pdf_surface_set_page_label( + self._pointer, _encode_string(utf8)) + + def set_thumbnail_size(self, width, height): + """Set thumbnail image size for the current and all subsequent pages. + + Setting a width or height of 0 disables thumbnails for the current and + subsequent pages. + + :param width: thumbnail width. + :param height: thumbnail height. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + cairo.cairo_pdf_surface_set_thumbnail_size( + self._pointer, width, height) + def restrict_to_version(self, version): """Restricts the generated PDF file to :obj:`version`. @@ -1170,6 +1307,53 @@ cairo.cairo_svg_surface_restrict_to_version(self._pointer, version) self._check_status() + def set_document_unit(self, unit): + """Use specified unit for width and height of generated SVG file. + + See ``SVG_UNIT_*`` enumerated values for a list of available unit + values that can be used here. + + This function can be called at any time before generating the SVG file. + + However to minimize the risk of ambiguities it's recommended to call it + before any drawing operations have been performed on the given surface, + to make it clearer what the unit used in the drawing operations is. + + The simplest way to do this is to call this function immediately after + creating the SVG surface. + + Note if this function is never called, the default unit for SVG + documents generated by cairo will be "pt". This is for historical + reasons. + + :param unit: SVG unit. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + cairo.cairo_svg_surface_set_document_unit(self._pointer, unit) + self._check_status() + + def get_document_unit(self): + """Get the unit of the SVG surface. + + If the surface passed as an argument is not a SVG surface, the function + sets the error status to ``STATUS_SURFACE_TYPE_MISMATCH`` and + returns :ref:`SVG_UNIT_USER`. + + :return: The SVG unit of the SVG surface. + + *New in cairo 1.16.* + + *New in cairocffi 0.9.* + + """ + unit = cairo.cairo_svg_surface_get_document_unit(self._pointer) + self._check_status() + return unit + @staticmethod def get_versions(): """Return the list of supported SVG versions. @@ -1275,8 +1459,8 @@ return tuple(extents) -class Win32Surface(Surface): - """ Creates a cairo surface that targets the given DC. +class Win32Surface(Surface): # pragma: no cover + """Creates a cairo surface that targets the given DC. The DC will be queried for its initial clip extents, and this will be used as the size of the cairo surface. The resulting @@ -1295,13 +1479,12 @@ """ def __init__(self, hdc): - pointer = cairo.cairo_win32_surface_create( - ffi.cast('void*', hdc)) + pointer = cairo.cairo_win32_surface_create(ffi.cast('void*', hdc)) Surface.__init__(self, pointer) -class Win32PrintingSurface(Surface): - """ Creates a cairo surface that targets the given DC. +class Win32PrintingSurface(Surface): # pragma: no cover + """Creates a cairo surface that targets the given DC. The DC will be queried for its initial clip extents, and this will be used as the size of the cairo surface. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/test_cairo.py new/cairocffi-0.9.0/cairocffi/test_cairo.py --- old/cairocffi-0.8.1/cairocffi/test_cairo.py 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/test_cairo.py 2018-07-30 17:54:52.000000000 +0200 @@ -97,9 +97,9 @@ assert data == pixel(b'\x80\x00\x00\x00') * 200 +@pytest.mark.xfail(cairo_version() < 11200, + reason='Cairo version too low') def test_surface_create_similar_image(): - if cairo_version() < 11200: - pytest.xfail() surface = ImageSurface(cairocffi.FORMAT_ARGB32, 20, 30) similar = surface.create_similar_image(cairocffi.FORMAT_A8, 4, 100) assert isinstance(similar, ImageSurface) @@ -109,9 +109,9 @@ assert similar.get_height() == 100 +@pytest.mark.xfail(cairo_version() < 11000, + reason='Cairo version too low') def test_surface_create_for_rectangle(): - if cairo_version() < 11000: - pytest.xfail() surface = ImageSurface(cairocffi.FORMAT_A8, 4, 4) data = surface.get_data() assert data[:] == b'\x00' * 16 @@ -183,9 +183,9 @@ assert sys.getrefcount(target) == initial_refcount +@pytest.mark.xfail(cairo_version() < 11000, + reason='Cairo version too low') def test_mime_data(): - if cairo_version() < 11000: - pytest.xfail() surface = PDFSurface(None, 1, 1) assert surface.get_mime_data('image/jpeg') is None gc.collect() # Clean up KeepAlive stuff from other tests @@ -202,16 +202,138 @@ surface.finish() assert_raise_finished(surface.set_mime_data, 'image/jpeg', None) - +@pytest.mark.xfail(cairo_version() < 11200, + reason='Cairo version too low') def test_supports_mime_type(): - if cairo_version() < 11200: - pytest.xfail() # Also test we get actual booleans: assert PDFSurface(None, 1, 1).supports_mime_type('image/jpeg') is True surface = ImageSurface(cairocffi.FORMAT_A8, 1, 1) assert surface.supports_mime_type('image/jpeg') is False +@pytest.mark.xfail(cairo_version() < 11400, + reason='Cairo version too low') +def test_device_scale(): + surface = PDFSurface(None, 1, 1) + assert surface.get_device_scale() == (1, 1) + surface.set_device_scale(2, 3) + assert surface.get_device_scale() == (2, 3) + + +@pytest.mark.xfail(cairo_version() < 11504, + reason='Cairo version too low') +def test_metadata(): + file_obj = io.BytesIO() + surface = PDFSurface(file_obj, 1, 1) + surface.set_metadata(PDF_METADATA_TITLE, 'title') + surface.set_metadata(PDF_METADATA_SUBJECT, 'subject') + surface.set_metadata(PDF_METADATA_CREATOR, 'creator') + surface.set_metadata(PDF_METADATA_AUTHOR, 'author') + surface.set_metadata(PDF_METADATA_KEYWORDS, 'keywords') + surface.set_metadata(PDF_METADATA_CREATE_DATE, '2013-07-21T23:46:00+01:00') + surface.set_metadata(PDF_METADATA_MOD_DATE, '2013-07-21T23:46:00Z') + surface.finish() + pdf_bytes = file_obj.getvalue() + assert b'/Title (title)' in pdf_bytes + assert b'/Subject (subject)' in pdf_bytes + assert b'/Creator (creator)' in pdf_bytes + assert b'/Author (author)' in pdf_bytes + assert b'/Keywords (keywords)' in pdf_bytes + assert b"/CreationDate (20130721234600+01'00)" in pdf_bytes + assert b'/ModDate (20130721234600Z)' in pdf_bytes + + +@pytest.mark.xfail(cairo_version() < 11504, + reason='Cairo version too low') +def test_outline(): + file_obj = io.BytesIO() + surface = PDFSurface(file_obj, 1, 1) + outline = surface.add_outline( + PDF_OUTLINE_ROOT, 'title 1', 'page=1 pos=[1 1]', + PDF_OUTLINE_FLAG_OPEN & PDF_OUTLINE_FLAG_BOLD) + surface.add_outline(outline, 'title 2', 'page=1 pos=[1 1]') + surface.finish() + pdf_bytes = file_obj.getvalue() + assert b'/Title (title 1)' in pdf_bytes + assert b'/Title (title 2)' in pdf_bytes + + +@pytest.mark.xfail(cairo_version() < 11504, + reason='Cairo version too low') +def test_page_label(): + file_obj = io.BytesIO() + surface = PDFSurface(file_obj, 1, 1) + surface.set_page_label('abc') + surface.finish() + pdf_bytes = file_obj.getvalue() + assert b'/P (abc)' in pdf_bytes + + +@pytest.mark.xfail(cairo_version() < 11504, + reason='Cairo version too low') +def test_tag(): + file_obj = io.BytesIO() + surface = PDFSurface(file_obj, 10, 10) + context = Context(surface) + context.tag_begin('Document') + context.tag_begin( + TAG_LINK, + attributes='rect=[1 2 4 5] uri=\'https://cairocffi.readthedocs.io/\'') + context.set_source_rgba(1, 0, .5, 1) + context.rectangle(2, 3, 4, 5) + context.fill() + context.tag_end(TAG_LINK) + context.tag_end('Document') + context.show_page() + surface.finish() + pdf_bytes = file_obj.getvalue() + assert b'/URI (https://cairocffi.readthedocs.io/)' in pdf_bytes + assert b'/S /Document' in pdf_bytes + + +@pytest.mark.xfail(cairo_version() < 11504, + reason='Cairo version too low') +def test_thumbnail_size(): + file_obj = io.BytesIO() + surface = PDFSurface(file_obj, 1, 1) + surface.set_thumbnail_size(1, 1) + surface.finish() + pdf_bytes1 = file_obj.getvalue() + + file_obj = io.BytesIO() + surface = PDFSurface(file_obj, 1, 1) + surface.set_thumbnail_size(9, 9) + surface.finish() + pdf_bytes2 = file_obj.getvalue() + + assert len(pdf_bytes1) < len(pdf_bytes2) + + +@pytest.mark.xfail(cairo_version() < 11510, + reason='Cairo version too low') +def test_document_unit(): + surface = SVGSurface(None, 1, 2) + assert surface.get_document_unit() == SVG_UNIT_PT + + file_obj = io.BytesIO() + surface = SVGSurface(file_obj, 1, 2) + surface.set_document_unit(SVG_UNIT_PX) + assert surface.get_document_unit() == SVG_UNIT_PX + surface.finish() + pdf_bytes = file_obj.getvalue() + assert b'width="1px"' in pdf_bytes + assert b'height="2px"' in pdf_bytes + + file_obj = io.BytesIO() + surface = SVGSurface(file_obj, 1, 2) + surface.set_document_unit(SVG_UNIT_PC) + assert surface.get_document_unit() == SVG_UNIT_PC + surface.finish() + pdf_bytes = file_obj.getvalue() + assert b'width="1pc"' in pdf_bytes + assert b'height="2pc"' in pdf_bytes + + def test_png(): png_bytes = base64.b64decode( b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQI12O' @@ -255,9 +377,9 @@ surface = ImageSurface.create_from_png(io.BytesIO(b'')) +@pytest.mark.xfail(cairo_version() < 11000, + reason='Cairo version too low') def test_pdf_versions(): - if cairo_version() < 11000: - pytest.xfail() assert set(PDFSurface.get_versions()) >= set([ cairocffi.PDF_VERSION_1_4, cairocffi.PDF_VERSION_1_5]) assert PDFSurface.version_to_string(cairocffi.PDF_VERSION_1_4) == 'PDF 1.4' @@ -292,7 +414,8 @@ pdf_bytes = file_obj.getvalue() assert pdf_bytes.startswith(b'%PDF') assert b'/MediaBox [ 0 0 123 432 ]' in pdf_bytes - assert pdf_bytes.count(b'/Type /Page\n') == 1 + assert pdf_bytes.count(b'/Type /Pages') == 1 + assert pdf_bytes.count(b'/Type /Page') == 2 file_obj = io.BytesIO() surface = PDFSurface(file_obj, 1, 1) @@ -306,7 +429,8 @@ assert b'/MediaBox [ 0 0 1 1 ]' not in pdf_bytes assert b'/MediaBox [ 0 0 12 100 ]' in pdf_bytes assert b'/MediaBox [ 0 0 42 700 ]' in pdf_bytes - assert pdf_bytes.count(b'/Type /Page\n') == 2 + assert pdf_bytes.count(b'/Type /Pages') == 1 + assert pdf_bytes.count(b'/Type /Page') == 3 def test_svg_surface(): @@ -379,9 +503,9 @@ assert b'%%dolor' in ps_bytes +@pytest.mark.xfail(cairo_version() < 11000, + reason='Cairo version too low') def _recording_surface_common(extents): - if cairo_version() < 11000: - pytest.xfail() surface = ImageSurface(cairocffi.FORMAT_ARGB32, 100, 100) empty_pixels = surface.get_data()[:] assert empty_pixels == b'\x00' * 40000 @@ -415,17 +539,16 @@ assert recorded_pixels == text_pixels +@pytest.mark.xfail(cairo_version() < 11200, + reason='Cairo version too low') def test_unbounded_recording_surface(): - if cairo_version() < 11200: - # Unbounded recording surfaces do not seem to record anything on 1.10. - pytest.xfail() text_pixels, recorded_pixels = _recording_surface_common(None) assert recorded_pixels == text_pixels +@pytest.mark.xfail(cairo_version() < 11200, + reason='Cairo version too low') def test_recording_surface_get_extents(): - if cairo_version() < 11200: - pytest.xfail() for extents in [None, (0, 0, 140, 80)]: surface = RecordingSurface(cairocffi.CONTENT_COLOR_ALPHA, extents) assert surface.get_extents() == extents @@ -865,9 +988,9 @@ assert context.clip_extents() == (1, 1, 3, 4) +@pytest.mark.xfail(cairo_version() < 11000, + reason='Cairo version too low') def test_context_in_clip(): - if cairo_version() < 11000: - pytest.xfail() surface = ImageSurface(cairocffi.FORMAT_A8, 4, 4) context = Context(surface) context.rectangle(1, 1, 2, 2) @@ -1050,6 +1173,19 @@ assert options_2 == options_1 +@pytest.mark.xfail(cairo_version() < 11512, + reason='Cairo version too low') +def test_font_options_variations(): + options = FontOptions() + + assert options.get_variations() is None + options.set_variations('wght 400, wdth 300') + assert options.get_variations() == 'wght 400, wdth 300' + options.set_variations(None) + assert options.get_variations() is None + + + def test_glyphs(): surface = ImageSurface(cairocffi.FORMAT_ARGB32, 100, 20) context = Context(surface) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/test_pixbuf.py new/cairocffi-0.9.0/cairocffi/test_pixbuf.py --- old/cairocffi-0.8.1/cairocffi/test_pixbuf.py 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/test_pixbuf.py 2018-07-24 10:57:26.000000000 +0200 @@ -54,6 +54,15 @@ assert_decoded(pixbuf.pixbuf_to_cairo_png(pixbuf_obj)) +def test_size(): + pixbuf_obj, format_name = pixbuf.decode_to_pixbuf(PNG_BYTES, 10, 10) + assert format_name == 'png' + surface = pixbuf.pixbuf_to_cairo_png(pixbuf_obj) + assert surface.get_width() == 10 + assert surface.get_height() == 10 + assert surface.get_format() == constants.FORMAT_ARGB32 + + def test_png(): pixbuf_obj, format_name = pixbuf.decode_to_pixbuf(JPEG_BYTES) assert format_name == 'jpeg' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi/test_xcb.py new/cairocffi-0.9.0/cairocffi/test_xcb.py --- old/cairocffi-0.8.1/cairocffi/test_xcb.py 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi/test_xcb.py 2018-07-23 23:32:36.000000000 +0200 @@ -24,22 +24,18 @@ @pytest.fixture -def xcb_conn(request): +def xcb_conn(): """ Fixture that will setup and take down a xcffib.Connection object running on a display spawned by xvfb """ display = os.environ.get('DISPLAY') - if display: - conn = xcffib.connect(display) - - def teardown_conn(): - conn.disconnect() - else: + if display is None: # pragma: no cover pytest.skip('DISPLAY environment variable not set') - request.addfinalizer(teardown_conn) - return conn + conn = xcffib.connect(display) + yield conn + conn.disconnect() def find_root_visual(conn): @@ -149,6 +145,11 @@ width, height ) + ctx = None + surface = None + xcb_conn.core.FreeGC(gc) + xcb_conn.core.FreePixmap(pixmap) + # flush the connection, make sure no errors were thrown xcb_conn.flush() while event: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi.egg-info/PKG-INFO new/cairocffi-0.9.0/cairocffi.egg-info/PKG-INFO --- old/cairocffi-0.8.1/cairocffi.egg-info/PKG-INFO 2018-05-30 14:40:24.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi.egg-info/PKG-INFO 2018-08-06 17:48:19.000000000 +0200 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: cairocffi -Version: 0.8.1 +Version: 0.9.0 Summary: cffi-based cairo bindings for Python Home-page: https://github.com/SimonSapin/cairocffi Author: Simon Sapin Author-email: simon.sapin@exyr.org License: BSD -Description-Content-Type: UNKNOWN Description: cairocffi ========= @@ -19,16 +18,17 @@ to decode various image formats for use in cairo. .. _CFFI: https://cffi.readthedocs.org/ - .. _Pycairo: http://cairographics.org/pycairo/ + .. _Pycairo: https://pycairo.readthedocs.io/ .. _cairo: http://cairographics.org/ - .. _GDK-PixBuf: https://live.gnome.org/GdkPixbuf + .. _GDK-PixBuf: https://gitlab.gnome.org/GNOME/gdk-pixbuf - * `Latest documentation http://packages.python.org/cairocffi/`_ - * `Source code and issue tracker https://github.com/SimonSapin/cairocffi`_ + * `Latest documentation http://cairocffi.readthedocs.io/en/latest/`_ + * `Source code and issue tracker https://github.com/Kozea/cairocffi`_ on GitHub. * Install with ``pip install cairocffi`` - * Python 2.6, 2.7 and 3.2+. Tested with CPython and Pypy. - * API compatible with Pycairo. + * Python 2.6, 2.7 and 3.4+. `Tested with CPython, PyPy and PyPy3 + https://travis-ci.org/Kozea/cairocffi`_. + * API partially compatible with Pycairo. * Works with any version of cairo. Platform: UNKNOWN @@ -38,3 +38,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia :: Graphics +Provides-Extra: xcb +Provides-Extra: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/cairocffi.egg-info/requires.txt new/cairocffi-0.9.0/cairocffi.egg-info/requires.txt --- old/cairocffi-0.8.1/cairocffi.egg-info/requires.txt 2018-05-30 14:40:24.000000000 +0200 +++ new/cairocffi-0.9.0/cairocffi.egg-info/requires.txt 2018-08-06 17:48:19.000000000 +0200 @@ -1,4 +1,8 @@ cffi>=1.1.0 +[test] +pytest-runner +pytest-cov + [xcb] xcffib>=0.3.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/docs/api.rst new/cairocffi-0.9.0/docs/api.rst --- old/cairocffi-0.8.1/docs/api.rst 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/docs/api.rst 2018-07-24 18:27:49.000000000 +0200 @@ -18,7 +18,7 @@ Surfaces ======== -.. autoclass:: Surface() +.. autoclass:: Surface ImageSurface ------------ @@ -802,6 +802,77 @@ The version 1.5 of the PDF specification. +.. _PDF_OUTLINE: + +PDF outline +----------- + +Used to specify the attributes of an outline item. These flags may be +bitwise-or'd to produce any combination of flags. + +*New in cairo 1.16.* + +*New in cairocffi 0.9.* + +.. data:: PDF_OUTLINE_FLAG_OPEN + + The outline item defaults to open in the PDF viewer. + +.. data:: PDF_OUTLINE_FLAG_BOLD + + The outline item is displayed by the viewer in bold text. + +.. data:: PDF_OUTLINE_FLAG_ITALIC + + The outline item is displayed by the viewer in italic text. + +There's also a constant used to specify the root level for outlines. + +.. data:: PDF_OUTLINE_ROOT + + Root level for outlines. + + +.. _PDF_METADATA: + +PDF metadata +------------ + +Used to specify the metadata to set. + +*New in cairo 1.16.* + +*New in cairocffi 0.9.* + +.. data:: PDF_METADATA_TITLE + + The document title. + +.. data:: PDF_METADATA_AUTHOR + + The document author. + +.. data:: PDF_METADATA_SUBJECT + + The document subject. + +.. data:: PDF_METADATA_KEYWORDS + + The document keywords. + +.. data:: PDF_METADATA_CREATOR + + The document creator. + +.. data:: PDF_METADATA_CREATE_DATE + + The document creation date. + +.. data:: PDF_METADATA_MOD_DATE + + The document modification date. + + .. _PS_LEVEL: PostScript level @@ -836,6 +907,66 @@ The version 1.2 of the SVG specification. +.. _SVG_UNIT: + +SVG unit +-------- + +Used to describe the units valid for coordinates and lengths in the SVG +specification. + +See also: + +- https://www.w3.org/TR/SVG/coords.html#Units +- https://www.w3.org/TR/SVG/types.html#DataTypeLength +- https://www.w3.org/TR/css-values-3/#lengths + +*New in cairo 1.16.* + +*New in cairocffi 0.9.* + +.. data:: SVG_UNIT_USER + + User unit, a value in the current coordinate system. If used in the root + element for the initial coordinate systems it corresponds to pixels. + +.. data:: SVG_UNIT_EM + + The size of the element's font. + +.. data:: SVG_UNIT_EX + + The x-height of the element’s font. + +.. data:: SVG_UNIT_PX + + Pixels (1px = 1/96th of 1in). + +.. data:: SVG_UNIT_IN + + Inches (1in = 2.54cm = 96px). + +.. data:: SVG_UNIT_CM + + Centimeters (1cm = 96px/2.54). + +.. data:: SVG_UNIT_MM + + Millimeters (1mm = 1/10th of 1cm). + +.. data:: SVG_UNIT_PT + + Points (1pt = 1/72th of 1in). + +.. data:: SVG_UNIT_PC + + Picas (1pc = 1/6th of 1in). + +.. data:: SVG_UNIT_PERCENT + + Percent, a value that is some fraction of another reference value. + + .. _cluster-flags: Cluster flags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/docs/overview.rst new/cairocffi-0.9.0/docs/overview.rst --- old/cairocffi-0.8.1/docs/overview.rst 2016-10-15 14:49:52.000000000 +0200 +++ new/cairocffi-0.9.0/docs/overview.rst 2018-07-30 17:26:40.000000000 +0200 @@ -81,14 +81,13 @@ cairo versions -------------- -Cairo, pycairo, and cairocffi each have version numbers. The same cairocffi version can -be used with a variety of cairo versions. -For example, the :meth:`Surface.set_mime_data` method is based on -the :c:func:`cairo_surface_set_mime_data` C function, -which is only available since cairo 1.10. -You will get a runtime exception if you try to use it with an older cairo. -You can however still use the rest of the API. -There is no need for cairocffi’s versions to be tied to cairo’s versions. +Cairo, pycairo, and cairocffi each have version numbers. The same cairocffi +version can be used with a variety of cairo versions. For example, the +:meth:`Surface.set_mime_data` method is based on the +:c:func:`cairo_surface_set_mime_data` C function, which is only available since +cairo 1.10. You will get a runtime exception if you try to use it with an older +cairo. You can however still use the rest of the API. There is no need for +cairocffi’s versions to be tied to cairo’s versions. Use :func:`cairo_version` to test the version number for cairo:: @@ -106,8 +105,9 @@ >>> print("The cairocffi version is %s." % cairo.VERSION) The cairocffi version is 0.7.2 -cairocffi is tested with both cairo 1.8.2 and the latest -(1.12.8 as of this writing.) +cairocffi is automatically tested with both cairo 1.13.0 (Ubuntu Trusty's +default version) and manually tested with the latest (1.15.12 as of this +writing.) Compatibility with Pycairo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/setup.cfg new/cairocffi-0.9.0/setup.cfg --- old/cairocffi-0.8.1/setup.cfg 2018-05-30 14:40:24.000000000 +0200 +++ new/cairocffi-0.9.0/setup.cfg 2018-08-06 17:48:19.000000000 +0200 @@ -2,8 +2,12 @@ source-dir = docs build-dir = docs/_build -[upload_sphinx] -upload-dir = docs/_build/html +[aliases] +test = pytest + +[tool:pytest] +addopts = --cov +norecursedirs = build dist .cache .eggs .git [egg_info] tag_build = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/setup.py new/cairocffi-0.9.0/setup.py --- old/cairocffi-0.8.1/setup.py 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/setup.py 2018-07-24 09:57:09.000000000 +0200 @@ -1,7 +1,8 @@ -from setuptools import setup, find_packages from os import path -import re +from setuptools import setup, find_packages import io +import re +import sys VERSION = re.search( @@ -17,6 +18,9 @@ encoding='utf-8', ).read() +needs_pytest = set(('pytest', 'test', 'ptr')).intersection(sys.argv) +pytest_runner = ['pytest-runner'] if needs_pytest else [] + setup( name='cairocffi', version=VERSION, @@ -36,10 +40,14 @@ ], packages=find_packages(), install_requires=['cffi>=1.1.0'], - setup_requires=['cffi>=1.1.0'], + setup_requires=['cffi>=1.1.0'] + pytest_runner, cffi_modules=[ 'cairocffi/ffi_build.py:ffi', 'cairocffi/ffi_build.py:ffi_pixbuf' ], - extras_require={'xcb': ['xcffib>=0.3.2']}, + tests_require=['pytest-runner', 'pytest-cov'], + extras_require={ + 'xcb': ['xcffib>=0.3.2'], + 'test': ['pytest-runner', 'pytest-cov'], + }, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/utils/mkconstants.py new/cairocffi-0.9.0/utils/mkconstants.py --- old/cairocffi-0.8.1/utils/mkconstants.py 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/utils/mkconstants.py 2018-07-24 22:55:16.000000000 +0200 @@ -15,6 +15,14 @@ class PrintEnumsVisitor(pycparser.c_ast.NodeVisitor): + def visit_Decl(self, node): + if node.name and node.name.startswith('CAIRO_'): # len('CAIRO_') == 6 + if node.init.type == 'string': + print('%s = b%s' % (node.name[6:], node.init.value)) + else: + print('%s = %s' % (node.name[6:], node.init.value)) + print('') + def visit_Enum(self, node): value = 0 for enumerator in node.values.enumerators: @@ -31,7 +39,7 @@ def read_cairo_header(cairo_git_dir, suffix): filename = os.path.join(cairo_git_dir, 'src', 'cairo%s.h' % suffix) - source = open(filename).read() + source = open(filename, encoding='iso-8859-1').read() source = re.sub( '/\*.*?\*/' '|CAIRO_(BEGIN|END)_DECLS' @@ -46,8 +54,17 @@ def generate(cairo_git_dir): # Remove comments, preprocessor instructions and macros. - source = read_cairo_header(cairo_git_dir, '') + source = ''' + const char* CAIRO_TAG_DEST = "cairo.dest"; + const char* CAIRO_TAG_LINK = "Link"; + ''' + source += read_cairo_header(cairo_git_dir, '') + + source += ''' + const int CAIRO_PDF_OUTLINE_ROOT = 0; + ''' source += read_cairo_header(cairo_git_dir, '-pdf') + source += read_cairo_header(cairo_git_dir, '-ps') source += read_cairo_header(cairo_git_dir, '-svg') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cairocffi-0.8.1/utils/pango_example.py new/cairocffi-0.9.0/utils/pango_example.py --- old/cairocffi-0.8.1/utils/pango_example.py 2016-08-26 18:06:11.000000000 +0200 +++ new/cairocffi-0.9.0/utils/pango_example.py 2018-07-21 19:12:23.000000000 +0200 @@ -4,9 +4,9 @@ ffi = cffi.FFI() -ffi.include(cairocffi.ffi) ffi.cdef(''' /* GLib */ + typedef void cairo_t; typedef void* gpointer; void g_object_unref (gpointer object);