Skip to content

Commit

Permalink
Merge pull request git-cola#44 from ccordoba12/fix-qtapi
Browse files Browse the repository at this point in the history
Make qtpy to set the QT_API environment variable
  • Loading branch information
ccordoba12 committed Jul 1, 2016
2 parents 6c5eae1 + 0e5ae07 commit 27e350a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions qtpy/__init__.py
Expand Up @@ -67,7 +67,8 @@
#: names of the expected PySide api
PYSIDE_API = ['pyside']

API = os.environ.get(QT_API, 'pyqt5').lower()
os.environ.setdefault(QT_API, 'pyqt5')
API = os.environ[QT_API]
assert API in (PYQT5_API + PYQT4_API + PYSIDE_API)

is_old_pyqt = is_pyqt46 = False
Expand All @@ -86,7 +87,7 @@ class PythonQtError(Exception):
from PyQt5.Qt import QT_VERSION_STR as QT_VERSION # analysis:ignore
PYSIDE_VERSION = None
except ImportError:
API = 'pyqt'
API = os.environ['QT_API'] = 'pyqt'

if API in PYQT4_API:
try:
Expand All @@ -108,7 +109,7 @@ class PythonQtError(Exception):
PYQT5 = False
PYQT4 = True
except ImportError:
API = 'pyside'
API = os.environ['QT_API'] = 'pyside'
else:
is_old_pyqt = PYQT_VERSION.startswith(('4.4', '4.5', '4.6', '4.7'))
is_pyqt46 = PYQT_VERSION.startswith('4.6')
Expand Down

0 comments on commit 27e350a

Please sign in to comment.