Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions easybuild/easyblocks/w/wrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
from easybuild.framework.easyconfig import CUSTOM, MANDATORY
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.config import build_option
from easybuild.tools.filetools import apply_regex_substitutions, change_dir, patch_perl_script_autoflush, read_file
from easybuild.tools.filetools import apply_regex_substitutions, change_dir
from easybuild.tools.filetools import patch_perl_script_autoflush, read_file, which
from easybuild.tools.filetools import remove_file, symlink
from easybuild.tools.modules import get_software_root
from easybuild.tools.run import run_cmd, run_cmd_qa
Expand Down Expand Up @@ -252,11 +253,26 @@ def build_step(self):
if par:
self.par = "-j %s" % par

# fix compile script shebang
# fix compile script shebang to use provided tcsh
cmpscript = os.path.join(self.start_dir, 'compile')
cmpsh_root = get_software_root('tcsh')
if cmpsh_root:
regex_subs = [('/bin/csh', os.path.join(cmpsh_root, 'bin/tcsh'))]
tcsh_root = get_software_root('tcsh')
if tcsh_root:
tcsh_path = os.path.join(tcsh_root, 'bin', 'tcsh')
# avoid using full path to tcsh if possible, since it may be too long to be used as shebang line
which_tcsh = which('tcsh')
if which_tcsh and os.path.samefile(which_tcsh, tcsh_path):
env_path = os.path.join('/usr', 'bin', 'env')
# use env command from alternate sysroot, if available
sysroot = build_option('sysroot')
if sysroot:
sysroot_env_path = os.path.join(sysroot, 'usr', 'bin', 'env')
if os.path.exists(sysroot_env_path):
env_path = sysroot_env_path
new_shebang = env_path + ' tcsh'
else:
new_shebang = tcsh_path

regex_subs = [('^#!/bin/csh.*', '#!' + new_shebang)]
apply_regex_substitutions(cmpscript, regex_subs)

# build wrf
Expand Down