pycairo
pycairo copied to clipboard
Update cairo bundled in windows wheels
- Closes https://github.com/pygobject/pycairo/issues/242.
- Use a prebuilt version of Cairo from https://github.com/pygobject/cairo-win-build, https://github.com/pygobject/cairo-win-build/releases/tag/1.17.6. It's a static build of Cairo.
- Use pkg-config for finding build flags even on Windows/MSVC compiler.
- Build and test wheels using cibuildwheel for Windows.
- Skip the cmodule if the module isn't built. (useful when testing the wheels)
Now that Cairo 1.17.6 is out I'll try this PR with that version.
It's getting fun: the tests are failing with a MemoryError (???).
___________________________ test_show_unicode_text ____________________________
def test_show_unicode_text():
width, height = 300, 300
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
ctx = cairo.Context(surface)
ctx.scale(width, height)
ctx.set_line_width(0.04)
ctx.select_font_face(
> "Sans", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
E tests.test_api.cairo.MemoryError: out of memory
tests\test_api.py:48: cairo.MemoryError
____________________________ test_show_text_glyphs ____________________________
@pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="PyPy")
def test_show_text_glyphs():
surface = cairo.PDFSurface(None, 300, 300)
context = cairo.Context(surface)
context.scale(300, 300)
context.select_font_face("Sans", cairo.FONT_SLANT_NORMAL,
> cairo.FONT_WEIGHT_NORMAL)
E tests.test_context.cairo.MemoryError: out of memory
tests\test_context.py:67: cairo.MemoryError
_____________________ test_svg_surface_get_document_unit ______________________
@pytest.mark.skipif(not hasattr(cairo.SVGSurface, "get_document_unit"),
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
E AssertionError: assert cairo.SVGUnit.USER == cairo.SVGUnit.PT
E + where cairo.SVGUnit.USER = <built-in method get_document_unit of cairo.SVGSurface object at 0x0000018C55CD52B0>()
E + where <built-in method get_document_unit of cairo.SVGSurface object at 0x0000018C55CD52B0> = <cairo.SVGSurface object at 0x0000018C55CD52B0>.get_document_unit
E + and cairo.SVGUnit.PT = <class 'cairo.SVGUnit'>.PT
E + where <class 'cairo.SVGUnit'> = cairo.SVGUnit
tests\test_surface.py:270: AssertionError
_________________________ test_pdf_version_to_string __________________________
def test_pdf_version_to_string():
ver = cairo.PDFSurface.version_to_string(cairo.PDF_VERSION_1_4)
assert ver and isinstance(ver, str)
with pytest.raises(ValueError):
> cairo.PDFSurface.version_to_string(-1)
E Failed: DID NOT RAISE <class 'ValueError'>
tests\test_surface.py:303: Failed
there's only one error now after updating release with the patch related to dwrite: https://github.com/pygobject/cairo-win-build/commit/0f53b7dbb65c35fc426127c29e6ff7ab74134ed4
_________________________ test_pdf_version_to_string __________________________
def test_pdf_version_to_string():
ver = cairo.PDFSurface.version_to_string(cairo.PDF_VERSION_1_4)
assert ver and isinstance(ver, str)
with pytest.raises(ValueError):
> cairo.PDFSurface.version_to_string(-1)
E Failed: DID NOT RAISE <class 'ValueError'>
tests\test_surface.py:306: Failed
=========================== short test summary info ===========================
FAILED tests/test_surface.py::test_pdf_version_to_string - Failed: DID NOT RA...
================== 1 failed, 269 passed, 5 skipped in 22.47s ==================
Thanks!
thank you! sorry for the delay