test_xgps_deps.py 685 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python
  2. """Test imports needed by X11-based tools."""
  3. from __future__ import print_function
  4. import os
  5. import sys
  6. # Keep Gtk from trying to launch X11.
  7. # Pylint seems to defeat this hack, but we can live with that.
  8. os.environ['DISPLAY'] = ''
  9. # pylint: disable=unused-import,wrong-import-position
  10. import cairo
  11. import gi
  12. try:
  13. gi.require_version('Gtk', '3.0')
  14. except (AttributeError, ValueError):
  15. # Explain the reason for the exception, then reraise
  16. print('*** Need PyGObject V3 or later, and Gtk3 ***', file=sys.stderr)
  17. raise
  18. from gi.repository import GObject
  19. from gi.repository import Gtk
  20. from gi.repository import Gdk
  21. from gi.repository import Pango