From 4553b1400cd6432ecadfb80e3ef6c44f098481b4 Mon Sep 17 00:00:00 2001 From: Milton Woods Date: Wed, 24 May 2017 01:06:59 +1000 Subject: Magics with eccodes variant (#4320) * magics: use filter_file to avoid using system python in all versions * magics: add eccodes variant to switch between eccodes and grib-api --- .../packages/magics/no_hardcoded_python.patch | 5 ----- var/spack/repos/builtin/packages/magics/package.py | 26 +++++++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/magics/no_hardcoded_python.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/magics/no_hardcoded_python.patch b/var/spack/repos/builtin/packages/magics/no_hardcoded_python.patch deleted file mode 100644 index e2e2a5d1ba..0000000000 --- a/var/spack/repos/builtin/packages/magics/no_hardcoded_python.patch +++ /dev/null @@ -1,5 +0,0 @@ ---- a/tools/xml2mv.py 2016-06-27 17:49:27.000000000 +0200 -+++ a/tools/xml2mv.py 2016-09-13 16:25:17.246960456 +0200 -@@ -1 +1 @@ --#!/usr/bin/python -+#!/usr/bin/env python diff --git a/var/spack/repos/builtin/packages/magics/package.py b/var/spack/repos/builtin/packages/magics/package.py index fca92d69d4..1b3e3e87bf 100644 --- a/var/spack/repos/builtin/packages/magics/package.py +++ b/var/spack/repos/builtin/packages/magics/package.py @@ -41,10 +41,6 @@ class Magics(Package): version('2.29.4', '91c561f413316fb665b3bb563f3878d1') version('2.29.0', 'db20a4d3c51a2da5657c31ae3de59709', preferred=True) - # The patch changes the hardcoded path to python in shebang to enable the - # usage of the first python installation that appears in $PATH - patch('no_hardcoded_python.patch', when='@:2.29.6') - # The patch reorders includes and adds namespaces where necessary to # resolve ambiguity of invocations of isnan and isinf functions. The # patch is not needed since the version 2.29.1 @@ -55,6 +51,7 @@ class Magics(Package): variant('cairo', default=True, description='Enable cairo support[png/jpeg]') variant('metview', default=False, description='Enable metview support') variant('qt', default=False, description='Enable metview support with qt') + variant('eccodes', default=False, description='Use eccodes instead of grib-api') depends_on('cmake', type='build') depends_on('pkg-config', type='build') @@ -64,8 +61,8 @@ class Magics(Package): depends_on('python', type='build') depends_on('perl', type='build') depends_on('perl-xml-parser', type='build') - depends_on('eccodes', when='@2.30.0:') - depends_on('grib-api', when='@:2.29.6') + depends_on('eccodes', when='+eccodes') + depends_on('grib-api', when='~eccodes') depends_on('proj') depends_on('boost') depends_on('expat') @@ -74,9 +71,14 @@ class Magics(Package): depends_on('libemos', when='+bufr') depends_on('qt', when='+metview+qt') + conflicts('+eccodes', when='@:2.29.0') + + # Replace system python and perl by spack versions: def patch(self): for plfile in glob.glob('*/*.pl'): filter_file('#!/usr/bin/perl', '#!/usr/bin/env perl', plfile) + for pyfile in glob.glob('*/*.py'): + filter_file('#!/usr/bin/python', '#!/usr/bin/env python', pyfile) def install(self, spec, prefix): options = [] @@ -87,11 +89,6 @@ class Magics(Package): options.append('-DPROJ4_PATH=%s' % spec['proj'].prefix) options.append('-DENABLE_TESTS=OFF') - if self.version >= Version('2.30.0'): - options.append('-DECCODES_PATH=%s' % spec['eccodes'].prefix) - else: - options.append('-DGRIB_API_PATH=%s' % spec['grib-api'].prefix) - if '+bufr' in spec: options.append('-DENABLE_BUFR=ON') options.append('-DLIBEMOS_PATH=%s' % spec['libemos'].prefix) @@ -119,6 +116,13 @@ class Magics(Package): else: options.append('-DENABLE_METVIEW=OFF') + if '+eccodes' in spec: + options.append('-DENABLE_ECCODES=ON') + options.append('-DECCODES_PATH=%s' % spec['eccodes'].prefix) + else: + options.append('-DENABLE_ECCODES=OFF') + options.append('-DGRIB_API_PATH=%s' % spec['grib-api'].prefix) + if (self.compiler.f77 is None) or (self.compiler.fc is None): options.append('-DENABLE_FORTRAN=OFF') -- cgit v1.2.3-70-g09d2