bigdft: convert the use of format strings to fstrings. (#42006)

* bigdft: convert the use of format strings to fstrings everywhere

* Fix formatting

* reformat with black

* Update compiler flags in bigdft-core

* Revert "Update compiler flags in bigdft-core"

This reverts commit f7524ed78449b16163c92bf0ccc8b0dd473039dc.
This commit is contained in:
Ashwin Kumar Karnad 2024-01-10 21:43:13 +01:00 committed by GitHub
parent 8ae86fc58f
commit 94885c2402
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 135 additions and 132 deletions

View file

@ -33,7 +33,7 @@ class BigdftAtlab(AutotoolsPackage):
depends_on("openbabel", when="+openbabel")
for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]:
depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers))
depends_on(f"bigdft-futile@{vers}", when=f"@{vers}")
configure_directory = "atlab"
@ -56,24 +56,24 @@ def configure_args(self):
fcflags.append("-fallow-argument-mismatch")
args = [
"FCFLAGS=%s" % " ".join(fcflags),
"CFLAGS=%s" % " ".join(cflags),
"CXXFLAGS=%s" % " ".join(cxxflags),
"--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags,
"--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags + "/futile",
"--with-moduledir=%s" % prefix.include,
"--prefix=%s" % prefix,
f"FCFLAGS={' '.join(fcflags)}",
f"CFLAGS={' '.join(cflags)}",
f"CXXFLAGS={' '.join(cxxflags)}",
f"--with-futile-libs={spec['bigdft-futile'].libs.ld_flags}",
f"--with-futile-incs={spec['bigdft-futile'].headers.include_flags}/futile",
f"--with-moduledir={prefix.include}",
f"--prefix={prefix}",
"--without-etsf-io",
]
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
args.append("CC=%s" % spec["mpi"].mpicc)
args.append("CXX=%s" % spec["mpi"].mpicxx)
args.append("FC=%s" % spec["mpi"].mpifc)
args.append("F90=%s" % spec["mpi"].mpifc)
args.append("F77=%s" % spec["mpi"].mpif77)
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
args.append(f"F90={spec['mpi'].mpifc}")
args.append(f"F77={spec['mpi'].mpif77}")
else:
args.append("--disable-mpi")
@ -84,8 +84,8 @@ def configure_args(self):
if "+openbabel" in spec:
args.append("--enable-openbabel")
args.append("--with-openbabel-libs=%s" % spec["openbabel"].prefix.lib)
args.append("--with-openbabel-incs=%s" % spec["openbabel"].prefix.include)
args.append(f"--with-openbabel-libs={spec['openbabel'].prefix.lib}")
args.append(f"--with-openbabel-incs={spec['openbabel'].prefix.include}")
return args

View file

@ -43,8 +43,8 @@ class BigdftChess(AutotoolsPackage, CudaPackage):
# depends_on('netlib-minpack', when='+minpack')
for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]:
depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers))
depends_on("bigdft-atlab@{0}".format(vers), when="@{0}".format(vers))
depends_on(f"bigdft-futile@{vers}", when=f"@{vers}")
depends_on(f"bigdft-atlab@{vers}", when=f"@{vers}")
configure_directory = "chess"
@ -53,7 +53,7 @@ def configure_args(self):
prefix = self.prefix
python_version = spec["python"].version.up_to(2)
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, "python{0}".format(python_version))
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
@ -66,25 +66,25 @@ def configure_args(self):
linalg.append(spec["blas"].libs.ld_flags)
args = [
"FCFLAGS=%s" % " ".join(openmp_flag),
"LDFLAGS=%s" % " ".join(linalg),
"--with-ext-linalg=%s" % " ".join(linalg),
"--with-pyyaml-path=%s" % pyyaml,
"--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags,
"--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags,
"--with-moduledir=%s" % prefix.include,
"--prefix=%s" % prefix,
f"FCFLAGS={' '.join(openmp_flag)}",
f"LDFLAGS={' '.join(linalg)}",
f"--with-ext-linalg={' '.join(linalg)}",
f"--with-pyyaml-path={pyyaml}",
f"--with-futile-libs={spec['bigdft-futile'].libs.ld_flags}",
f"--with-futile-incs={spec['bigdft-futile'].headers.include_flags}",
f"--with-moduledir={prefix.include}",
f"--prefix={prefix}",
"--without-etsf-io",
]
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
args.append("CC=%s" % spec["mpi"].mpicc)
args.append("CXX=%s" % spec["mpi"].mpicxx)
args.append("FC=%s" % spec["mpi"].mpifc)
args.append("F90=%s" % spec["mpi"].mpifc)
args.append("F77=%s" % spec["mpi"].mpif77)
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
args.append(f"F90={spec['mpi'].mpifc}")
args.append(f"F77={spec['mpi'].mpif77}")
else:
args.append("--disable-mpi")
@ -93,12 +93,12 @@ def configure_args(self):
else:
args.append("--without-openmp")
args.append("--with-atlab-libs=%s" % spec["bigdft-atlab"].prefix.lib)
args.append(f"--with-atlab-libs={spec['bigdft-atlab'].prefix.lib}")
if "+cuda" in spec:
args.append("--enable-cuda-gpu")
args.append("--with-cuda-path=%s" % spec["cuda"].prefix)
args.append("--with-cuda-libs=%s" % spec["cuda"].libs.link_flags)
args.append(f"--with-cuda-path={spec['cuda'].prefix}")
args.append(f"--with-cuda-libs={spec['cuda'].libs.link_flags}")
if "+minpack" in spec:
args.append("--with-minpack")

View file

@ -45,10 +45,10 @@ class BigdftCore(AutotoolsPackage, CudaPackage):
depends_on("libxc@:4.3.4", when="@develop")
for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]:
depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers))
depends_on("bigdft-chess@{0}".format(vers), when="@{0}".format(vers))
depends_on("bigdft-psolver@{0}".format(vers), when="@{0}".format(vers))
depends_on("bigdft-libabinit@{0}".format(vers), when="@{0}".format(vers))
depends_on(f"bigdft-futile@{vers}", when=f"@{vers}")
depends_on(f"bigdft-chess@{vers}", when=f"@{vers}")
depends_on(f"bigdft-psolver@{vers}", when=f"@{vers}")
depends_on(f"bigdft-libabinit@{vers}", when=f"@{vers}")
configure_directory = "bigdft"
@ -57,7 +57,7 @@ def configure_args(self):
prefix = self.prefix
python_version = spec["python"].version.up_to(2)
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, "python{0}".format(python_version))
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
@ -70,35 +70,34 @@ def configure_args(self):
linalg.append(spec["blas"].libs.ld_flags)
args = [
"FCFLAGS=%s" % " ".join(openmp_flag),
"--with-ext-linalg=%s" % " ".join(linalg),
"--with-pyyaml-path=%s" % pyyaml,
"--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags,
"--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags,
"--with-chess-libs=%s" % spec["bigdft-chess"].libs.ld_flags,
"--with-chess-incs=%s" % spec["bigdft-chess"].headers.include_flags,
"--with-psolver-libs=%s" % spec["bigdft-psolver"].libs.ld_flags,
"--with-psolver-incs=%s" % spec["bigdft-psolver"].headers.include_flags,
"--with-libABINIT-libs=%s" % spec["bigdft-libabinit"].libs.ld_flags,
"--with-libABINIT-incs=%s" % spec["bigdft-libabinit"].headers.include_flags,
"--with-libgain-libs=%s" % spec["libgain"].libs.ld_flags,
"--with-libgain-incs=%s" % spec["libgain"].headers.include_flags,
"--with-libxc-libs=%s %s"
% (spec["libxc"].libs.ld_flags, spec["libxc"].libs.ld_flags + "f90"),
"--with-libxc-incs=%s" % spec["libxc"].headers.include_flags,
"--with-moduledir=%s" % prefix.include,
"--prefix=%s" % prefix,
f"FCFLAGS={' '.join(openmp_flag)}",
f"--with-ext-linalg={' '.join(linalg)}",
f"--with-pyyaml-path={pyyaml}",
f"--with-futile-libs={spec['bigdft-futile'].libs.ld_flags}",
f"--with-futile-incs={spec['bigdft-futile'].headers.include_flags}",
f"--with-chess-libs={spec['bigdft-chess'].libs.ld_flags}",
f"--with-chess-incs={spec['bigdft-chess'].headers.include_flags}",
f"--with-psolver-libs={spec['bigdft-psolver'].libs.ld_flags}",
f"--with-psolver-incs={spec['bigdft-psolver'].headers.include_flags}",
f"--with-libABINIT-libs={spec['bigdft-libabinit'].libs.ld_flags}",
f"--with-libABINIT-incs={spec['bigdft-libabinit'].headers.include_flags}",
f"--with-libgain-libs={spec['libgain'].libs.ld_flags}",
f"--with-libgain-incs={spec['libgain'].headers.include_flags}",
f"--with-libxc-libs={spec['libxc'].libs.ld_flags} {spec['libxc'].libs.ld_flags}f90",
f"--with-libxc-incs={spec['libxc'].headers.include_flags}",
f"--with-moduledir={prefix.include}",
f"--prefix={prefix}",
"--without-etsf-io",
]
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
args.append("CC=%s" % spec["mpi"].mpicc)
args.append("CXX=%s" % spec["mpi"].mpicxx)
args.append("FC=%s" % spec["mpi"].mpifc)
args.append("F90=%s" % spec["mpi"].mpifc)
args.append("F77=%s" % spec["mpi"].mpif77)
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
args.append(f"F90={spec['mpi'].mpifc}")
args.append(f"F77={spec['mpi'].mpif77}")
else:
args.append("--disable-mpi")
@ -109,15 +108,15 @@ def configure_args(self):
if "+cuda" in spec:
args.append("--enable-opencl")
args.append("--with-ocl-path=%s" % spec["cuda"].prefix)
args.append(f"--with-ocl-path={spec['cuda'].prefix}")
args.append("--enable-cuda-gpu")
args.append("--with-cuda-path=%s" % spec["cuda"].prefix)
args.append("--with-cuda-libs=%s" % spec["cuda"].libs.link_flags)
args.append(f"--with-cuda-path={spec['cuda'].prefix}")
args.append(f"--with-cuda-libs={spec['cuda'].libs.link_flags}")
if "+openbabel" in spec:
args.append("--enable-openbabel")
args.append("--with-openbabel-libs=%s" % spec["openbabel"].prefix.lib)
args.append("--with-openbabel-incs=%s" % spec["openbabel"].prefix.include)
args.append(f"--with-openbabel-libs={spec['openbabel'].prefix.lib}")
args.append(f"--with-openbabel-incs={spec['openbabel'].prefix.include}")
return args

View file

@ -49,18 +49,18 @@ def configure_args(self):
linalg = [spec["blas"].libs.ld_flags, spec["lapack"].libs.ld_flags]
python_version = spec["python"].version.up_to(2)
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, "python{0}".format(python_version))
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
openmp_flag.append(self.compiler.openmp_flag)
args = [
"FCFLAGS=%s" % " ".join(openmp_flag),
"--with-ext-linalg=%s" % " ".join(linalg),
"--with-yaml-path=%s" % spec["libyaml"].prefix,
"--with-pyyaml-path=%s" % pyyaml,
"--prefix=%s" % prefix,
f"FCFLAGS={' '.join(openmp_flag)}",
f"--with-ext-linalg={' '.join(linalg)}",
f"--with-yaml-path={spec['libyaml'].prefix}",
f"--with-pyyaml-path={pyyaml}",
f"--prefix={prefix}",
]
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
@ -71,19 +71,19 @@ def configure_args(self):
args.append("--without-openmp")
if "+mpi" in spec:
args.append("CC=%s" % spec["mpi"].mpicc)
args.append("CXX=%s" % spec["mpi"].mpicxx)
args.append("FC=%s" % spec["mpi"].mpifc)
args.append("F90=%s" % spec["mpi"].mpifc)
args.append("F77=%s" % spec["mpi"].mpif77)
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
args.append(f"F90={spec['mpi'].mpifc}")
args.append(f"F77={spec['mpi'].mpif77}")
else:
args.append("--disable-mpi")
if "+cuda" in spec:
args.append("--enable-opencl")
args.append("--with-ocl-path=%s" % spec["cuda"].prefix)
args.append(f"--with-ocl-path={spec['cuda'].prefix}")
args.append("--enable-cuda-gpu")
args.append("--with-cuda-path=%s" % spec["cuda"].prefix)
args.append(f"--with-cuda-path={spec['cuda'].prefix}")
return args

View file

@ -37,7 +37,7 @@ class BigdftLibabinit(AutotoolsPackage):
depends_on("libxc@:4.3.4", when="@1.9.1:")
for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]:
depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers))
depends_on(f"bigdft-futile@{vers}", when=f"@{vers}")
configure_directory = "libABINIT"
@ -50,24 +50,28 @@ def configure_args(self):
fcflags.append("-fallow-argument-mismatch")
args = [
"FCFLAGS=%s" % " ".join(fcflags),
"--with-libxc-libs=%s %s"
% (spec["libxc"].libs.ld_flags, spec["libxc"].libs.ld_flags + "f90"),
"--with-libxc-incs=%s" % spec["libxc"].headers.include_flags,
"--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags,
"--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags,
"--with-moduledir=%s" % prefix.include,
"--prefix=%s" % prefix,
f"FCFLAGS={' '.join(fcflags)}",
f"--with-libxc-libs={spec['libxc'].libs.ld_flags} "
f"{spec['libxc'].libs.ld_flags + 'f90'}",
f"--with-libxc-incs={spec['libxc'].headers.include_flags}",
f"--with-futile-libs={spec['bigdft-futile'].libs.ld_flags}",
f"--with-futile-incs={spec['bigdft-futile'].headers.include_flags}",
f"--with-moduledir={prefix.include}",
f"--prefix={prefix}",
]
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
args.append("CC=%s" % spec["mpi"].mpicc)
args.append("CXX=%s" % spec["mpi"].mpicxx)
args.append("FC=%s" % spec["mpi"].mpifc)
args.append("F90=%s" % spec["mpi"].mpifc)
args.append("F77=%s" % spec["mpi"].mpif77)
args.extend(
[
f"CC={spec['mpi'].mpicc}",
f"CXX={spec['mpi'].mpicxx}",
f"FC={spec['mpi'].mpifc}",
f"F90={spec['mpi'].mpifc}",
f"F77={spec['mpi'].mpif77}",
]
)
else:
args.append("--disable-mpi")

View file

@ -40,8 +40,8 @@ class BigdftPsolver(AutotoolsPackage, CudaPackage):
depends_on("scalapack", when="+scalapack")
for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]:
depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers))
depends_on("bigdft-atlab@{0}".format(vers), when="@{0}".format(vers))
depends_on(f"bigdft-futile@{vers}", when=f"@{vers}")
depends_on(f"bigdft-atlab@{vers}", when=f"@{vers}")
configure_directory = "psolver"
@ -50,7 +50,7 @@ def configure_args(self):
prefix = self.prefix
python_version = spec["python"].version.up_to(2)
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, "python{0}".format(python_version))
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
@ -63,24 +63,24 @@ def configure_args(self):
linalg.append(spec["blas"].libs.ld_flags)
args = [
"FCFLAGS=%s" % " ".join(openmp_flag),
"--with-ext-linalg=%s" % " ".join(linalg),
"--with-pyyaml-path=%s" % pyyaml,
"--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags,
"--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags,
"--with-moduledir=%s" % prefix.include,
"--prefix=%s" % prefix,
f"FCFLAGS={' '.join(openmp_flag)}",
f"--with-ext-linalg={' '.join(linalg)}",
f"--with-pyyaml-path={pyyaml}",
f"--with-futile-libs={spec['bigdft-futile'].libs.ld_flags}",
f"--with-futile-incs={spec['bigdft-futile'].headers.include_flags}",
f"--with-moduledir={prefix.include}",
f"--prefix={prefix}",
"--without-etsf-io",
]
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
args.append("CC=%s" % spec["mpi"].mpicc)
args.append("CXX=%s" % spec["mpi"].mpicxx)
args.append("FC=%s" % spec["mpi"].mpifc)
args.append("F90=%s" % spec["mpi"].mpifc)
args.append("F77=%s" % spec["mpi"].mpif77)
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
args.append(f"F90={spec['mpi'].mpifc}")
args.append(f"F77={spec['mpi'].mpif77}")
else:
args.append("--disable-mpi")
@ -89,12 +89,12 @@ def configure_args(self):
else:
args.append("--without-openmp")
args.append("--with-atlab-libs=%s" % spec["bigdft-atlab"].prefix.lib)
args.append(f"--with-atlab-libs={spec['bigdft-atlab'].prefix.lib}")
if "+cuda" in spec:
args.append("--enable-cuda-gpu")
args.append("--with-cuda-path=%s" % spec["cuda"].prefix)
args.append("--with-cuda-libs=%s" % spec["cuda"].libs.link_flags)
args.append(f"--with-cuda-path={spec['cuda'].prefix}")
args.append(f"--with-cuda-libs={spec['cuda'].libs.link_flags}")
return args

View file

@ -39,9 +39,9 @@ class BigdftSpred(AutotoolsPackage):
depends_on("scalapack", when="+scalapack")
for vers in ["1.9.0", "1.9.1", "1.9.2", "develop"]:
depends_on("bigdft-futile@{0}".format(vers), when="@{0}".format(vers))
depends_on("bigdft-psolver@{0}".format(vers), when="@{0}".format(vers))
depends_on("bigdft-core@{0}".format(vers), when="@{0}".format(vers))
depends_on(f"bigdft-futile@{vers}", when=f"@{vers}")
depends_on(f"bigdft-psolver@{vers}", when=f"@{vers}")
depends_on(f"bigdft-core@{vers}", when=f"@{vers}")
configure_directory = "spred"
@ -50,7 +50,7 @@ def configure_args(self):
prefix = self.prefix
python_version = spec["python"].version.up_to(2)
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, "python{0}".format(python_version))
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
@ -63,27 +63,27 @@ def configure_args(self):
linalg.append(spec["blas"].libs.ld_flags)
args = [
"FCFLAGS=%s" % " ".join(openmp_flag),
"--with-ext-linalg=%s" % " ".join(linalg),
"--with-pyyaml-path=%s" % pyyaml,
"--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags,
"--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags,
"--with-psolver-libs=%s" % spec["bigdft-psolver"].prefix.lib,
"--with-psolver-incs=%s" % spec["bigdft-psolver"].headers.include_flags,
"--with-core-libs=%s" % spec["bigdft-core"].prefix.lib,
"--with-core-incs=%s" % spec["bigdft-core"].headers.include_flags,
"--with-moduledir=%s" % prefix.include,
"--prefix=%s" % prefix,
f"FCFLAGS={' '.join(openmp_flag)}",
f"--with-ext-linalg={' '.join(linalg)}",
f"--with-pyyaml-path={pyyaml}",
f"--with-futile-libs={spec['bigdft-futile'].libs.ld_flags}",
f"--with-futile-incs={spec['bigdft-futile'].headers.include_flags}",
f"--with-psolver-libs={spec['bigdft-psolver'].prefix.lib}",
f"--with-psolver-incs={spec['bigdft-psolver'].headers.include_flags}",
f"--with-core-libs={spec['bigdft-core'].prefix.lib}",
f"--with-core-incs={spec['bigdft-core'].headers.include_flags}",
f"--with-moduledir={prefix.include}",
f"--prefix={prefix}",
]
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
args.append("CC=%s" % spec["mpi"].mpicc)
args.append("CXX=%s" % spec["mpi"].mpicxx)
args.append("FC=%s" % spec["mpi"].mpifc)
args.append("F90=%s" % spec["mpi"].mpifc)
args.append("F77=%s" % spec["mpi"].mpif77)
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
args.append(f"F90={spec['mpi'].mpifc}")
args.append(f"F77={spec['mpi'].mpif77}")
else:
args.append("--disable-mpi")