Reenable PyQt 5.6 PyPI tests
To avoid segfaults we need to hardcode the sip version. We also need to write a Qt.conf as it was missing with PyQt 5.6 and QtWebEngine can't find its resources.
This commit is contained in:
parent
79d22f2505
commit
abded2470a
@ -21,6 +21,10 @@ matrix:
|
||||
- os: linux
|
||||
env: DOCKER=ubuntu-xenial
|
||||
services: docker
|
||||
- os: linux
|
||||
language: python
|
||||
python: 3.5
|
||||
env: TESTENV=py35-pyqt56
|
||||
- os: linux
|
||||
language: python
|
||||
python: 3.6
|
||||
|
@ -154,6 +154,15 @@ def link_pyqt(executable, venv_path):
|
||||
copy_or_link(path, dest)
|
||||
|
||||
|
||||
def patch_pypi_pyqt(venv_path):
|
||||
executable = get_venv_executable(venv_path)
|
||||
pyqt_dir = os.path.dirname(get_lib_path(executable, 'PyQt5.QtCore'))
|
||||
qt_conf = os.path.join(pyqt_dir, 'Qt', 'libexec', 'qt.conf')
|
||||
with open(qt_conf, 'w', encoding='utf-8') as f:
|
||||
f.write('[Paths]\n')
|
||||
f.write('Prefix = ..\n')
|
||||
|
||||
|
||||
def copy_or_link(source, dest):
|
||||
"""Copy or symlink source to dest."""
|
||||
if os.name == 'nt':
|
||||
@ -177,11 +186,15 @@ def remove(filename):
|
||||
os.unlink(filename)
|
||||
|
||||
|
||||
def get_venv_executable(path):
|
||||
"""Get the Python executable in a virtualenv."""
|
||||
subdir = 'Scripts' if os.name == 'nt' else 'bin'
|
||||
return os.path.join(path, subdir, 'python')
|
||||
|
||||
|
||||
def get_venv_lib_path(path):
|
||||
"""Get the library path of a virtualenv."""
|
||||
subdir = 'Scripts' if os.name == 'nt' else 'bin'
|
||||
executable = os.path.join(path, subdir, 'python')
|
||||
return run_py(executable,
|
||||
return run_py(get_venv_executable(path),
|
||||
'from distutils.sysconfig import get_python_lib',
|
||||
'print(get_python_lib())')
|
||||
|
||||
@ -200,15 +213,19 @@ def main():
|
||||
parser.add_argument('path', help="Base path to the venv.")
|
||||
parser.add_argument('--tox', help="Add when called via tox.",
|
||||
action='store_true')
|
||||
parser.add_argument('--pypi', help="Patch a PyPI-installed PyQt 5.6",
|
||||
action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.tox:
|
||||
executable = get_tox_syspython(args.path)
|
||||
if args.pypi:
|
||||
patch_pypi_pyqt(args.path)
|
||||
else:
|
||||
executable = sys.executable
|
||||
|
||||
venv_path = get_venv_lib_path(args.path)
|
||||
link_pyqt(executable, venv_path)
|
||||
if args.tox:
|
||||
executable = get_tox_syspython(args.path)
|
||||
else:
|
||||
executable = sys.executable
|
||||
venv_path = get_venv_lib_path(args.path)
|
||||
link_pyqt(executable, venv_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
5
tox.ini
5
tox.ini
@ -66,7 +66,10 @@ passenv = {[testenv]passenv}
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
PyQt5==5.6
|
||||
commands = {envpython} scripts/dev/run_pytest.py {posargs:tests}
|
||||
sip==4.18.1
|
||||
commands =
|
||||
{envpython} scripts/link_pyqt.py --pypi {envdir}
|
||||
{envpython} scripts/dev/run_pytest.py {posargs:tests}
|
||||
|
||||
[testenv:py35-pyqt571]
|
||||
basepython = python3.5
|
||||
|
Loading…
Reference in New Issue
Block a user