amrvis: add configuration file and default color palette (#30942)

This commit is contained in:
Erik 2022-06-06 08:01:57 -04:00 committed by GitHub
parent e4f3cfcc3a
commit 73ce789390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,8 @@ class Amrvis(MakefilePackage):
homepage = "https://github.com/AMReX-Codes/Amrvis"
git = "https://github.com/AMReX-Codes/Amrvis.git"
maintainers = ['etpalmer63']
version('main', tag='main')
variant(
@ -158,6 +160,14 @@ def edit(self, spec, prefix):
'# Spack removed INCLUDE_LOCATIONS and LIBRARY_LOCATIONS'
)
# Rewrite configuration file with location of
# the color palette after install
configfile = FileFilter("amrvis.defaults")
configfile.filter(
r'^palette\s*Palette\s*',
'palette {0}/etc/Palette\n'.format(prefix)
)
# Read GNUmakefile into array
with open('GNUmakefile', 'r') as file:
contents = file.readlines()
@ -194,8 +204,15 @@ def setup_build_environment(self, env):
env.set('CXX', self.spec['mpi'].mpicxx)
env.set('F77', self.spec['mpi'].mpif77)
env.set('FC', self.spec['mpi'].mpifc)
# Set CONFIG_FILEPATH so Amrvis can find the configuration
# file, amrvis.defaults.
env.set('CONFIG_FILEPATH', self.spec.prefix.etc)
def install(self, spec, prefix):
# Install exe manually
mkdirp(prefix.bin)
install('*.ex', prefix.bin)
# Install configuration file and default color Palette
mkdirp(prefix.etc)
install('amrvis.defaults', prefix.etc)
install('Palette', prefix.etc)