From bff667051b1d23ebd2e8222f7458b980390c1c37 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 8 Sep 2019 10:48:50 -0500 Subject: Fix PyQt installation (#12479) * Fix PyQt installation * Switch dependency type * Replace SIP dependency with resource * Relax py-pyqt4 Qt dependency --- lib/spack/docs/build_systems/sippackage.rst | 12 ++++-- lib/spack/spack/build_systems/sip.py | 44 ++++++++++++++++------ .../repos/builtin/packages/py-pyqt4/package.py | 18 +++++++-- .../repos/builtin/packages/py-pyqt5/package.py | 18 +++++++-- var/spack/repos/builtin/packages/py-sip/package.py | 24 ++++++++---- var/spack/repos/builtin/packages/qt/package.py | 2 +- 6 files changed, 88 insertions(+), 30 deletions(-) diff --git a/lib/spack/docs/build_systems/sippackage.rst b/lib/spack/docs/build_systems/sippackage.rst index cb744e858f..1f0fb7b426 100644 --- a/lib/spack/docs/build_systems/sippackage.rst +++ b/lib/spack/docs/build_systems/sippackage.rst @@ -51,15 +51,21 @@ Build system dependencies ``SIPPackage`` requires several dependencies. Python is needed to run the ``configure.py`` build script, and to run the resulting Python libraries. Qt is needed to provide the ``qmake`` command. SIP is also -needed to build the package. All of these dependencies are automatically -added via the base class +needed to build the package. SIP is an unusual dependency in that it +must be installed in the same installation directory as the package, +so instead of a ``depends_on``, we use a ``resource``. All of these +dependencies are automatically added via the base class .. code-block:: python extends('python') depends_on('qt', type='build') - depends_on('py-sip', type='build') + + resource(name='sip', + url='https://www.riverbankcomputing.com/static/Downloads/sip/4.19.18/sip-4.19.18.tar.gz', + sha256='c0bd863800ed9b15dcad477c4017cdb73fa805c25908b0240564add74d697e1e', + destination='.') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/lib/spack/spack/build_systems/sip.py b/lib/spack/spack/build_systems/sip.py index 6d51ff57bd..da2c770ba7 100644 --- a/lib/spack/spack/build_systems/sip.py +++ b/lib/spack/spack/build_systems/sip.py @@ -4,11 +4,10 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import inspect -import os from llnl.util.filesystem import working_dir -from spack.directives import depends_on, extends -from spack.package import PackageBase, run_after +from spack.directives import depends_on, extends, resource +from spack.package import PackageBase, run_before, run_after class SIPPackage(PackageBase): @@ -32,22 +31,46 @@ class SIPPackage(PackageBase): # build-system class we are using build_system_class = 'SIPPackage' + #: Name of private sip module to install alongside package + sip_module = 'sip' + #: Callback names for install-time test install_time_test_callbacks = ['import_module_test'] extends('python') depends_on('qt') - depends_on('py-sip') - def configure_file(self): - """Returns the name of the configure file to use.""" - return 'configure.py' + resource(name='sip', + url='https://www.riverbankcomputing.com/static/Downloads/sip/4.19.18/sip-4.19.18.tar.gz', + sha256='c0bd863800ed9b15dcad477c4017cdb73fa805c25908b0240564add74d697e1e', + destination='.') def python(self, *args, **kwargs): """The python ``Executable``.""" inspect.getmodule(self).python(*args, **kwargs) + @run_before('configure') + def install_sip(self): + args = [ + '--sip-module={0}'.format(self.sip_module), + '--bindir={0}'.format(self.prefix.bin), + '--destdir={0}'.format(inspect.getmodule(self).site_packages_dir), + '--incdir={0}'.format(inspect.getmodule(self).python_include_dir), + '--sipdir={0}'.format(self.prefix.share.sip), + '--stubsdir={0}'.format(inspect.getmodule(self).site_packages_dir), + ] + + with working_dir('sip-4.19.18'): + self.python('configure.py', *args) + + inspect.getmodule(self).make() + inspect.getmodule(self).make('install') + + def configure_file(self): + """Returns the name of the configure file to use.""" + return 'configure.py' + def configure(self, spec, prefix): """Configure the package.""" configure = self.configure_file() @@ -58,11 +81,8 @@ class SIPPackage(PackageBase): '--verbose', '--confirm-license', '--qmake', spec['qt'].prefix.bin.qmake, - '--sip', spec['py-sip'].prefix.bin.sip, - '--sip-incdir', os.path.join( - spec['py-sip'].prefix, - spec['python'].package.python_include_dir - ), + '--sip', prefix.bin.sip, + '--sip-incdir', inspect.getmodule(self).python_include_dir, '--bindir', prefix.bin, '--destdir', inspect.getmodule(self).site_packages_dir, ]) diff --git a/var/spack/repos/builtin/packages/py-pyqt4/package.py b/var/spack/repos/builtin/packages/py-pyqt4/package.py index 45bb6ac5c3..6554cf78a6 100644 --- a/var/spack/repos/builtin/packages/py-pyqt4/package.py +++ b/var/spack/repos/builtin/packages/py-pyqt4/package.py @@ -14,18 +14,30 @@ class PyPyqt4(SIPPackage): homepage = "https://www.riverbankcomputing.com/software/pyqt/intro" url = "http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.12.3/PyQt4_gpl_x11-4.12.3.tar.gz" - import_modules = ['PyQt4'] + + sip_module = 'PyQt4.sip' + import_modules = [ + 'PyQt4', 'PyQt4.Qt', 'PyQt4.QtCore', 'PyQt4.QtDeclarative', + 'PyQt4.QtDesigner', 'PyQt4.QtGui', 'PyQt4.QtHelp', + 'PyQt4.QtMultimedia', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL', + 'PyQt4.QtScript', 'PyQt4.QtScriptTools', 'PyQt4.QtSql', 'PyQt4.QtSvg', + 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.QtXmlPatterns' + ] version('4.12.3', sha256='a00f5abef240a7b5852b7924fa5fdf5174569525dc076cd368a566619e56d472') version('4.11.3', '997c3e443165a89a559e0d96b061bf70', url='http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.3/PyQt-x11-gpl-4.11.3.tar.gz') # Supposedly can also be built with Qt 5 compatibility layer - depends_on('qt@:4+phonon+dbus') + depends_on('qt@:4') # https://www.riverbankcomputing.com/static/Docs/PyQt4/installation.html def configure_file(self): return 'configure-ng.py' def configure_args(self): - return ['--pyuic4-interpreter', self.spec['python'].command.path] + return [ + '--pyuic4-interpreter', self.spec['python'].command.path, + '--sipdir', self.prefix.share.sip.PyQt4, + '--stubsdir', join_path(site_packages_dir, 'PyQt4'), + ] diff --git a/var/spack/repos/builtin/packages/py-pyqt5/package.py b/var/spack/repos/builtin/packages/py-pyqt5/package.py index d81eec4733..0ec76b16c9 100644 --- a/var/spack/repos/builtin/packages/py-pyqt5/package.py +++ b/var/spack/repos/builtin/packages/py-pyqt5/package.py @@ -14,11 +14,19 @@ class PyPyqt5(SIPPackage): homepage = "https://www.riverbankcomputing.com/software/pyqt/intro" url = "https://www.riverbankcomputing.com/static/Downloads/PyQt5/5.13.0/PyQt5_gpl-5.13.0.tar.gz" list_url = "https://www.riverbankcomputing.com/software/pyqt/download5" - import_modules = ['PyQt5'] + + sip_module = 'PyQt5.sip' + import_modules = [ + 'PyQt5', 'PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtHelp', + 'PyQt5.QtMultimedia', 'PyQt5.QtMultimediaWidgets', 'PyQt5.QtNetwork', + 'PyQt5.QtOpenGL', 'PyQt5.QtPrintSupport', 'PyQt5.QtQml', + 'PyQt5.QtQuick', 'PyQt5.QtSvg', 'PyQt5.QtTest', 'PyQt5.QtWebChannel', + 'PyQt5.QtWebSockets', 'PyQt5.QtWidgets', 'PyQt5.QtXml', + 'PyQt5.QtXmlPatterns' + ] version('5.13.0', sha256='0cdbffe5135926527b61cc3692dd301cd0328dd87eeaf1313e610787c46faff9') - depends_on('py-sip@4.19.14:') # Without opengl support, I got the following error: # sip: QOpenGLFramebufferObject is undefined depends_on('qt@5:+opengl') @@ -27,4 +35,8 @@ class PyPyqt5(SIPPackage): # https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html def configure_args(self): - return ['--pyuic5-interpreter', self.spec['python'].command.path] + return [ + '--pyuic5-interpreter', self.spec['python'].command.path, + '--sipdir', self.prefix.share.sip.PyQt5, + '--stubsdir', join_path(site_packages_dir, 'PyQt5'), + ] diff --git a/var/spack/repos/builtin/packages/py-sip/package.py b/var/spack/repos/builtin/packages/py-sip/package.py index fc481eabdf..7bb1c24a9c 100644 --- a/var/spack/repos/builtin/packages/py-sip/package.py +++ b/var/spack/repos/builtin/packages/py-sip/package.py @@ -21,25 +21,33 @@ class PySip(Package): version('4.16.7', '32abc003980599d33ffd789734de4c36') version('4.16.5', '6d01ea966a53e4c7ae5c5e48c40e49e5') - extends('python') + variant('module', default='sip', description='Name of private SIP module', + values=str, multi=False) - # https://www.riverbankcomputing.com/static/Docs/sip/installation.html - phases = ['configure', 'build', 'install'] + extends('python') depends_on('flex', type='build', when='@develop') depends_on('bison', type='build', when='@develop') + # https://www.riverbankcomputing.com/static/Docs/sip/installation.html + phases = ['configure', 'build', 'install'] + @run_before('configure') def prepare(self): if self.spec.satisfies('@develop'): python('build.py', 'prepare') def configure(self, spec, prefix): - python('configure.py', - '--bindir={0}'.format(prefix.bin), - '--destdir={0}'.format(site_packages_dir), - '--incdir={0}'.format(python_include_dir), - '--sipdir={0}'.format(prefix.share.sip)) + args = [ + '--sip-module={0}'.format(spec.variants['module'].value), + '--bindir={0}'.format(prefix.bin), + '--destdir={0}'.format(site_packages_dir), + '--incdir={0}'.format(python_include_dir), + '--sipdir={0}'.format(prefix.share.sip), + '--stubsdir={0}'.format(site_packages_dir), + ] + + python('configure.py', *args) def build(self, spec, prefix): make() diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index cd5012b711..158b9b6e3e 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -132,7 +132,7 @@ class Qt(Package): depends_on("libpng@1.2.57", when='@3') depends_on("pcre+multibyte", when='@5.0:5.8') depends_on("inputproto", when='@:5.8') - depends_on("openssl@:1.0", when='@:5.9+ssl') + depends_on("openssl@:1.0.999", when='@:5.9+ssl') depends_on("glib", when='@4:') depends_on("libpng", when='@4:') -- cgit v1.2.3-60-g2f50