new package Qscintilla (with python bindings via py-pyqt ) (#12793)
* qscintilla_with_python_bindings_disabled * pyqt5 with variant +qsci to compile qscintilla python bindings * fix a dyn linking issue for Qsci python module * fix a bug * fix bug: use sip provided by py-pyqt5 * fix typo * tidy up, make designer * tidy up * fix designer build issue, set env for designer plugin * tidy up * tidy up * minor improvements * improve style * build Qscintilla python bindings here * make qsci config option variant dependent * get rid of commented out code * improvements: add resource for qscintilla, improve config_args * flake8: spaces, blank lines etc * flake8: fix long lines * Update var/spack/repos/builtin/packages/py-pyqt4/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt4/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt4/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/qscintilla/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * dont install source tree under prefix * remove duplicate line * use os.path.join instead of + * separate build and run environment setups * flake8 * Update var/spack/repos/builtin/packages/py-pyqt5/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt5/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt5/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * fix rsrc path * use python_include_dir * use "with working_dir" * Update var/spack/repos/builtin/packages/py-pyqt4/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt5/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt5/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt5/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/qscintilla/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt4/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * Update var/spack/repos/builtin/packages/py-pyqt4/package.py Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com> * flake8
This commit is contained in:
parent
ab2b3f30a5
commit
00bf299e46
@ -4,6 +4,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
|
||||
class PyPyqt4(SIPPackage):
|
||||
@ -28,16 +29,73 @@ class PyPyqt4(SIPPackage):
|
||||
version('4.11.3', sha256='853780dcdbe2e6ba785d703d059b096e1fc49369d3e8d41a060be874b8745686',
|
||||
url='http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.3/PyQt-x11-gpl-4.11.3.tar.gz')
|
||||
|
||||
variant('qsci', default=False, description='Build with QScintilla python bindings')
|
||||
|
||||
# Supposedly can also be built with Qt 5 compatibility layer
|
||||
depends_on('qt@:4')
|
||||
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/PyQt4/installation.html
|
||||
def configure_file(self):
|
||||
return 'configure-ng.py'
|
||||
|
||||
def configure_args(self):
|
||||
return [
|
||||
args = [
|
||||
'--pyuic4-interpreter', self.spec['python'].command.path,
|
||||
'--sipdir', self.prefix.share.sip.PyQt4,
|
||||
'--stubsdir', join_path(site_packages_dir, 'PyQt4'),
|
||||
'--stubsdir', join_path(site_packages_dir, 'PyQt4')
|
||||
]
|
||||
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, 'PyQt4')
|
||||
python = self.spec['python'].command
|
||||
python('configure.py',
|
||||
'--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.PyQt4,
|
||||
'--apidir=' + self.prefix.share.qsci,
|
||||
'--destdir=' + pydir,
|
||||
'--pyqt-sipdir=' + self.prefix.share.sip.PyQt4,
|
||||
'--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_qt4'
|
||||
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')
|
||||
|
@ -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')
|
||||
|
68
var/spack/repos/builtin/packages/qscintilla/package.py
Normal file
68
var/spack/repos/builtin/packages/qscintilla/package.py
Normal file
@ -0,0 +1,68 @@
|
||||
# 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 *
|
||||
import os
|
||||
|
||||
|
||||
class Qscintilla(QMakePackage):
|
||||
"""
|
||||
QScintilla is a port to Qt of Neil Hodgson's Scintilla C++ editor control.
|
||||
"""
|
||||
|
||||
homepage = "https://www.riverbankcomputing.com/software/qscintilla/intro"
|
||||
url = "https://www.riverbankcomputing.com/static/Downloads/QScintilla/2.11.2/QScintilla_gpl-2.11.2.tar.gz"
|
||||
|
||||
version('2.11.2', sha256='029bdc476a069fda2cea3cd937ba19cc7fa614fb90578caef98ed703b658f4a1')
|
||||
# Newer versions of Qscintilla won't build, so prefer the following version
|
||||
version('2.10.2', sha256='14b31d20717eed95ea9bea4cd16e5e1b72cee7ebac647cba878e0f6db6a65ed0', preferred=True)
|
||||
|
||||
variant('designer', default=False, description="Enable pluging for Qt-Designer")
|
||||
# No 'python' variant, since Python bindings will be
|
||||
# built by PyQt5+qsci instead
|
||||
|
||||
depends_on('qt')
|
||||
|
||||
@run_before('qmake')
|
||||
def chdir(self):
|
||||
os.chdir(str(self.stage.source_path) + '/Qt4Qt5')
|
||||
|
||||
def qmake_args(self):
|
||||
# below, DEFINES ... gets rid of ...regex...errors during build
|
||||
# although, there shouldn't be such errors since we use '-std=c++11'
|
||||
args = ['CONFIG+=-std=c++11', 'DEFINES+=NO_CXX11_REGEX=1']
|
||||
return args
|
||||
|
||||
# When INSTALL_ROOT is unset, qscintilla is installed under qt_prefix
|
||||
# giving 'Nothing Installed Error'
|
||||
def setup_build_environment(self, env):
|
||||
spack_env.set('INSTALL_ROOT', self.prefix)
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
env.prepend_path('QT_PLUGIN_PATH', self.prefix.plugins)
|
||||
|
||||
# Fix install prefix
|
||||
@run_after('qmake')
|
||||
def fix_install_path(self):
|
||||
makefile = FileFilter('Makefile')
|
||||
makefile.filter(r'\$\(INSTALL_ROOT\)' +
|
||||
self.spec['qt'].prefix, '$(INSTALL_ROOT)')
|
||||
|
||||
@run_after('install')
|
||||
def postinstall(self):
|
||||
# Make designer plugin
|
||||
if '+designer' in self.spec:
|
||||
with working_dir(os.path.join(self.stage.source_path,
|
||||
'designer-Qt4Qt5')):
|
||||
qscipro = FileFilter('designer.pro')
|
||||
qscipro.filter('TEMPLATE = lib',
|
||||
'TEMPLATE = lib\nINCLUDEPATH += ../Qt4Qt5\n')
|
||||
|
||||
qmake()
|
||||
make()
|
||||
makefile = FileFilter('Makefile')
|
||||
makefile.filter(r'\$\(INSTALL_ROOT\)' +
|
||||
self.spec['qt'].prefix, '$(INSTALL_ROOT)')
|
||||
make('install')
|
Loading…
Reference in New Issue
Block a user