pycairo icon indicating copy to clipboard operation
pycairo copied to clipboard

Update cairo bundled in windows wheels

Open naveen521kk opened this issue 4 years ago • 3 comments

  • 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)

naveen521kk avatar Oct 21 '21 09:10 naveen521kk

Now that Cairo 1.17.6 is out I'll try this PR with that version.

naveen521kk avatar Mar 19 '22 09:03 naveen521kk

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

naveen521kk avatar Mar 19 '22 15:03 naveen521kk

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 ==================

naveen521kk avatar Jun 12 '22 05:06 naveen521kk

Thanks!

naveen521kk avatar Nov 27 '22 18:11 naveen521kk

thank you! sorry for the delay

lazka avatar Nov 28 '22 19:11 lazka