Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b81313a

Browse files
committed
Update code to use cairocffi/pycairo compatible API to determine if
PDF/PS/SVG backends are available.
1 parent 87bdb63 commit b81313a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/backends/backend_cairo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,17 +468,17 @@ def _save (self, fo, format, **kwargs):
468468
width_in_points)
469469

470470
if format == 'ps':
471-
if not cairo.HAS_PS_SURFACE:
471+
if not hasattr(cairo, 'PSSurface'):
472472
raise RuntimeError ('cairo has not been compiled with PS '
473473
'support enabled')
474474
surface = cairo.PSSurface (fo, width_in_points, height_in_points)
475475
elif format == 'pdf':
476-
if not cairo.HAS_PDF_SURFACE:
476+
if not hasattr(cairo, 'PDFSurface'):
477477
raise RuntimeError ('cairo has not been compiled with PDF '
478478
'support enabled')
479479
surface = cairo.PDFSurface (fo, width_in_points, height_in_points)
480480
elif format in ('svg', 'svgz'):
481-
if not cairo.HAS_SVG_SURFACE:
481+
if not hasattr(cairo, 'SVGSurface'):
482482
raise RuntimeError ('cairo has not been compiled with SVG '
483483
'support enabled')
484484
if format == 'svgz':

0 commit comments

Comments
 (0)