scripts: Allow linking/installing pyqt-5 or pyqt-6
This commit is contained in:
parent
ff1e165be1
commit
9212ba94d6
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically generated by scripts/dev/recompile_requirements.py
|
||||
|
||||
PyQt5==5.15.6
|
||||
PyQt5-Qt5==5.15.2
|
||||
PyQt5-sip==12.10.1
|
||||
PyQtWebEngine==5.15.5
|
||||
PyQtWebEngine-Qt5==5.15.2
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
PyQt5
|
||||
PyQtWebEngine
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically generated by scripts/dev/recompile_requirements.py
|
||||
|
||||
PyQt6==6.3.0
|
||||
PyQt6-Qt6==6.3.0
|
||||
PyQt6-sip==13.3.1
|
||||
PyQt6-WebEngine==6.3.0
|
||||
PyQt6-WebEngine-Qt6==6.3.0
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
PyQt6
|
||||
PyQt6-Qt6
|
||||
PyQt6-WebEngine
|
||||
PyQt6-WebEngine-Qt6
|
||||
|
|
@ -126,15 +126,19 @@ def get_lib_path(executable, name, required=True):
|
|||
raise ValueError("Unexpected output: {!r}".format(output))
|
||||
|
||||
|
||||
def link_pyqt(executable, venv_path):
|
||||
def link_pyqt(executable, venv_path, *, version='5'):
|
||||
"""Symlink the systemwide PyQt/sip into the venv.
|
||||
|
||||
Args:
|
||||
executable: The python executable where the source files are present.
|
||||
venv_path: The path to the virtualenv site-packages.
|
||||
version: The PyQt version to use.
|
||||
"""
|
||||
if version not in ["5", "6"]:
|
||||
raise ValueError(f"Invalid version {version}")
|
||||
|
||||
try:
|
||||
get_lib_path(executable, 'PyQt5.sip')
|
||||
get_lib_path(executable, f'PyQt{version}.sip')
|
||||
except Error:
|
||||
# There is no PyQt5.sip, so we need to copy the toplevel sip.
|
||||
sip_file = get_lib_path(executable, 'sip')
|
||||
|
|
@ -143,7 +147,7 @@ def link_pyqt(executable, venv_path):
|
|||
sip_file = None
|
||||
|
||||
sipconfig_file = get_lib_path(executable, 'sipconfig', required=False)
|
||||
pyqt_dir = os.path.dirname(get_lib_path(executable, 'PyQt5.QtCore'))
|
||||
pyqt_dir = os.path.dirname(get_lib_path(executable, f'PyQt{version}.QtCore'))
|
||||
|
||||
for path in [sip_file, sipconfig_file, pyqt_dir]:
|
||||
if path is None:
|
||||
|
|
|
|||
|
|
@ -263,11 +263,11 @@ def install_pyqt_source(venv_dir: pathlib.Path, version: str) -> None:
|
|||
'--verbose', '--no-binary', ','.join(PYQT_PACKAGES))
|
||||
|
||||
|
||||
def install_pyqt_link(venv_dir: pathlib.Path) -> None:
|
||||
def install_pyqt_link(venv_dir: pathlib.Path, version: str) -> None:
|
||||
"""Install PyQt by linking a system-wide install."""
|
||||
utils.print_title("Linking system-wide PyQt")
|
||||
lib_path = link_pyqt.get_venv_lib_path(str(venv_dir))
|
||||
link_pyqt.link_pyqt(sys.executable, lib_path)
|
||||
link_pyqt.link_pyqt(sys.executable, lib_path, version=version)
|
||||
|
||||
|
||||
def install_pyqt_wheels(venv_dir: pathlib.Path,
|
||||
|
|
@ -463,7 +463,7 @@ def install_pyqt(venv_dir, args):
|
|||
elif args.pyqt_type == 'source':
|
||||
install_pyqt_source(venv_dir, args.pyqt_version)
|
||||
elif args.pyqt_type == 'link':
|
||||
install_pyqt_link(venv_dir)
|
||||
install_pyqt_link(venv_dir, args.pyqt_version)
|
||||
elif args.pyqt_type == 'wheels':
|
||||
wheels_dir = pathlib.Path(args.pyqt_wheels_dir)
|
||||
install_pyqt_wheels(venv_dir, wheels_dir)
|
||||
|
|
@ -479,9 +479,12 @@ def run(args) -> None:
|
|||
utils.change_cwd()
|
||||
|
||||
if (args.pyqt_version != 'auto' and
|
||||
args.pyqt_type not in ['binary', 'source']):
|
||||
args.pyqt_type not in ['binary', 'source', 'link']):
|
||||
raise Error('The --pyqt-version option is only available when installing PyQt '
|
||||
'from binary or source')
|
||||
'from binary, source, or linking it')
|
||||
elif args.pyqt_type == 'link' and args.pyqt_version not in ['auto', '5', '6']:
|
||||
raise Error('Invalid --pyqt-version {args.pyqt_version}, only 5 or 6 '
|
||||
'permitted with --pyqt-type=link')
|
||||
|
||||
if args.pyqt_wheels_dir != 'wheels' and args.pyqt_type != 'wheels':
|
||||
raise Error('The --pyqt-wheels-dir option is only available when installing '
|
||||
|
|
|
|||
Loading…
Reference in New Issue