ParaView and Catalyst use python3. (#11485)
Use python3 for latest paraview and catalyst versions.
This commit is contained in:
		| @@ -19,6 +19,7 @@ class Catalyst(CMakePackage): | |||||||
|     _urlfmt_gz = 'http://www.paraview.org/files/v{0}/ParaView-v{1}{2}.tar.gz' |     _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' |     _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.2', '7eb93c31a1e5deb7098c3b4275e53a4a') | ||||||
|     version('5.5.1', 'a7d92a45837b67c3371006cc45163277') |     version('5.5.1', 'a7d92a45837b67c3371006cc45163277') | ||||||
|     version('5.5.0', 'a8f2f41edadffdcc89b37fdc9aa7f005') |     version('5.5.0', 'a8f2f41edadffdcc89b37fdc9aa7f005') | ||||||
| @@ -31,17 +32,35 @@ class Catalyst(CMakePackage): | |||||||
|     version('4.4.0', 'fa1569857dd680ebb4d7ff89c2227378') |     version('4.4.0', 'fa1569857dd680ebb4d7ff89c2227378') | ||||||
|  |  | ||||||
|     variant('python', default=False, description='Enable Python support') |     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('essentials', default=False, description='Enable Essentials support') | ||||||
|     variant('extras', default=False, description='Enable Extras support') |     variant('extras', default=False, description='Enable Extras support. Implies Essentials.') | ||||||
|     variant('rendering', default=False, description='Enable VTK Rendering support') |     variant('rendering', default=True, description='Enable Rendering support. Implies Extras and Essentials.') | ||||||
|     variant('osmesa', default=True, description='Use offscreen rendering') |     variant('osmesa', default=True, description='Use offscreen rendering') | ||||||
|     conflicts('+osmesa', when='~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('git', type='build') | ||||||
|     depends_on('mpi') |     depends_on('mpi') | ||||||
|     depends_on('python@2:2.8', when='+python', type=("build", "link", "run")) |     depends_on('python@2.7:2.8', when='+python', type=('build', 'link', 'run')) | ||||||
|     depends_on('python', when='~python', type=("build")) |     depends_on('python@3:', when='+python3', type=('build', 'link', 'run')) | ||||||
|     depends_on('gl@3.2', when='+rendering') |     depends_on('gl@3.2:', when='+rendering') | ||||||
|     depends_on('mesa+osmesa', when='+rendering+osmesa') |     depends_on('mesa+osmesa', when='+rendering+osmesa') | ||||||
|     depends_on('glx', when='+rendering~osmesa') |     depends_on('glx', when='+rendering~osmesa') | ||||||
|     depends_on('cmake@3.3:', type='build') |     depends_on('cmake@3.3:', type='build') | ||||||
| @@ -77,16 +96,19 @@ def editions(self): | |||||||
|         """Transcribe spack variants into names of Catalyst Editions""" |         """Transcribe spack variants into names of Catalyst Editions""" | ||||||
|         selected = ['Base']  # Always required |         selected = ['Base']  # Always required | ||||||
|  |  | ||||||
|         if '+python' in self.spec: |         if '+python' in self.spec or '+python3' in self.spec: | ||||||
|             selected.append('Enable-Python') |             selected.append('Enable-Python') | ||||||
|  |  | ||||||
|         if '+essentials' in self.spec: |         if '+essentials' in self.spec: | ||||||
|             selected.append('Essentials') |             selected.append('Essentials') | ||||||
|  |  | ||||||
|         if '+extras' in self.spec: |         if '+extras' in self.spec: | ||||||
|  |             selected.append('Essentials') | ||||||
|             selected.append('Extras') |             selected.append('Extras') | ||||||
|  |  | ||||||
|         if '+rendering' in self.spec: |         if '+rendering' in self.spec: | ||||||
|  |             selected.append('Essentials') | ||||||
|  |             selected.append('Extras') | ||||||
|             selected.append('Rendering-Base') |             selected.append('Rendering-Base') | ||||||
|  |  | ||||||
|         return selected |         return selected | ||||||
| @@ -134,7 +156,7 @@ def setup_environment(self, spack_env, run_env): | |||||||
|         run_env.prepend_path('LIBRARY_PATH', lib_dir) |         run_env.prepend_path('LIBRARY_PATH', lib_dir) | ||||||
|         run_env.prepend_path('LD_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) |             python_version = self.spec['python'].version.up_to(2) | ||||||
|             run_env.prepend_path('PYTHONPATH', join_path(lib_dir, |             run_env.prepend_path('PYTHONPATH', join_path(lib_dir, | ||||||
|                                  'python{0}'.format(python_version), |                                  'python{0}'.format(python_version), | ||||||
| @@ -182,8 +204,13 @@ def nvariant_bool(feature): | |||||||
|             '-DVTK_USE_SYSTEM_EXPAT:BOOL=ON', |             '-DVTK_USE_SYSTEM_EXPAT:BOOL=ON', | ||||||
|             '-DVTK_USE_X:BOOL=%s' % nvariant_bool('+osmesa'), |             '-DVTK_USE_X:BOOL=%s' % nvariant_bool('+osmesa'), | ||||||
|             '-DVTK_USE_OFFSCREEN:BOOL=%s' % variant_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 |         return cmake_args | ||||||
|  |  | ||||||
|     def cmake(self, spec, prefix): |     def cmake(self, spec, prefix): | ||||||
|   | |||||||
| @@ -14,7 +14,9 @@ class Paraview(CMakePackage): | |||||||
|     homepage = 'http://www.paraview.org' |     homepage = 'http://www.paraview.org' | ||||||
|     url      = "http://www.paraview.org/files/v5.3/ParaView-v5.3.0.tar.gz" |     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' |     _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.6.0', sha256='cb8c4d752ad9805c74b4a08f8ae6e83402c3f11e38b274dba171b99bb6ac2460') | ||||||
|     version('5.5.2', '7eb93c31a1e5deb7098c3b4275e53a4a') |     version('5.5.2', '7eb93c31a1e5deb7098c3b4275e53a4a') | ||||||
|     version('5.5.1', 'a7d92a45837b67c3371006cc45163277') |     version('5.5.1', 'a7d92a45837b67c3371006cc45163277') | ||||||
| @@ -30,6 +32,7 @@ class Paraview(CMakePackage): | |||||||
|     variant('plugins', default=True, |     variant('plugins', default=True, | ||||||
|             description='Install include files for plugins support') |             description='Install include files for plugins support') | ||||||
|     variant('python', default=False, description='Enable Python 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('mpi', default=True, description='Enable MPI support') | ||||||
|     variant('osmesa', default=False, description='Enable OSMesa support') |     variant('osmesa', default=False, description='Enable OSMesa support') | ||||||
|     variant('qt', default=False, description='Enable Qt (gui) support') |     variant('qt', default=False, description='Enable Qt (gui) support') | ||||||
| @@ -37,11 +40,33 @@ class Paraview(CMakePackage): | |||||||
|     variant('examples', default=False, description="Build examples") |     variant('examples', default=False, description="Build examples") | ||||||
|     variant('hdf5', default=False, description="Use external HDF5") |     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='+python', type=('build', 'run')) | ||||||
|  |     depends_on('py-numpy', when='+python3', type=('build', 'run')) | ||||||
|     depends_on('py-mpi4py', when='+python+mpi', type=('build', 'run')) |     depends_on('py-mpi4py', when='+python+mpi', type=('build', 'run')) | ||||||
|     # Matplotlib >2.x requires Python 3 |     depends_on('py-mpi4py', when='+python3+mpi', type=('build', 'run')) | ||||||
|     depends_on('py-matplotlib@:2.99', when='+python', type='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('mpi', when='+mpi') | ||||||
|     depends_on('qt+opengl', when='@5.3.0:+qt+opengl2') |     depends_on('qt+opengl', when='@5.3.0:+qt+opengl2') | ||||||
|     depends_on('qt~opengl', when='@5.3.0:+qt~opengl2') |     depends_on('qt~opengl', when='@5.3.0:+qt~opengl2') | ||||||
| @@ -123,7 +148,7 @@ def setup_environment(self, spack_env, run_env): | |||||||
|         run_env.prepend_path('LIBRARY_PATH', lib_dir) |         run_env.prepend_path('LIBRARY_PATH', lib_dir) | ||||||
|         run_env.prepend_path('LD_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'): |             if self.spec.version <= Version('5.4.1'): | ||||||
|                 pv_pydir = join_path(lib_dir, 'site-packages') |                 pv_pydir = join_path(lib_dir, 'site-packages') | ||||||
|                 run_env.prepend_path('PYTHONPATH', pv_pydir) |                 run_env.prepend_path('PYTHONPATH', pv_pydir) | ||||||
| @@ -183,7 +208,7 @@ def nvariant_bool(feature): | |||||||
|                 '-DPARAVIEW_QT_VERSION=%s' % spec['qt'].version[0], |                 '-DPARAVIEW_QT_VERSION=%s' % spec['qt'].version[0], | ||||||
|             ]) |             ]) | ||||||
|  |  | ||||||
|         if '+python' in spec: |         if '+python' in spec or '+python3' in spec: | ||||||
|             cmake_args.extend([ |             cmake_args.extend([ | ||||||
|                 '-DPARAVIEW_ENABLE_PYTHON:BOOL=ON', |                 '-DPARAVIEW_ENABLE_PYTHON:BOOL=ON', | ||||||
|                 '-DPYTHON_EXECUTABLE:FILEPATH=%s' % spec['python'].command.path |                 '-DPYTHON_EXECUTABLE:FILEPATH=%s' % spec['python'].command.path | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dan Lipsa
					Dan Lipsa