summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2018-06-15 10:14:50 -0500
committerGitHub <noreply@github.com>2018-06-15 10:14:50 -0500
commitcea5d04a1e03c8ecdbbe76d85c8e9fb716257dfb (patch)
tree1a4fd1eacd5a544bcf7d6df7aec1ee1a0595a93d /var
parenta3a9b2ab2b505f1cd17a2a02934dbfd54b3144aa (diff)
downloadspack-cea5d04a1e03c8ecdbbe76d85c8e9fb716257dfb.tar.gz
spack-cea5d04a1e03c8ecdbbe76d85c8e9fb716257dfb.tar.bz2
spack-cea5d04a1e03c8ecdbbe76d85c8e9fb716257dfb.tar.xz
spack-cea5d04a1e03c8ecdbbe76d85c8e9fb716257dfb.zip
Fix GDAL Python bindings and add import tests (#8482)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/gdal/package.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py
index 124c472f9e..996564f337 100644
--- a/var/spack/repos/builtin/packages/gdal/package.py
+++ b/var/spack/repos/builtin/packages/gdal/package.py
@@ -41,6 +41,11 @@ class Gdal(AutotoolsPackage):
list_url = "http://download.osgeo.org/gdal/"
list_depth = 1
+ import_modules = [
+ 'osgeo', 'osgeo.gdal', 'osgeo.ogr', 'osgeo.osr',
+ 'osgeo.gdal_array', 'osgeo.gdalconst'
+ ]
+
version('2.3.0', '2fe9d64fcd9dc37645940df020d3e200')
version('2.1.2', 'ae85b78888514c75e813d658cac9478e')
version('2.0.2', '940208e737c87d31a90eaae43d0efd65')
@@ -128,15 +133,14 @@ class Gdal(AutotoolsPackage):
depends_on('proj', when='+proj @2.3:')
depends_on('perl', type=('build', 'run'), when='+perl')
depends_on('python', type=('build', 'run'), when='+python')
+ # swig/python/setup.py
+ depends_on('py-setuptools', type='build', when='+python')
+ depends_on('py-numpy@1.0.0:', type=('build', 'run'), when='+python')
depends_on('java', type=('build', 'run'), when='+java')
depends_on('armadillo', when='+armadillo')
depends_on('cryptopp', when='+cryptopp @2.1:')
depends_on('openssl', when='+crypto @2.3:')
- # https://trac.osgeo.org/gdal/wiki/SWIG
- depends_on('swig', type='build', when='+python')
- depends_on('swig', type='build', when='+perl')
-
# https://trac.osgeo.org/gdal/wiki/SupportedCompilers
msg = 'GDAL requires C++11 support'
conflicts('%gcc@:4.8.0', msg=msg)
@@ -145,6 +149,13 @@ class Gdal(AutotoolsPackage):
conflicts('%xl@:13.0', msg=msg)
conflicts('%xl_r@:13.0', msg=msg)
+ def setup_environment(self, spack_env, run_env):
+ # Needed to install Python bindings to GDAL installation
+ # prefix instead of Python installation prefix.
+ # See swig/python/GNUmakefile for more details.
+ spack_env.set('PREFIX', self.prefix)
+ spack_env.set('DESTDIR', '/')
+
# https://trac.osgeo.org/gdal/wiki/BuildHints
def configure_args(self):
spec = self.spec
@@ -426,6 +437,14 @@ class Gdal(AutotoolsPackage):
return args
@run_after('install')
+ @on_package_attributes(run_tests=True)
+ def import_module_test(self):
+ if '+python' in self.spec:
+ with working_dir('..'):
+ for module in self.import_modules:
+ python('-c', 'import {0}'.format(module))
+
+ @run_after('install')
def darwin_fix(self):
# The shared library is not installed correctly on Darwin; fix this
if sys.platform == 'darwin':