visit-silo: better sets VISIT_PLUGIN_DIR to fit VisIt dir struct (#23833)
This commit is contained in:
parent
ed695f3267
commit
202510869d
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
import os
|
import os
|
||||||
|
# Import re module to use regular expression
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
class VisitSilo(CMakePackage):
|
class VisitSilo(CMakePackage):
|
||||||
@ -48,11 +50,12 @@ class VisitSilo(CMakePackage):
|
|||||||
|
|
||||||
build_targets = ['VERBOSE=1']
|
build_targets = ['VERBOSE=1']
|
||||||
phases = ['cmake', 'build']
|
phases = ['cmake', 'build']
|
||||||
|
extname = 'Silo'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def root_cmakelists_dir(self):
|
def root_cmakelists_dir(self):
|
||||||
if '@local' not in self.spec:
|
if '@local' not in self.spec:
|
||||||
return join_path('src', 'databases', 'Silo')
|
return join_path('src', 'databases', self.extname)
|
||||||
else:
|
else:
|
||||||
return '.'
|
return '.'
|
||||||
|
|
||||||
@ -62,19 +65,30 @@ def build_directory(self):
|
|||||||
|
|
||||||
@run_before('cmake')
|
@run_before('cmake')
|
||||||
def run_xml2cmake(self):
|
def run_xml2cmake(self):
|
||||||
spec = self.spec
|
visit = self.spec['visit']
|
||||||
visit = spec['visit']
|
args = ['-v', str(visit.version), '-clobber', '-public', self.extname + '.xml']
|
||||||
args = ['-v', str(visit.version), '-clobber', '-public', 'Silo.xml']
|
|
||||||
with working_dir(self.root_cmakelists_dir):
|
with working_dir(self.root_cmakelists_dir):
|
||||||
# Regenerate the public cmake files
|
# Regenerate the public cmake files
|
||||||
if os.path.exists("CMakeLists.txt"):
|
if os.path.exists("CMakeLists.txt"):
|
||||||
os.unlink('CMakeLists.txt')
|
os.unlink('CMakeLists.txt')
|
||||||
which("xml2cmake")(*args)
|
which("xml2cmake")(*args)
|
||||||
# spack extension activate : alter VISIT_PLUGIN_DIR
|
# spack extension activate : alter VISIT_PLUGIN_DIR ;
|
||||||
cmf = FileFilter('CMakeLists.txt')
|
# xml2cmake should have set it to visit prefix but it can
|
||||||
cmf.filter(r'^SET\(VISIT_PLUGIN_DIR\s+\"{0}(.+)\"\)'.
|
# happen the directory is an alias.
|
||||||
format(visit.prefix),
|
# In that case we match version/smth/plugins.
|
||||||
r'SET(VISIT_PLUGIN_DIR "{0}\1")'.format(prefix))
|
mstr = None
|
||||||
|
mstr1 = r'^SET[(]VISIT_PLUGIN_DIR\s+\"{0}(.+)\"[)]'.format(visit.prefix)
|
||||||
|
mstr2 = r'^SET[(]VISIT_PLUGIN_DIR\s+\".+({0}.+?{1})\"[)]'.format(
|
||||||
|
join_path(os.sep, visit.version, ''), join_path(os.sep, 'plugins'))
|
||||||
|
with open('CMakeLists.txt', 'r') as file:
|
||||||
|
for line in file:
|
||||||
|
if re.search(mstr1, line):
|
||||||
|
mstr = mstr1
|
||||||
|
elif re.search(mstr2, line):
|
||||||
|
mstr = mstr2
|
||||||
|
if mstr is not None:
|
||||||
|
filter_file(mstr, r'SET(VISIT_PLUGIN_DIR "{0}\1")'.format(prefix),
|
||||||
|
'CMakeLists.txt')
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
silo = self.spec['silo']
|
silo = self.spec['silo']
|
||||||
|
Loading…
Reference in New Issue
Block a user