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).
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-11 23:40:49 +02:00
parent 4ceff0f8c0
commit f4d6ac2880
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 13 additions and 2 deletions

View File

@ -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())

View File

@ -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(