# Copyright 2013-2020 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 PyPyscf(PythonPackage):
    """PySCF is a collection of electronic structure programs powered
    by Python."""

    homepage = "https://sunqm.github.io/pyscf/"
    git      = "https://github.com/pyscf/pyscf"

    maintainers = ['naromero77']

    version('1.7.3', tag='v1.7.3')

    # dependencies
    depends_on('cmake@2.8:', type='build')
    depends_on('python@2.6:', type=('build', 'run'))
    depends_on('py-numpy@1.8.0:', type=('build', 'run'))
    depends_on('py-scipy@0.12:', type=('build', 'run'))
    depends_on('py-h5py@2.3.0:', type=('build', 'run'))
    depends_on('blas')
    depends_on('libcint+coulomb_erf+f12')
    depends_on('libxc')
    depends_on('xcfun@:2.0.0a2')  # PySCF does not support recent version of the xcfun API'

    def setup_build_environment(self, env):
        # Tell PSCF where supporting libraries are located."
        spec = self.spec

        pyscf_search_dir = []
        pyscf_search_dir.append(spec['blas'].prefix)
        pyscf_search_dir.append(spec['libcint'].prefix)
        pyscf_search_dir.append(spec['libxc'].prefix)
        pyscf_search_dir.append(spec['xcfun'].prefix)
        pyscf_search_dir.append(spec['xcfun'].prefix.include.XCFun)

        env.set('PYSCF_INC_DIR', ":".join(pyscf_search_dir))

@@ -464,16 +464,51 @@
 ro77'%5D%0A%0A
+    version('1.7.5', tag='v1.7.5')%0A
     vers
@@ -534,16 +534,16 @@
 1.7.3')%0A
-
 %0A    # d
@@ -933,78 +933,58 @@
 cfun
-@:2.0.0a2
 ')
+%0A
   
-# PySCF does not support recent version of the xcfun API'
+  depends_on('xcfun@2.0.0a2', when='@:1.7.4')
 %0A%0A  
@@ -1187,32 +1187,32 @@
 'blas'%5D.prefix)%0A
-
         pyscf_se
@@ -1243,32 +1243,94 @@
 bcint'%5D.prefix)%0A
+        pyscf_search_dir.append(spec%5B'libcint'%5D.prefix.lib64)%0A
         pyscf_se

add version 1.7.5. (#20135)