Browse Source

Include tools also on python 3.4

This result only in small limitation in qvm-start-gui tool, but allow
to use the tools from Debian jessie based VM (python 3.4.2).
Marek Marczykowski-Górecki 7 years ago
parent
commit
f4d6ac2880
2 changed files with 13 additions and 2 deletions
  1. 10 1
      qubesadmin/tools/qvm_start_gui.py
  2. 3 1
      setup.py

+ 10 - 1
qubesadmin/tools/qvm_start_gui.py

@@ -30,9 +30,14 @@ import re
 
 import daemon.pidfile
 import qubesadmin
-import qubesadmin.events
 import qubesadmin.tools
 import qubesadmin.vm
+have_events = False
+try:
+    import qubesadmin.events
+    have_events = True
+except ImportError:
+    pass
 
 GUI_DAEMON_PATH = '/usr/bin/qubes-guid'
 QUBES_ICON_DIR = '/usr/share/icons/hicolor/128x128/devices'
@@ -337,9 +342,13 @@ def main(args=None):
         parser.error('--watch cannot be used with --notify-monitor-layout')
     launcher = GUILauncher(args.app)
     if args.watch:
+        if not have_events:
+            parser.error('--watch option require Python >= 3.5')
         with daemon.pidfile.TimeoutPIDLockFile(args.pidfile):
             loop = asyncio.get_event_loop()
+            # pylint: disable=no-member
             events = qubesadmin.events.EventsDispatcher(args.app)
+            # pylint: enable=no-member
             launcher.register_events(events)
 
             events_listener = asyncio.ensure_future(events.listen_for_events())

+ 3 - 1
setup.py

@@ -4,8 +4,10 @@ import setuptools
 import sys
 
 exclude=[]
+if sys.version_info[0:2] < (3, 4):
+    exclude += ['qubesadmin.tools', 'qubesadmin.tests.tools']
 if sys.version_info[0:2] < (3, 5):
-    exclude = ['qubesadmin.events', 'qubesadmin.tools', 'qubesadmin.tests.tools']
+    exclude += ['qubesadmin.events']
 
 if __name__ == '__main__':
     setuptools.setup(