Accepting request 1003355 from home:iznogood:factory

- Update to version 1.21.0:
  * Require Python 3.7+
  * Require meson 0.53+
  * Using setup.py directly to build/install pycairo is deprecated.
    Use meson instead.
  * setup.py now requires setuptools. Previously it was optional.
  * The complete API reference is now included in the typing stubs,
    so it can be consumed/shown by IDEs.
- Add f5a795ea.patch: Some test improvements for cairo 1.17.6

OBS-URL: https://build.opensuse.org/request/show/1003355
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pycairo?expand=0&rev=16
This commit is contained in:
Matej Cepl 2022-09-15 07:47:38 +00:00 committed by Git OBS Bridge
parent dea75cdaf6
commit 8c6a0f3b8d
5 changed files with 123 additions and 6 deletions

101
f5a795ea.patch Normal file
View File

@ -0,0 +1,101 @@
From 807241feafdd04c2b90c92c86dc4e00bc06a3d33 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sat, 19 Mar 2022 17:36:03 +0100
Subject: [PATCH 1/3] tests: test passing a font family to ToyFontFace
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The new backend in cairo 1.17.6 has problems with this, but we never
tested this directly on the Python level.
Śee https://gitlab.freedesktop.org/cairo/cairo/-/issues/544
---
tests/test_font.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/test_font.py b/tests/test_font.py
index c4dfa80f..5d3e27aa 100644
--- a/tests/test_font.py
+++ b/tests/test_font.py
@@ -204,6 +204,10 @@ def test_toy_font_face():
def test_toy_font_get_family():
font_face = cairo.ToyFontFace("")
assert isinstance(font_face.get_family(), str)
+ font_face = cairo.ToyFontFace("serif")
+ assert isinstance(font_face.get_family(), str)
+ font_face = cairo.ToyFontFace("sans-serif")
+ assert isinstance(font_face.get_family(), str)
def test_toy_font_get_slant():
From 678edd94d8a6dfb5d51f9c3549e6ee8c90a73744 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sat, 19 Mar 2022 17:37:32 +0100
Subject: [PATCH 2/3] tests: allow a different default document unit for
SVGSurface
It was changed upstream, despite being documented.
See https://gitlab.freedesktop.org/cairo/cairo/-/issues/545
---
tests/test_surface.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/test_surface.py b/tests/test_surface.py
index 20f1bd4a..503bc50e 100644
--- a/tests/test_surface.py
+++ b/tests/test_surface.py
@@ -267,7 +267,10 @@ def test_svg_version_to_string():
reason="too old cairo")
def test_svg_surface_get_document_unit():
with cairo.SVGSurface(None, 10, 10) as surface:
- assert surface.get_document_unit() == cairo.SVGUnit.PT
+ # https://gitlab.freedesktop.org/cairo/cairo/-/issues/545
+ assert surface.get_document_unit() in [cairo.SVGUnit.PT, cairo.SVGUnit.USER]
+
+ with cairo.SVGSurface(None, 10, 10) as surface:
surface.set_document_unit(cairo.SVGUnit.PX)
assert surface.get_document_unit() == cairo.SVGUnit.PX
with pytest.raises(cairo.Error):
From 843e3db002e8d114362e6714babfffc400dbe4c0 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sat, 19 Mar 2022 18:10:53 +0100
Subject: [PATCH 3/3] CI: add a special hypothesis settings profile for CI
Increase the deadline and run more tests
---
tests/test_hypothesis.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/test_hypothesis.py b/tests/test_hypothesis.py
index 80ebb5bc..c76bc319 100644
--- a/tests/test_hypothesis.py
+++ b/tests/test_hypothesis.py
@@ -17,6 +17,16 @@
from .hypothesis_fspaths import fspaths
+if "CI" in os.environ:
+ # CI can be slow, so be patient
+ # Also we can run more tests there
+ settings.register_profile(
+ "ci",
+ deadline=settings.default.deadline * 5,
+ max_examples=settings.default.max_examples * 5)
+ settings.load_profile("ci")
+
+
@pytest.fixture(scope='module')
def tempdir_path():
dir_ = tempfile.mkdtemp()
@@ -44,7 +54,6 @@ def cairo_ver():
platform.python_implementation() == "PyPy" and sys.pypy_version_info < (7, 3, 0),
reason="PyPy bugs")
@given(path=fspaths())
-@settings(max_examples=500)
def test_fspaths(tempdir_path, path):
p = _to_temp_path(tempdir_path, path)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1ee72b035b21a475e1ed648e26541b04e5d7e753d75ca79de8c583b25785531b
size 344639

3
pycairo-1.21.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:251907f18a552df938aa3386657ff4b5a4937dde70e11aa042bc297957f4b74b
size 340712

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Tue Sep 13 15:10:32 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 1.21.0:
* Require Python 3.7+
* Require meson 0.53+
* Using setup.py directly to build/install pycairo is deprecated.
Use meson instead.
* setup.py now requires setuptools. Previously it was optional.
* The complete API reference is now included in the typing stubs,
so it can be consumed/shown by IDEs.
- Add f5a795ea.patch: Some test improvements for cairo 1.17.6
-------------------------------------------------------------------
Sat Jul 16 22:51:05 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@ -20,12 +20,15 @@
%define skip_python2 1
%define oldpython python
Name: python-pycairo
Version: 1.20.1
Version: 1.21.0
Release: 0
Summary: Python Bindings for Cairo
License: LGPL-2.1-or-later OR MPL-1.1
URL: https://github.com/pygobject/pycairo
Source: https://github.com/pygobject/pycairo/releases/download/v%{version}/pycairo-%{version}.tar.gz
Source: %{url}/releases/download/v%{version}/pycairo-%{version}.tar.gz
# PATCH-FIX-UPSTREAM f5a795ea.patch -- Some test improvements for cairo 1.17.6
Patch: %{url}/commit/f5a795ea.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
@ -71,7 +74,7 @@ This package provides the headers and development files needed to build
packages that depend on Pycairo.
%prep
%setup -q -n pycairo-%{version}
%autosetup -n pycairo-%{version} -p1
%build
%python_build