From b34da4e108b7441d26ca6c02871cba65a0530566 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Tue, 30 Jul 2019 17:12:48 -0500 Subject: Add SIPPackage base class (#12157) --- .../repos/builtin/packages/py-guidata/package.py | 2 +- .../repos/builtin/packages/py-pymol/package.py | 2 +- .../repos/builtin/packages/py-pyqt/package.py | 30 ------------------- .../repos/builtin/packages/py-pyqt4/package.py | 31 +++++++++++++++++++ .../repos/builtin/packages/py-pyqt5/package.py | 28 +++++++++++++++++ .../repos/builtin/packages/py-pythonqwt/package.py | 2 +- .../repos/builtin/packages/py-qtpy/package.py | 2 +- var/spack/repos/builtin/packages/py-sip/package.py | 35 +++++++++++++++++----- .../repos/builtin/packages/py-spyder/package.py | 2 +- .../repos/builtin/packages/py-tuiview/package.py | 2 +- 10 files changed, 92 insertions(+), 44 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/py-pyqt/package.py create mode 100644 var/spack/repos/builtin/packages/py-pyqt4/package.py create mode 100644 var/spack/repos/builtin/packages/py-pyqt5/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-guidata/package.py b/var/spack/repos/builtin/packages/py-guidata/package.py index 13856e6926..80108cd400 100644 --- a/var/spack/repos/builtin/packages/py-guidata/package.py +++ b/var/spack/repos/builtin/packages/py-guidata/package.py @@ -16,6 +16,6 @@ class PyGuidata(PythonPackage): version('1.7.5', '915188c02ad3c89951ee260db65d84a7') depends_on('py-setuptools', type='build') - depends_on('py-pyqt@4:', type=('build', 'run')) + depends_on('py-pyqt4', type=('build', 'run')) depends_on('py-spyder@2.0:2.9.9', type=('build', 'run')) depends_on('py-h5py', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-pymol/package.py b/var/spack/repos/builtin/packages/py-pymol/package.py index ca88919a48..6499a60516 100644 --- a/var/spack/repos/builtin/packages/py-pymol/package.py +++ b/var/spack/repos/builtin/packages/py-pymol/package.py @@ -28,5 +28,5 @@ class PyPymol(PythonPackage): depends_on('freetype') depends_on('libxml2') depends_on('msgpack-c') - depends_on('py-pyqt', type=('build', 'run')) + depends_on('py-pyqt4', type=('build', 'run')) depends_on('freeglut') diff --git a/var/spack/repos/builtin/packages/py-pyqt/package.py b/var/spack/repos/builtin/packages/py-pyqt/package.py deleted file mode 100644 index b33d882049..0000000000 --- a/var/spack/repos/builtin/packages/py-pyqt/package.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack import * - - -class PyPyqt(Package): - """PyQt is a set of Python v2 and v3 bindings for Digia's Qt - application framework and runs on all platforms supported by Qt - including Windows, MacOS/X and Linux.""" - homepage = "http://www.riverbankcomputing.com/software/pyqt/intro" - url = "http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.3/PyQt-x11-gpl-4.11.3.tar.gz" - - version('4.11.3', '997c3e443165a89a559e0d96b061bf70') - - extends('python') - depends_on('py-sip', type=('build', 'run')) - - # TODO: allow qt5 when conditional deps are supported. - # TODO: Fix version matching so that @4 works like @:4 - depends_on('qt@:4+phonon+dbus') - - def install(self, spec, prefix): - python('configure.py', - '--confirm-license', - '--destdir=%s' % site_packages_dir) - make() - make('install') diff --git a/var/spack/repos/builtin/packages/py-pyqt4/package.py b/var/spack/repos/builtin/packages/py-pyqt4/package.py new file mode 100644 index 0000000000..45bb6ac5c3 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pyqt4/package.py @@ -0,0 +1,31 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PyPyqt4(SIPPackage): + """PyQt is a set of Python v2 and v3 bindings for The Qt Company's Qt + application framework and runs on all platforms supported by Qt including + Windows, OS X, Linux, iOS and Android. PyQt4 supports Qt v4 and will build + against Qt v5.""" + + 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'] + + 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') + + # 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] diff --git a/var/spack/repos/builtin/packages/py-pyqt5/package.py b/var/spack/repos/builtin/packages/py-pyqt5/package.py new file mode 100644 index 0000000000..6de6c7c53d --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pyqt5/package.py @@ -0,0 +1,28 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PyPyqt5(SIPPackage): + """PyQt is a set of Python v2 and v3 bindings for The Qt Company's Qt + application framework and runs on all platforms supported by Qt including + Windows, OS X, Linux, iOS and Android. PyQt5 supports Qt v5.""" + + 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'] + + version('5.13.0', sha256='0cdbffe5135926527b61cc3692dd301cd0328dd87eeaf1313e610787c46faff9') + + # 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')) + + # https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html + def configure_args(self): + return ['--pyuic5-interpreter', self.spec['python'].command.path] diff --git a/var/spack/repos/builtin/packages/py-pythonqwt/package.py b/var/spack/repos/builtin/packages/py-pythonqwt/package.py index 9c637b3f51..2bc32b69c4 100644 --- a/var/spack/repos/builtin/packages/py-pythonqwt/package.py +++ b/var/spack/repos/builtin/packages/py-pythonqwt/package.py @@ -19,5 +19,5 @@ class PyPythonqwt(PythonPackage): depends_on('py-setuptools', type='build') depends_on('py-numpy@1.3:', type=('build', 'run')) depends_on('py-sip', type=('build', 'run')) - depends_on('py-pyqt@4:', type=('build', 'run')) + depends_on('py-pyqt4', type=('build', 'run')) depends_on('py-sphinx@1.1:', type=('build', 'run'), when='+docs') diff --git a/var/spack/repos/builtin/packages/py-qtpy/package.py b/var/spack/repos/builtin/packages/py-qtpy/package.py index 773ddef379..7e46682111 100644 --- a/var/spack/repos/builtin/packages/py-qtpy/package.py +++ b/var/spack/repos/builtin/packages/py-qtpy/package.py @@ -15,4 +15,4 @@ class PyQtpy(PythonPackage): version('1.2.1', 'e2f783fb7f8e502815237bd8d30c6d11') depends_on('py-setuptools', type='build') - depends_on('py-pyqt@4:', type=('build', 'run')) + depends_on('py-pyqt4', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-sip/package.py b/var/spack/repos/builtin/packages/py-sip/package.py index 72d1171d70..fc481eabdf 100644 --- a/var/spack/repos/builtin/packages/py-sip/package.py +++ b/var/spack/repos/builtin/packages/py-sip/package.py @@ -4,26 +4,45 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * -import os class PySip(Package): """SIP is a tool that makes it very easy to create Python bindings for C and C++ libraries.""" - homepage = "http://www.riverbankcomputing.com/software/sip/intro" - url = "http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.5/sip-4.16.5.tar.gz" + homepage = "https://www.riverbankcomputing.com/software/sip/intro" + url = "https://www.riverbankcomputing.com/static/Downloads/sip/4.19.18/sip-4.19.18.tar.gz" + list_url = "https://www.riverbankcomputing.com/software/sip/download" + hg = "https://www.riverbankcomputing.com/hg/sip" + + version('develop', hg=hg) # wasn't actually able to clone this + version('4.19.18', sha256='c0bd863800ed9b15dcad477c4017cdb73fa805c25908b0240564add74d697e1e') version('4.19.13', sha256='e353a7056599bf5fbd5d3ff9842a6ab2ea3cf4e0304a0f925ec5862907c0d15e') version('4.16.7', '32abc003980599d33ffd789734de4c36') version('4.16.5', '6d01ea966a53e4c7ae5c5e48c40e49e5') extends('python') - def install(self, spec, prefix): + # https://www.riverbankcomputing.com/static/Docs/sip/installation.html + phases = ['configure', 'build', 'install'] + + depends_on('flex', type='build', when='@develop') + depends_on('bison', type='build', when='@develop') + + @run_before('configure') + def prepare(self): + if self.spec.satisfies('@develop'): + python('build.py', 'prepare') + + def configure(self, spec, prefix): python('configure.py', - '--destdir=%s' % site_packages_dir, - '--bindir=%s' % spec.prefix.bin, - '--incdir=%s' % python_include_dir, - '--sipdir=%s' % os.path.join(spec.prefix.share, 'sip')) + '--bindir={0}'.format(prefix.bin), + '--destdir={0}'.format(site_packages_dir), + '--incdir={0}'.format(python_include_dir), + '--sipdir={0}'.format(prefix.share.sip)) + + def build(self, spec, prefix): make() + + def install(self, spec, prefix): make('install') diff --git a/var/spack/repos/builtin/packages/py-spyder/package.py b/var/spack/repos/builtin/packages/py-spyder/package.py index 0b47646fbe..ced5e85266 100644 --- a/var/spack/repos/builtin/packages/py-spyder/package.py +++ b/var/spack/repos/builtin/packages/py-spyder/package.py @@ -36,7 +36,7 @@ class PySpyder(PythonPackage): depends_on('py-psutil', type=('build', 'run')) depends_on('py-qtawesome@0.4.1:', type=('build', 'run')) depends_on('py-qtpy@1.1.0:', type=('build', 'run')) - # technically this is a transitive dependency in order for py-pyqt + # technically this is a transitive dependency in order for py-pyqt4 # to pick up webkit, but this is the easier solution (see #9207) depends_on('qt+webkit', type=('build', 'run')) depends_on('py-pickleshare', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-tuiview/package.py b/var/spack/repos/builtin/packages/py-tuiview/package.py index 75658eeb26..d21c71e49e 100644 --- a/var/spack/repos/builtin/packages/py-tuiview/package.py +++ b/var/spack/repos/builtin/packages/py-tuiview/package.py @@ -16,6 +16,6 @@ class PyTuiview(PythonPackage): version('1.1.7', '4b3b38a820cc239c8ab4a181ac5d4c30') - depends_on("py-pyqt", type=('build', 'run')) + depends_on("py-pyqt4", type=('build', 'run')) depends_on("py-numpy", type=('build', 'run')) depends_on("gdal") -- cgit v1.2.3-70-g09d2