Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
8 changes: 5 additions & 3 deletions easybuild/easyblocks/g/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
from easybuild.tools.filetools import run_cmd
from easybuild.tools.systemtools import get_kernel_name, get_shared_lib_ext, get_platform_name

import easybuild.tools.environment as env

class GCC(Application):
"""
Self-contained build of GCC.
Expand Down Expand Up @@ -265,13 +267,13 @@ def make(self):

# register built GCC as compiler to use for stage 2/3
path = "%s/bin:%s" % (self.stage1installdir, os.getenv('PATH'))
os.putenv('PATH', path)
env.putenv('PATH', path)

ld_lib_path = "%(dir)s/lib64:%(dir)s/lib:%(val)s" % {
'dir':self.stage1installdir,
'val':os.getenv('LD_LIBRARY_PATH')
}
os.putenv('LD_LIBRARY_PATH', ld_lib_path)
env.putenv('LD_LIBRARY_PATH', ld_lib_path)

#
# STAGE 2: build GMP/PPL/CLooG for stage 3
Expand Down Expand Up @@ -371,7 +373,7 @@ def make(self):
incpath = os.path.join(stage2prefix, 'include')

cppflags = os.getenv('CPPFLAGS', '')
os.putenv('CPPFLAGS', "%s -L%s -I%s " % (cppflags, libpath, incpath))
env.putenv('CPPFLAGS', "%s -L%s -I%s " % (cppflags, libpath, incpath))

#
# STAGE 3: bootstrap build of final GCC (with PPL/CLooG support)
Expand Down
16 changes: 9 additions & 7 deletions easybuild/easyblocks/i/imkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from easybuild.tools.filetools import run_cmd
from easybuild.tools.modules import Modules

import easybuild.tools.environment as env

class Imkl(IntelBase):
"""
Class that can be used to install mkl
Expand Down Expand Up @@ -174,10 +176,10 @@ def postproc(self):
self.log.exception("Creating temporary directory failed")

## always set INSTALL_DIR, SPEC_OPT, COPTS and CFLAGS
os.putenv('INSTALL_DIR', tmpbuild)
os.putenv('SPEC_OPT', opt)
os.putenv('COPTS', opt)
os.putenv('CFLAGS', opt)
env.putenv('INSTALL_DIR', tmpbuild)
env.putenv('SPEC_OPT', opt)
env.putenv('COPTS', opt)
env.putenv('CFLAGS', opt)

try:
intdir = os.path.join(interfacedir, i)
Expand Down Expand Up @@ -293,9 +295,9 @@ def postproc(self):
self.log.exception("Creating temporary directory failed")

## always set INSTALL_DIR, SPEC_OPT and CFLAGS
os.putenv('INSTALL_DIR', tmpbuild)
os.putenv('SPEC_OPT', opt)
os.putenv('CFLAGS', opt)
env.putenv('INSTALL_DIR', tmpbuild)
env.putenv('SPEC_OPT', opt)
env.putenv('CFLAGS', opt)

try:
intdir = os.path.join(interfacedir, i)
Expand Down
17 changes: 9 additions & 8 deletions easybuild/easyblocks/i/intelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import shutil
from easybuild.framework.application import Application
from easybuild.tools.filetools import run_cmd
import easybuild.tools.environment as env

class IntelBase(Application):
"""
Expand All @@ -38,10 +39,10 @@ def __init__(self, *args, **kwargs):
self.cfg.update({
'license':[None,"License file path (default: None)"],
'license_activation':['license_server', "Indicates license activation type (default: 'license_server')"],
# 'usetmppath':
# 'usetmppath':
# workaround for older SL5 version (5.5 and earlier)
# used to be True, but False since SL5.6/SL6
# disables TMP_PATH env and command line option
# disables TMP_PATH env and command line option
'usetmppath':[False, "Use temporary path for installation (default: False)"],
'm32':[False, "Enable 32-bit toolkit (default: False)"],
})
Expand Down Expand Up @@ -71,7 +72,7 @@ def configure(self):
self.log.error("Can't find license at %s" % self.license)

## set INTEL_LICENSE_FILE
os.environ["INTEL_LICENSE_FILE"] = self.license
env.putenv("INTEL_LICENSE_FILE", self.license)

# clean home directory
self.clean_homedir()
Expand Down Expand Up @@ -113,14 +114,14 @@ def make_install(self):
self.log.exception("Directory %s can't be created" % (tmpdir))
tmppathopt = ''
if self.getcfg('usetmppath'):
os.putenv('TMP_PATH', tmpdir)
env.putenv('TMP_PATH', tmpdir)
tmppathopt = "-t %s" % tmpdir

## set some extra env variables
os.environ['LOCAL_INSTALL_VERBOSE'] = '1'
os.environ['VERBOSE_MODE'] = '1'
env.putenv('LOCAL_INSTALL_VERBOSE','1')
env.putenv['VERBOSE_MODE', '1')

os.environ['INSTALL_PATH'] = self.installdir
env.putenv('INSTALL_PATH', self.installdir)

## perform installation
cmd = "./install.sh %s -s %s" % (tmppathopt, silentcfg)
Expand All @@ -136,4 +137,4 @@ def cleanup(self):

Application.cleanup(self)

# no default sanity check, needs to be implemented by derived class
# no default sanity check, needs to be implemented by derived class
11 changes: 6 additions & 5 deletions easybuild/easyblocks/m/mvapich2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
##
import os
from easybuild.framework.application import Application
import easybuild.tools.environment as env

class MVAPICH2(Application):
"""
Expand Down Expand Up @@ -65,14 +66,14 @@ def configure(self):
# enable Fortran 77/90 and C++ bindings
add_configopts += '--enable-f77 --enable-fc --enable-cxx '

# MVAPICH configure script complains when F90 or F90FLAGS are set,
# MVAPICH configure script complains when F90 or F90FLAGS are set,
# they should be replaced with FC/FCFLAGS instead
for (envvar, new_envvar) in [("F90", "FC"), ("F90FLAGS", "FCFLAGS")]:
envvar_val = os.getenv(envvar)
if envvar_val:
if not os.getenv(new_envvar):
os.putenv(new_envvar, envvar_val)
os.putenv(envvar, '')
env.putenv(new_envvar, envvar_val)
env.putenv(envvar, '')
else:
self.log.error("Both %(ev)s and %(nev)s set, can I overwrite %(nev)s with %(ev)s (%(evv)s) ?" % {
'ev':envvar,
Expand Down Expand Up @@ -100,7 +101,7 @@ def sanitycheck(self):
"""
if not self.getcfg('sanityCheckPaths'):

self.setcfg('sanityCheckPaths',{'files':["bin/%s" % x for x in ["mpicc", "mpicxx", "mpif77",
self.setcfg('sanityCheckPaths',{'files':["bin/%s" % x for x in ["mpicc", "mpicxx", "mpif77",
"mpif90", "mpiexec.hydra"]] +
["lib/lib%s" % y for x in ["fmpich", "mpichcxx", "mpichf90",
"mpich", "mpl", "opa"]
Expand All @@ -110,4 +111,4 @@ def sanitycheck(self):

self.log.info("Customized sanity check paths: %s"%self.getcfg('sanityCheckPaths'))

Application.sanitycheck(self)
Application.sanitycheck(self)
9 changes: 5 additions & 4 deletions easybuild/easyblocks/n/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import os
from distutils.version import LooseVersion
from easybuild.framework.application import Application
import easybuild.tools.environment as env

class NetCDF(Application):
"""Support for building/installing netCDF"""
Expand All @@ -40,7 +41,7 @@ def configure(self):

# add -DgFortran to CPPFLAGS when building with GCC
if self.tk.toolkit_comp_family() == "GCC":
os.environ['CPPFLAGS'] = "%s -DgFortran" % os.getenv('CPPFLAGS')
env.putenv('CPPFLAGS', "%s -DgFortran" % os.getenv('CPPFLAGS'))

Application.configure(self)

Expand Down Expand Up @@ -78,15 +79,15 @@ def set_netcdf_env_vars(log):
if not netcdf:
log.error("netCDF module not loaded?")
else:
os.environ['NETCDF'] = netcdf
env.putenv('NETCDF', netcdf)
log.debug("Set NETCDF to %s" % netcdf)
netcdff = os.getenv('SOFTROOTNETCDFMINFORTRAN')
netcdf_ver = os.getenv('SOFTVERSIONNETCDF')
if not netcdff:
if LooseVersion(netcdf_ver) >= LooseVersion("4.2"):
log.error("netCDF v4.2 no longer supplies Fortran library, also need netCDF-Fortran")
else:
os.environ['NETCDFF'] = netcdff
env.putenv('NETCDFF', netcdff)
log.debug("Set NETCDFF to %s" % netcdff)

def get_netcdf_module_set_cmds(log):
Expand All @@ -101,4 +102,4 @@ def get_netcdf_module_set_cmds(log):
txt += "setenv NETCDFF %s\n" % netcdff
return txt
else:
log.error("NETCDF environment variable not set?")
log.error("NETCDF environment variable not set?")
5 changes: 3 additions & 2 deletions easybuild/easyblocks/n/netcdf_fortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
##
import os
from easybuild.framework.application import Application
import easybuild.tools.environment as env

class NetCDF_Fortran(Application):
"""Support for building/installing the netCDF-Fortran library"""
Expand All @@ -34,7 +35,7 @@ def configure(self):

# add -DgFortran to CPPFLAGS when building with GCC
if self.tk.toolkit_comp_family() == "GCC":
os.environ['CPPFLAGS'] = "%s -DgFortran" % os.getenv('CPPFLAGS')
env.putenv('CPPFLAGS', "%s -DgFortran" % os.getenv('CPPFLAGS'))

Application.configure(self)

Expand All @@ -55,4 +56,4 @@ def sanitycheck(self):

self.log.info("Customized sanity check paths: %s"%self.getcfg('sanityCheckPaths'))

Application.sanitycheck(self)
Application.sanitycheck(self)
10 changes: 6 additions & 4 deletions easybuild/easyblocks/w/wps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from easybuild.tools.filetools import patch_perl_script_autoflush, run_cmd, run_cmd_qa, unpack
from easybuild.easyblocks.n.netcdf import set_netcdf_env_vars, get_netcdf_module_set_cmds

import easybuild.tools.environment as env

class WPS(Application):
"""Support for building/installing WPS."""

Expand All @@ -53,7 +55,7 @@ def __init__(self):
})

def configure(self):
"""Configure build:
"""Configure build:
- set required environment variables (for netCDF, JasPer)
- patch compile script and ungrib Makefile for non-default install paths of WRF and JasPer
- run configure script and figure how to select desired build option
Expand Down Expand Up @@ -91,8 +93,8 @@ def configure(self):
jasper = os.getenv('SOFTROOTJASPER')
jasperlibdir = os.path.join(jasper, "lib")
if jasper:
os.environ['JASPERINC'] = os.path.join(jasper, "include")
os.environ['JASPERLIB'] = jasperlibdir
env.putenv('JASPERINC', os.path.join(jasper, "include"))
env.putenv('JASPERLIB', jasperlibdir)
else:
self.log.error("JasPer module not loaded?")

Expand Down Expand Up @@ -337,4 +339,4 @@ def make_module_extra(self):

txt += get_netcdf_module_set_cmds(self.log)

return txt
return txt
18 changes: 10 additions & 8 deletions easybuild/easyblocks/w/wrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
from easybuild.tools.filetools import patch_perl_script_autoflush, run_cmd, run_cmd_qa
from easybuild.easyblocks.n.netcdf import set_netcdf_env_vars, get_netcdf_module_set_cmds

import easybuild.tools.environment as env

class WRF(Application):
"""Support for building/installing WRF."""

def __init__(self,*args,**kwargs):
"""Add extra config options specific to WRF."""

Application.__init__(self, args,kwargs)

self.build_in_installdir = True

self.wrfsubdir = None
Expand All @@ -47,8 +49,8 @@ def __init__(self,*args,**kwargs):
'runtest':[True, "Build and run WRF tests (default: True)."]
})

def configure(self):
"""Configure build:
def configure(self):
"""Configure build:
- set some magic environment variables
- run configure script
- adjust configure.wrf file if needed
Expand All @@ -70,16 +72,16 @@ def configure(self):
if not (hdf5 or parallel_hdf5):
self.log.error("Parallel HDF5 module not loaded?")
else:
os.putenv('PHDF5', hdf5)
env.putenv('PHDF5', hdf5)
else:
self.log.info("HDF5 module not loaded, assuming that's OK...")

# JasPer dependency check + setting env vars
jasper = os.getenv('SOFTROOTJASPER')
jasperlibdir = os.path.join(jasper, "lib")
if jasper:
os.environ['JASPERINC'] = os.path.join(jasper, "include")
os.environ['JASPERLIB'] = jasperlibdir
env.putenv('JASPERINC', os.path.join(jasper, "include"))
env.putenv('JASPERLIB', jasperlibdir)

else:
if os.getenv('JASPERINC') or os.getenv('JASPERLIB'):
Expand All @@ -88,7 +90,7 @@ def configure(self):
self.log.info("JasPer module not loaded, assuming that's OK...")

# enable support for large file support in netCDF
os.putenv('WRFIO_NCD_LARGE_FILE_SUPPORT', '1')
env.putenv('WRFIO_NCD_LARGE_FILE_SUPPORT', '1')

# patch arch/Config_new.pl script, so that run_cmd_qa receives all output to answer questions
patch_perl_script_autoflush(os.path.join("arch", "Config_new.pl"))
Expand Down Expand Up @@ -161,7 +163,7 @@ def configure(self):
for envvar in ['CFLAGS', 'FFLAGS']:
val = os.getenv(envvar)
if '-O3' in val:
os.environ[envvar] = '%s -heap-arrays' % val
env.putenv(envvar, '%s -heap-arrays' % val)
self.log.info("Updated %s to '%s'" % (envvar, os.getenv(envvar)))

# replace -O3 with desired optimization options
Expand Down
Loading