visit: add an external find function (determine_version) (#25817)
* visit: add an external find function (determine_version) * visit: correct too long comment line * visit: forgot to set executables * visit: external find uses signgle dash version * visit: found as external asking visit version
This commit is contained in:
parent
653d5e1590
commit
20ee786d09
1 changed files with 11 additions and 0 deletions
|
@ -64,6 +64,8 @@ class Visit(CMakePackage):
|
||||||
|
|
||||||
extendable = True
|
extendable = True
|
||||||
|
|
||||||
|
executables = ['^visit$']
|
||||||
|
|
||||||
version('develop', branch='develop')
|
version('develop', branch='develop')
|
||||||
version('3.1.1', sha256='0b60ac52fd00aff3cf212a310e36e32e13ae3ca0ddd1ea3f54f75e4d9b6c6cf0')
|
version('3.1.1', sha256='0b60ac52fd00aff3cf212a310e36e32e13ae3ca0ddd1ea3f54f75e4d9b6c6cf0')
|
||||||
version('3.0.1', sha256='a506d4d83b8973829e68787d8d721199523ce7ec73e7594e93333c214c2c12bd')
|
version('3.0.1', sha256='a506d4d83b8973829e68787d8d721199523ce7ec73e7594e93333c214c2c12bd')
|
||||||
|
@ -282,3 +284,12 @@ def cmake_args(self):
|
||||||
args.append('-DVISIT_MPI_COMPILER={0}'.format(spec['mpi'].mpicxx))
|
args.append('-DVISIT_MPI_COMPILER={0}'.format(spec['mpi'].mpicxx))
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
# https://spack.readthedocs.io/en/latest/packaging_guide.html?highlight=executables#making-a-package-discoverable-with-spack-external-find
|
||||||
|
# Here we are only able to determine the latest version
|
||||||
|
# despite VisIt may have multiple versions
|
||||||
|
@classmethod
|
||||||
|
def determine_version(cls, exe):
|
||||||
|
output = Executable(exe)('-version', output=str, error=str)
|
||||||
|
match = re.search(r'\s*(\d[\d\.]+)\.', output)
|
||||||
|
return match.group(1) if match else None
|
||||||
|
|
Loading…
Reference in a new issue