summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/py-pyqt5/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/py-pyqt5/package.py')
-rw-r--r--var/spack/repos/builtin/packages/py-pyqt5/package.py61
1 files changed, 60 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/py-pyqt5/package.py b/var/spack/repos/builtin/packages/py-pyqt5/package.py
index 0ec76b16c9..3858ab7eef 100644
--- a/var/spack/repos/builtin/packages/py-pyqt5/package.py
+++ b/var/spack/repos/builtin/packages/py-pyqt5/package.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
+import os
class PyPyqt5(SIPPackage):
@@ -27,16 +28,74 @@ class PyPyqt5(SIPPackage):
version('5.13.0', sha256='0cdbffe5135926527b61cc3692dd301cd0328dd87eeaf1313e610787c46faff9')
+ variant('qsci', default=False, description='Build with QScintilla python bindings')
+
# Without opengl support, I got the following error:
# sip: QOpenGLFramebufferObject is undefined
depends_on('qt@5:+opengl')
depends_on('python@2.6:', type=('build', 'run'))
depends_on('py-enum34', type=('build', 'run'), when='^python@:3.3')
+ depends_on('qscintilla', when='+qsci')
+
+ # For building Qscintilla python bindings
+ resource(name='qscintilla',
+ url='https://www.riverbankcomputing.com/static/Downloads/QScintilla/2.10.2/QScintilla_gpl-2.10.2.tar.gz',
+ sha256='14b31d20717eed95ea9bea4cd16e5e1b72cee7ebac647cba878e0f6db6a65ed0',
+ destination='spack-resource-qscintilla',
+ when='^qscintilla@2.10.2'
+ )
+
# https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html
def configure_args(self):
- return [
+ args = [
'--pyuic5-interpreter', self.spec['python'].command.path,
'--sipdir', self.prefix.share.sip.PyQt5,
'--stubsdir', join_path(site_packages_dir, 'PyQt5'),
]
+ if '+qsci' in self.spec:
+ args.extend(['--qsci-api-destdir', self.prefix.share.qsci])
+ return args
+
+ @run_after('install')
+ def make_qsci(self):
+ if '+qsci' in self.spec:
+ rsrc_py_path = os.path.join(
+ self.stage.source_path,
+ 'spack-resource-qscintilla/QScintilla_gpl-' +
+ str(self.spec['qscintilla'].version), 'Python')
+ with working_dir(rsrc_py_path):
+ pydir = join_path(site_packages_dir, 'PyQt5')
+ python = self.spec['python'].command
+ python('configure.py', '--pyqt=PyQt5',
+ '--sip=' + self.prefix.bin.sip,
+ '--qsci-incdir=' +
+ self.spec['qscintilla'].prefix.include,
+ '--qsci-libdir=' + self.spec['qscintilla'].prefix.lib,
+ '--qsci-sipdir=' + self.prefix.share.sip.PyQt5,
+ '--apidir=' + self.prefix.share.qsci,
+ '--destdir=' + pydir,
+ '--pyqt-sipdir=' + self.prefix.share.sip.PyQt5,
+ '--sip-incdir=' + python_include_dir,
+ '--stubsdir=' + pydir)
+
+ # Fix build errors
+ # "QAbstractScrollArea: No such file or directory"
+ # "qprinter.h: No such file or directory"
+ # ".../Qsci.so: undefined symbol: _ZTI10Qsci...."
+ qscipro = FileFilter('Qsci/Qsci.pro')
+ link_qscilibs = 'LIBS += -L' + self.prefix.lib +\
+ ' -lqscintilla2_qt5'
+ qscipro.filter('TEMPLATE = lib',
+ 'TEMPLATE = lib\nQT += widgets' +
+ '\nQT += printsupport\n' + link_qscilibs)
+
+ make()
+
+ # Fix installation prefixes
+ makefile = FileFilter('Makefile')
+ makefile.filter(r'\$\(INSTALL_ROOT\)', '')
+ makefile = FileFilter('Qsci/Makefile')
+ makefile.filter(r'\$\(INSTALL_ROOT\)', '')
+
+ make('install')