Skip to content

Commit

Permalink
ParaView and Catalyst use python3. (spack#11485)
Browse files Browse the repository at this point in the history
Use python3 for latest paraview and catalyst versions.
  • Loading branch information
danlipsa authored and Chuck Atkins committed Jun 10, 2019
1 parent d4008db commit c98190a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 13 deletions.
43 changes: 35 additions & 8 deletions var/spack/repos/builtin/packages/catalyst/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Catalyst(CMakePackage):
_urlfmt_gz = 'http://www.paraview.org/files/v{0}/ParaView-v{1}{2}.tar.gz'
_urlfmt_xz = 'http://www.paraview.org/files/v{0}/ParaView-v{1}{2}.tar.xz'

version('5.6.0', sha256='5b49cb96ab78eee0427e25200530ac892f9a3da7725109ce1790f8010cb5b377')
version('5.5.2', '7eb93c31a1e5deb7098c3b4275e53a4a')
version('5.5.1', 'a7d92a45837b67c3371006cc45163277')
version('5.5.0', 'a8f2f41edadffdcc89b37fdc9aa7f005')
Expand All @@ -31,17 +32,35 @@ class Catalyst(CMakePackage):
version('4.4.0', 'fa1569857dd680ebb4d7ff89c2227378')

variant('python', default=False, description='Enable Python support')
variant('python3', default=False, description='Enable Python3 support')
variant('essentials', default=False, description='Enable Essentials support')
variant('extras', default=False, description='Enable Extras support')
variant('rendering', default=False, description='Enable VTK Rendering support')
variant('extras', default=False, description='Enable Extras support. Implies Essentials.')
variant('rendering', default=True, description='Enable Rendering support. Implies Extras and Essentials.')
variant('osmesa', default=True, description='Use offscreen rendering')
conflicts('+osmesa', when='~rendering')

conflicts('+python', when='+python3')
conflicts('+python', when='@5.6:')
conflicts('+python3', when='@:5.5')

# Workaround for
# adding the following to your packages.yaml
# packages:
# python:
# version: [3, 2]
# without this you'll get:
# paraview requires python version 3:, but spec asked for 2.7.16
# for `spack spec paraview+python`
# see spack pull request #11539
# extends('python', when='+python')
extends('python', when='+python')
extends('python', when='+python3')

depends_on('git', type='build')
depends_on('mpi')
depends_on('python@2:2.8', when='+python', type=("build", "link", "run"))
depends_on('python', when='~python', type=("build"))
depends_on('gl@3.2', when='+rendering')
depends_on('python@2.7:2.8', when='+python', type=('build', 'link', 'run'))
depends_on('python@3:', when='+python3', type=('build', 'link', 'run'))
depends_on('gl@3.2:', when='+rendering')
depends_on('mesa+osmesa', when='+rendering+osmesa')
depends_on('glx', when='+rendering~osmesa')
depends_on('cmake@3.3:', type='build')
Expand Down Expand Up @@ -77,16 +96,19 @@ def editions(self):
"""Transcribe spack variants into names of Catalyst Editions"""
selected = ['Base'] # Always required

if '+python' in self.spec:
if '+python' in self.spec or '+python3' in self.spec:
selected.append('Enable-Python')

if '+essentials' in self.spec:
selected.append('Essentials')

if '+extras' in self.spec:
selected.append('Essentials')
selected.append('Extras')

if '+rendering' in self.spec:
selected.append('Essentials')
selected.append('Extras')
selected.append('Rendering-Base')

return selected
Expand Down Expand Up @@ -134,7 +156,7 @@ def setup_environment(self, spack_env, run_env):
run_env.prepend_path('LIBRARY_PATH', lib_dir)
run_env.prepend_path('LD_LIBRARY_PATH', lib_dir)

if '+python' in self.spec:
if '+python' in self.spec or '+python3' in self.spec:
python_version = self.spec['python'].version.up_to(2)
run_env.prepend_path('PYTHONPATH', join_path(lib_dir,
'python{0}'.format(python_version),
Expand Down Expand Up @@ -182,8 +204,13 @@ def nvariant_bool(feature):
'-DVTK_USE_SYSTEM_EXPAT:BOOL=ON',
'-DVTK_USE_X:BOOL=%s' % nvariant_bool('+osmesa'),
'-DVTK_USE_OFFSCREEN:BOOL=%s' % variant_bool('+osmesa'),
'-DVTK_OPENGL_HAS_OSMESA:BOOL=%s' % variant_bool('+osmesa')
'-DVTK_OPENGL_HAS_OSMESA:BOOL=%s' % variant_bool('+osmesa'),
'-DPARAVIEW_ENABLE_PYTHON:BOOL=%s' % variant_bool('+python')
]
if '+python' in spec or '+python3' in spec:
cmake_args.append(
'-DPYTHON_EXECUTABLE:FILEPATH=%s' %
spec['python'].command.path)
return cmake_args

def cmake(self, spec, prefix):
Expand Down
35 changes: 30 additions & 5 deletions var/spack/repos/builtin/packages/paraview/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class Paraview(CMakePackage):
homepage = 'http://www.paraview.org'
url = "http://www.paraview.org/files/v5.3/ParaView-v5.3.0.tar.gz"
_urlfmt = 'http://www.paraview.org/files/v{0}/ParaView-v{1}{2}.tar.gz'
git = "https://gitlab.kitware.com/paraview/paraview.git"

version('develop', branch='master', submodules=True)
version('5.6.0', sha256='cb8c4d752ad9805c74b4a08f8ae6e83402c3f11e38b274dba171b99bb6ac2460')
version('5.5.2', '7eb93c31a1e5deb7098c3b4275e53a4a')
version('5.5.1', 'a7d92a45837b67c3371006cc45163277')
Expand All @@ -30,18 +32,41 @@ class Paraview(CMakePackage):
variant('plugins', default=True,
description='Install include files for plugins support')
variant('python', default=False, description='Enable Python support')
variant('python3', default=False, description='Enable Python3 support')
variant('mpi', default=True, description='Enable MPI support')
variant('osmesa', default=False, description='Enable OSMesa support')
variant('qt', default=False, description='Enable Qt (gui) support')
variant('opengl2', default=True, description='Enable OpenGL2 backend')
variant('examples', default=False, description="Build examples")
variant('hdf5', default=False, description="Use external HDF5")

depends_on('python@2:2.8', when='+python')
conflicts('+python', when='+python3')
conflicts('+python', when='@5.6:')
conflicts('+python3', when='@:5.5')

# Workaround for
# adding the following to your packages.yaml
# packages:
# python:
# version: [3, 2]
# without this you'll get:
# paraview requires python version 3:, but spec asked for 2.7.16
# for `spack spec paraview+python+osmesa`
# see spack pull request #11539
extends('python', when='+python')
extends('python', when='+python3')

depends_on('python@2.7:2.8', when='+python', type=('build', 'run'))
depends_on('python@3:', when='+python3', type=('build', 'run'))

depends_on('py-numpy', when='+python', type=('build', 'run'))
depends_on('py-numpy', when='+python3', type=('build', 'run'))
depends_on('py-mpi4py', when='+python+mpi', type=('build', 'run'))
# Matplotlib >2.x requires Python 3
depends_on('py-matplotlib@:2.99', when='+python', type='run')
depends_on('py-mpi4py', when='+python3+mpi', type=('build', 'run'))

depends_on('py-matplotlib@:2', when='+python', type='run')
depends_on('py-matplotlib@3:', when='+python3', type='run')

depends_on('mpi', when='+mpi')
depends_on('qt+opengl', when='@5.3.0:+qt+opengl2')
depends_on('qt~opengl', when='@5.3.0:+qt~opengl2')
Expand Down Expand Up @@ -123,7 +148,7 @@ def setup_environment(self, spack_env, run_env):
run_env.prepend_path('LIBRARY_PATH', lib_dir)
run_env.prepend_path('LD_LIBRARY_PATH', lib_dir)

if '+python' in self.spec:
if '+python' in self.spec or '+python3' in self.spec:
if self.spec.version <= Version('5.4.1'):
pv_pydir = join_path(lib_dir, 'site-packages')
run_env.prepend_path('PYTHONPATH', pv_pydir)
Expand Down Expand Up @@ -183,7 +208,7 @@ def nvariant_bool(feature):
'-DPARAVIEW_QT_VERSION=%s' % spec['qt'].version[0],
])

if '+python' in spec:
if '+python' in spec or '+python3' in spec:
cmake_args.extend([
'-DPARAVIEW_ENABLE_PYTHON:BOOL=ON',
'-DPYTHON_EXECUTABLE:FILEPATH=%s' % spec['python'].command.path
Expand Down

0 comments on commit c98190a

Please sign in to comment.