Skip to content

Commit

Permalink
Possible workarond for rtd lack of Pango
Browse files Browse the repository at this point in the history
  • Loading branch information
stuaxo committed May 2, 2016
1 parent 0a4d97f commit 264ad54
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions shoebot/data/typography.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,22 @@
else:
_UNSAFE_cairocffi_context_to_pycairo = None

gi.require_version('Pango', '1.0')
gi.require_version('PangoCairo', '1.0')
from gi.repository import Pango, PangoCairo
try:
gi.require_version('Pango', '1.0')
gi.require_version('PangoCairo', '1.0')
from gi.repository import Pango, PangoCairo
except ImportError as e:
global Pango, PangoCairo

# workaround for readthedocs where Pango is not installed
print("Pango not found - typography will not be available.")

class FakePango(object):
def __getattr__(self, item):
raise e
Pango = FakePango()
PangoCairo = FakePango()

## from shoebot.data import Grob, BezierPath, TransformMixin, ColorMixin, _copy_attrs
from shoebot.data import Grob, BezierPath, ColorMixin, _copy_attrs
from cairocffi import PATH_MOVE_TO, PATH_LINE_TO, PATH_CURVE_TO, PATH_CLOSE_PATH
Expand Down

0 comments on commit 264ad54

Please sign in to comment.