summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorNeil Flood <neilflood@fastmail.fm>2018-12-24 01:50:41 +1000
committerAdam J. Stewart <ajstewart426@gmail.com>2018-12-23 09:50:41 -0600
commit451bfbd1ab29f8e45268eb61d22025e96fafac46 (patch)
tree1ba8b95e3c88eadc540a9b1e76cc08d81ef9b91f /var
parent93d9139ff6bdda447bb46c9272f06e792af62392 (diff)
downloadspack-451bfbd1ab29f8e45268eb61d22025e96fafac46.tar.gz
spack-451bfbd1ab29f8e45268eb61d22025e96fafac46.tar.bz2
spack-451bfbd1ab29f8e45268eb61d22025e96fafac46.tar.xz
spack-451bfbd1ab29f8e45268eb61d22025e96fafac46.zip
py-pynio: new package (#10074)
* py-pynio: new package * Major re-working to add some of the optional dependencies, and make it conform to the approach described in the pynio setup.py comments. Much of it turned out to be too complicated, and I have added some notes in comments to explain this to future adventurers. * Added variants for the hdf5 and gdal dependencies, which do seem to be genuinely optional. Also added absolute dependencies for jpeg and zlib, which setup.py says it wants, but were being found as the os-installed versions. * Added descriptions for the new variants, and moved them to above the dependencies
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-pynio/package.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-pynio/package.py b/var/spack/repos/builtin/packages/py-pynio/package.py
new file mode 100644
index 0000000000..a4739e029f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-pynio/package.py
@@ -0,0 +1,71 @@
+# Copyright 2013-2018 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 PyPynio(PythonPackage):
+ """PyNIO ("pie-nee-oh") is a Python module that allows read and/or
+ write access to a variety of scientific data formats popular in
+ climate and weather"""
+
+ homepage = "https://www.pyngl.ucar.edu/Nio.shtml"
+ url = "https://github.com/NCAR/pynio/archive/1.5.4.tar.gz"
+
+ version('1.5.4', sha256='e5bb57d902740d25e4781a9f89e888149f55f2ffe60f9a5ad71069f017c89e1a')
+
+ variant('hdf5', default=False, description='Include HDF5 support')
+ variant('gdal', default=False, description='Include GDAL support')
+
+ # The setup.py claims it requires these abolutely.
+ depends_on('libpng')
+ depends_on('jpeg')
+ depends_on('zlib')
+
+ # Spack does not currently have netcdf below 4.x, and 3.x is a
+ # fundamentally different format. So, currently this is only providing
+ # support for netcdf4.
+ depends_on('netcdf@3.6.0:')
+
+ # Turning on the hdf (i.e. hdf4) dependency causes it not to build, with
+ # compile errors that (weirdly) relate to the declarations of HDF5.
+ # Very odd, so I have put it in as a comment, for some brave soul to take
+ # on later.
+ # depends_on('hdf', when='+hdf4')
+
+ # This one works, though.
+ depends_on('hdf5', when='+hdf5')
+
+ # Turning on the GDAL dependency apparently forces it to link with
+ # -ljasper, meaning that really it depends on gdal+jasper. In my view
+ # it should not need this unless one were specifically using PyNio to
+ # use GDAL to read JPEG-2000 files, but it seems to be hard-wired
+ # in PyNio's setup.py.
+ depends_on('gdal+jasper', when='+gdal')
+
+ # I have left off a few other optional dependencies, as they are not yet
+ # in Spack. HDFEOS, HDFEOS5, GRIB. See the pynio setup.py for details.
+
+ depends_on('py-numpy', type=('build', 'run'))
+
+ def setup_environment(self, spack_env, run_env):
+ """
+ These environment variables are how the setup.py knows which options
+ to turn on, and how to find them.
+ """
+ spack_env.set('F2CLIBS', 'gfortran')
+ spack_env.set('HAS_NETCDF4', '1')
+ spack_env.set('NETCDF4_PREFIX', self.spec['netcdf'].prefix)
+ if '+hdf5' in self.spec:
+ spack_env.set('HAS_HDF5', '1')
+ spack_env.set('HDF5_PREFIX', self.spec['hdf5'].prefix)
+ if '+gdal' in self.spec:
+ spack_env.set('HAS_GDAL', '1')
+ spack_env.set('GDAL_PREFIX', self.spec['gdal'].prefix)
+
+# This one is trouble - see comments above.
+# if '+hdf4' in self.spec:
+# spack_env.set('HAS_HDF4', '1')
+# spack_env.set('HDF4_PREFIX', self.spec['hdf'].prefix)