# IT4Innovations
# LK 2025

easyblock = 'Bundle'

name = 'PyQt5'
version = '5.15.11'
versionsuffix = '-Python-3.11.5'

homepage = 'https://www.riverbankcomputing.com/software/pyqt'
description = """PyQt5 is a set of Python bindings for v5 of the Qt application framework from The Qt Company.
This bundle includes PyQtWebEngine, a set of Python bindings for The Qt Company’s Qt WebEngine framework."""

toolchain = {'name': 'GCCcore', 'version': '13.2.0'}
toolchainopts = {'cstd': 'c++11'}

builddependencies = [('binutils', '2.40')]
dependencies = [
    ('Python', '3.11.5'),
    ('Qt5', '5.15.13'),
]

default_easyblock = 'PythonPackage'

local_pylibdir = '%(installdir)s/lib/python%(pyshortver)s/site-packages'

local_pyqt5_sip_install = "sip-install --verbose --target-dir " + local_pylibdir + " "
local_pyqt5_sip_install += "--confirm-license --no-designer-plugin --no-qml-plugin --no-tools"

local_pyqtweb_configopts = "configure.py --verbose --destdir=%s/PyQt5 " % local_pylibdir
local_pyqtweb_configopts += "--apidir=%(installdir)s/qsci --pyqt-sipdir=%(builddir)s/PyQt5-%(version)s/sip "
local_pyqtweb_configopts += "--no-stubs --no-dist-info"

local_setup_env = "export PATH=%(installdir)s/bin:$PATH && "
local_setup_env += "export PYTHONPATH=%(installdir)s/lib/python%(pyshortver)s/site-packages:$PYTHONPATH && "
local_sipver = '6.9.1'
components = [
    ('SIP', local_sipver, {
        'source_urls': [PYPI_SOURCE],
        'sources': [SOURCELOWER_TAR_GZ],
        'checksums': ['7904be5190d7879952563b78a3af0e58fa27d9525af7f53f93eac7a83b433e7b'],
        'start_dir': 'sip-%s' % local_sipver,
        'use_pip': True,
        'options': {'modulename': 'PyQt5.sip'},
    }),
    ('PyQt-builder', '1.17.1', {
        'source_urls': [PYPI_SOURCE],
        'sources': ['pyqt_builder-%(version)s.tar.gz'],
        'checksums': ['457dcd6a1408ea4bf1264e3511c734d53451ae8a3905e98982d50f7b3fdab724'],
        'start_dir': 'pyqt_builder-%(version)s',
        'use_pip': True,
    }),
    ('PyQt5_sip', '12.16.1', {
        'source_urls': [PYPI_SOURCE],
        'sources': [SOURCELOWER_TAR_GZ],
        'checksums': ['8c831f8b619811a32369d72339faa50ae53a963f5fdfa4d71f845c63e9673125'],
        'start_dir': 'pyqt5_sip-%(version)s',
        'use_pip': True,
    }),
    (name, version, {
        'source_urls': [PYPI_SOURCE],
        'sources': [SOURCE_TAR_GZ],
        'checksums': ['fda45743ebb4a27b4b1a51c6d8ef455c4c1b5d610c90d2934c7802b5c1557c52'],
        'easyblock': 'Binary',
        'start_dir': '%(name)s-%(version)s',
        'skipsteps': ['configure', 'build'],
        'install_cmd': local_setup_env + local_pyqt5_sip_install,
    }),
    #('PyQtWebEngine', '5.15.7', {
    #    'source_urls': [PYPI_SOURCE],
    #    'sources': [SOURCE_TAR_GZ],
    #    'checksums': ['f121ac6e4a2f96ac289619bcfc37f64e68362f24a346553f5d6c42efa4228a4d'],
    #    'start_dir': 'PyQtWebEngine-%(version)s',
    #    'use_pip': True,
    #}),
]

sanity_check_paths = {
    'files': ['bin/pyqt-bundle', 'bin/sip-build', 'bin/sip-install'],
    'dirs': ['lib/python%(pyshortver)s/site-packages'],
}

sanity_check_commands = [
    "python -c 'import PyQt5.QtCore'",
]

modextrapaths = {
    'PYTHONPATH': 'lib/python%(pyshortver)s/site-packages',
    'QT_INSTALL_DATA': 'qsci',
}

moduleclass = 'vis'
