- update to 1.5.1:

* move to pyproject.toml
  * Try to support and test more Python versions
  * Catch more errors when creating PNG files
  * Include utils and docs in the source package
  * Include all Setuptool’s building functions in custom 
    building script
  * Build generated files manually when building wheels
  * Install xcffib if possible during the wheel generation
- add skip-pikepdf.patch to skip pikepdf from tests
- use LICENSE from package

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cairocffi?expand=0&rev=54
This commit is contained in:
Dirk Mueller 2023-05-05 09:48:23 +00:00 committed by Git OBS Bridge
parent e4826bed60
commit 901d9c6fef
6 changed files with 79 additions and 57 deletions

29
LICENSE
View File

@ -1,29 +0,0 @@
BSD 3-Clause License
Copyright (c) 2013-2019, Simon Sapin and contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

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

BIN
cairocffi-1.5.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Fri May 5 09:45:47 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 1.5.1:
* move to pyproject.toml
* Try to support and test more Python versions
* Catch more errors when creating PNG files
* Include utils and docs in the source package
* Include all Setuptools building functions in custom
building script
* Build generated files manually when building wheels
* Install xcffib if possible during the wheel generation
- add skip-pikepdf.patch to skip pikepdf from tests
- use LICENSE from package
-------------------------------------------------------------------
Fri Apr 21 12:23:03 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -18,20 +18,19 @@
%{?sle15_python_module_pythons}
Name: python-cairocffi
Version: 1.4.0
Version: 1.5.1
Release: 0
Summary: Python cairo bindings based on cffi
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/Kozea/cairocffi
Source: https://files.pythonhosted.org/packages/source/c/cairocffi/cairocffi-%{version}.tar.gz
# https://github.com/Kozea/cairocffi/issues/208
Source1: https://raw.githubusercontent.com/Kozea/cairocffi/master/LICENSE
# avoid pikepdf in Ring1, skipping the pikepdf related tests
Patch1: skip-pikepdf.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module cffi >= 1.1.0}
# we don't want pikepdf in Ring1 stagings
#BuildRequires: %{python_module pikepdf}
BuildRequires: %{python_module setuptools >= 39.2.0}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module xcffib >= 0.3.2}
BuildRequires: cairo
Requires: cairo
@ -70,33 +69,18 @@ including image buffers, PNG, PostScript, PDF, and SVG file output.
This package provides the optional gdk-pixbuf image loader module.
%prep
%autosetup -n cairocffi-%{version} -p1
cp %{SOURCE1} .
# disable development tools for unit tests. Remove deprecated pytest-runner
sed -i -e 's/pytest-runner$/pytest/' \
-e '/pytest-flake8$/ d' \
-e '/pytest-isort$/ d' \
-e '/pytest-cov$/ d' \
-e '/^addopts.*flake8.*isort$/ d' setup.cfg
mkdir tests
mv cairocffi/test_*.py tests/
sed -i 's/^from \. /from cairocffi /' tests/*.py
sed -i 's/^from \./from cairocffi./' tests/*.py
%autosetup -p1 -n cairocffi-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
cd tests/
# test_cairo.py needs pikepdf, remove it
rm test_cairo.py
# Switch off test_xcb_window (gh#Kozea/cairocffi#203)
%python_expand PYTHONPATH="%{buildroot}%{$python_sitelib}" xvfb-run --server-args="-screen 0 1280x1024x16" $python -m pytest -k "not test_xcb_window" *.py
%python_expand PYTHONPATH="%{buildroot}%{$python_sitelib}" xvfb-run --server-args="-screen 0 1280x1024x16" $python -m pytest -k "not test_xcb_window"
%files %{python_files}
%license LICENSE

52
skip-pikepdf.patch Normal file
View File

@ -0,0 +1,52 @@
Index: cairocffi-1.5.1/cairocffi/test_cairo.py
===================================================================
--- cairocffi-1.5.1.orig/cairocffi/test_cairo.py
+++ cairocffi-1.5.1/cairocffi/test_cairo.py
@@ -21,7 +21,6 @@ import sys
import tempfile
import cairocffi
-import pikepdf
import pytest
from . import (
@@ -239,6 +238,7 @@ def test_device_scale():
@pytest.mark.xfail(cairo_version() < 11504,
reason='Cairo version too low')
+@pytest.mark.skip(reason="No pikepdf")
def test_metadata():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 1, 1)
@@ -264,6 +264,7 @@ def test_metadata():
@pytest.mark.xfail(cairo_version() < 11504,
reason='Cairo version too low')
+@pytest.mark.skip(reason="No pikepdf")
def test_outline():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 1, 1)
@@ -280,6 +281,7 @@ def test_outline():
@pytest.mark.xfail(cairo_version() < 11504,
reason='Cairo version too low')
+@pytest.mark.skip(reason="No pikepdf")
def test_page_label():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 1, 1)
@@ -291,6 +293,7 @@ def test_page_label():
@pytest.mark.xfail(cairo_version() < 11504,
reason='Cairo version too low')
+@pytest.mark.skip(reason="No pikepdf")
def test_tag():
file_obj = io.BytesIO()
surface = PDFSurface(file_obj, 10, 10)
@@ -419,6 +422,7 @@ def test_pdf_versions():
assert file_obj.getvalue().startswith(b'%PDF-1.4')
+@pytest.mark.skip(reason="No pikepdf")
def test_pdf_surface():
with temp_directory() as tempdir:
filename = os.path.join(tempdir, 'foo.pdf')