# (c) Copyright 2013-2017. CodeWeavers, Inc.
"""
CrossOver is not compatible with Python 3 so try to find a more compatible
Python version to run it with.
See also checkgtk.py.
"""
import sys
if sys.version_info >= (3,):
import os
try:
os.execvp('python2', ['python2'] + sys.argv)
except OSError:
from cxutils import cxgettext as _
# For compatibility with Python 3, treat print as a function.
# pylint: disable=C0325
print(_("Could not find a suitable Python 2 interpreter. Will now try to install one."))
# Getting the Python 2 GTK+ modules will automatically get us a suitable
# Python 2 interpreter.
import cxfixes
cxfixes.add_error('gtk2')
cxfixes.fix_errors()
try:
os.execvp('python2', ['python2'] + sys.argv)
except OSError:
cxfixes.report_errors()
sys.exit(1)