r-*: improve Fortran dependency detection

- remove ".for" from the Fortran suffixes
- add ".f95" to the Fortran suffixes
- search only files in the `src` directory
This commit is contained in:
Pekka Ristola 2024-03-20 19:34:30 +02:00
parent 35b1a5919b
commit 660bbacbdf
No known key found for this signature in database
GPG key ID: 2C20BE716E05213E

View file

@ -317,8 +317,11 @@ def check_optdepends(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
def check_fortran(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
fortran_files = False
prefix = f"{pkg._pkgname}/src/"
# accepted Fortran file suffixes are listed in `/etc/R/Makeconf`
suffixes = (".f", ".f90", ".f95")
for name in cfg.tar.getnames():
if name.endswith(".f") or name.endswith(".f90") or name.endswith(".for"):
if name.startswith(prefix) and name.endswith(suffixes):
fortran_files = True
break
fortran_dep = "gcc-fortran" in pkg.makedepends