From 44e188f1111ce4251a756d92cae7c5a7e0ed41fe Mon Sep 17 00:00:00 2001
From: "Adam J. Stewart" <ajstewart426@gmail.com>
Date: Wed, 15 Jun 2016 13:55:51 -0500
Subject: [PATCH] Remove MPI support, fix INCLUDE filters

---
 .../repos/builtin/packages/psi4/package.py    | 37 ++++++++-----------
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/var/spack/repos/builtin/packages/psi4/package.py b/var/spack/repos/builtin/packages/psi4/package.py
index 74f1554336..fc77ba7412 100644
--- a/var/spack/repos/builtin/packages/psi4/package.py
+++ b/var/spack/repos/builtin/packages/psi4/package.py
@@ -36,19 +36,15 @@ class Psi4(Package):
 
     version('0.5', '53041b8a9be3958384171d0d22f9fdd0')
 
-    variant('mpi', default=True, description='Enable MPI parallelization')
-
     # Required dependencies
     depends_on('blas')
     depends_on('lapack')
-    depends_on('boost+chrono+filesystem~mpi+python+regex+serialization+system+timer+thread', when='~mpi')
-    depends_on('boost+chrono+filesystem+mpi+python+regex+serialization+system+timer+thread', when='+mpi')
+    depends_on('boost+chrono+filesystem+python+regex+serialization+system+timer+thread')
     depends_on('python')
     depends_on('cmake')
     depends_on('py-numpy')
 
     # Optional dependencies
-    depends_on('mpi', when='+mpi')
     # TODO: add packages for these
     # depends_on('perl')
     # depends_on('erd')
@@ -63,7 +59,6 @@ def install(self, spec, prefix):
             '-DLAPACK_LIBRARIES={0}'.format(spec['lapack'].lapack_shared_lib),
             '-DBOOST_INCLUDEDIR={0}'.format(spec['boost'].prefix.include),
             '-DBOOST_LIBRARYDIR={0}'.format(spec['boost'].prefix.lib),
-            '-DENABLE_MPI={0}'.format('ON' if '+mpi' in spec else 'OFF'),
             '-DENABLE_CHEMPS2=OFF'
         ]
 
@@ -73,12 +68,11 @@ def install(self, spec, prefix):
             cmake('..', *cmake_args)
 
             make()
-            ctest()
             make('install')
 
-        self.filter_compilers(spec)
+        self.filter_compilers(spec, prefix)
 
-    def filter_compilers(self, spec):
+    def filter_compilers(self, spec, prefix):
         """Run after install to tell the configuration files to
         use the compilers that Spack built the package with.
 
@@ -94,27 +88,28 @@ def filter_compilers(self, spec):
 
         for filename in cc_files:
             filter_file(os.environ['CC'], self.compiler.cc,
-                        os.path.join(self.prefix, filename), **kwargs)
+                        os.path.join(prefix, filename), **kwargs)
 
         for filename in cxx_files:
             filter_file(os.environ['CXX'], self.compiler.cxx,
-                        os.path.join(self.prefix, filename), **kwargs)
+                        os.path.join(prefix, filename), **kwargs)
 
         # The binary still keeps track of the compiler used to install Psi4
         # and uses it when creating a plugin template
         filter_file('@PLUGIN_CXX@', self.compiler.cxx,
-                    os.path.join(self.prefix, template), **kwargs)
+                    os.path.join(prefix, template), **kwargs)
 
         # The binary links to the build include directory instead of the
         # installation include directory:
         # https://github.com/psi4/psi4/issues/410
         filter_file('@PLUGIN_INCLUDES@', '-I{0}'.format(
-                        ' -I'.join(
-                            spec['psi4'].prefix.include,
-                            spec['boost'].prefix.include,
-                            spec['lapack'].prefix.include,
-                            spec['blas'].prefix.include,
-                            spec['python'].prefix.include,
-                            '/usr/include'
-                        )
-                    ), os.path.join(self.prefix, template), **kwargs)
+            ' -I'.join([
+                os.path.join(spec['psi4'].prefix.include, 'psi4'),
+                os.path.join(spec['boost'].prefix.include, 'boost'),
+                os.path.join(spec['python'].prefix.include, 'python{0}'.format(
+                    spec['python'].version.up_to(2))),
+                spec['lapack'].prefix.include,
+                spec['blas'].prefix.include,
+                '/usr/include'
+            ])
+        ), os.path.join(prefix, template), **kwargs)
-- 
GitLab