def prepare_step(self, *args, **kwargs): """Do the bundle prepare step to ensure any deps are loaded at a minimum.""" if self.cfg['generate_standalone_module']: if self.cfg['name'] in ['GCC', 'GCCcore']: EB_GCC.prepare_step(self, *args, **kwargs) elif self.cfg['name'] in ['icc']: EB_icc.prepare_step(self, *args, **kwargs) elif self.cfg['name'] in ['ifort']: EB_ifort.prepare_step(self, *args, **kwargs) else: raise EasyBuildError( "I don't know how to do the prepare_step for %s", self.cfg['name']) else: Bundle.prepare_step(self, *args, **kwargs)
def prepare_step(self, *args, **kwargs): """Do compiler appropriate prepare step, determine system compiler version and prefix.""" if self.cfg['generate_standalone_module']: if self.cfg['name'] in ['GCC', 'GCCcore']: EB_GCC.prepare_step(self, *args, **kwargs) elif self.cfg['name'] in ['icc']: EB_icc.prepare_step(self, *args, **kwargs) elif self.cfg['name'] in ['ifort']: EB_ifort.prepare_step(self, *args, **kwargs) else: raise EasyBuildError( "I don't know how to do the prepare_step for %s", self.cfg['name']) else: Bundle.prepare_step(self, *args, **kwargs) # Determine compiler path (real path, with resolved symlinks) compiler_name = self.cfg['name'].lower() if compiler_name == 'gcccore': compiler_name = 'gcc' path_to_compiler = which(compiler_name) if path_to_compiler: path_to_compiler = resolve_path(path_to_compiler) self.log.info( "Found path to compiler '%s' (with symlinks resolved): %s", compiler_name, path_to_compiler) else: raise EasyBuildError("%s not found in $PATH", compiler_name) # Determine compiler version self.compiler_version = extract_compiler_version(compiler_name) # Determine installation prefix if compiler_name == 'gcc': # strip off 'bin/gcc' self.compiler_prefix = os.path.dirname( os.path.dirname(path_to_compiler)) elif compiler_name in ['icc', 'ifort']: intelvars_fn = path_to_compiler + 'vars.sh' if os.path.isfile(intelvars_fn): self.log.debug( "Trying to determine compiler install prefix from %s", intelvars_fn) intelvars_txt = read_file(intelvars_fn) prod_dir_regex = re.compile(r'^PROD_DIR=(.*)$', re.M) res = prod_dir_regex.search(intelvars_txt) if res: self.compiler_prefix = res.group(1) else: raise EasyBuildError( "Failed to determine %s installation prefix from %s", compiler_name, intelvars_fn) else: # strip off 'bin/intel*/icc' self.compiler_prefix = os.path.dirname( os.path.dirname(os.path.dirname(path_to_compiler))) # For versions 2016+ of Intel compilers they changed the installation path so must shave off 2 more # directories from result of the above if LooseVersion(self.compiler_version) >= LooseVersion('2016'): self.compiler_prefix = os.path.dirname( os.path.dirname(self.compiler_prefix)) else: raise EasyBuildError("Unknown system compiler %s" % self.cfg['name']) if not os.path.exists(self.compiler_prefix): raise EasyBuildError( "Path derived for system compiler (%s) does not exist: %s!", compiler_name, self.compiler_prefix) self.log.debug( "Derived version/install prefix for system compiler %s: %s, %s", compiler_name, self.compiler_version, self.compiler_prefix) # If EasyConfig specified "real" version (not 'system' which means 'derive automatically'), check it if self.cfg['version'] == 'system': self.log.info( "Found specified version '%s', going with derived compiler version '%s'", self.cfg['version'], self.compiler_version) elif self.cfg['version'] != self.compiler_version: raise EasyBuildError( "Specified version (%s) does not match version reported by compiler (%s)" % (self.cfg['version'], self.compiler_version))
def prepare_step(self, *args, **kwargs): """Do compiler appropriate prepare step, determine system compiler version and prefix.""" if self.cfg['generate_standalone_module']: if self.cfg['name'] in ['GCC', 'GCCcore']: EB_GCC.prepare_step(self, *args, **kwargs) elif self.cfg['name'] in ['icc']: EB_icc.prepare_step(self, *args, **kwargs) elif self.cfg['name'] in ['ifort']: EB_ifort.prepare_step(self, *args, **kwargs) else: raise EasyBuildError("I don't know how to do the prepare_step for %s", self.cfg['name']) else: Bundle.prepare_step(self, *args, **kwargs) # Determine compiler path (real path, with resolved symlinks) compiler_name = self.cfg['name'].lower() if compiler_name == 'gcccore': compiler_name = 'gcc' path_to_compiler = which(compiler_name) if path_to_compiler: path_to_compiler = resolve_path(path_to_compiler) self.log.info("Found path to compiler '%s' (with symlinks resolved): %s", compiler_name, path_to_compiler) else: raise EasyBuildError("%s not found in $PATH", compiler_name) # Determine compiler version self.compiler_version = extract_compiler_version(compiler_name) # Determine installation prefix if compiler_name == 'gcc': # strip off 'bin/gcc' self.compiler_prefix = os.path.dirname(os.path.dirname(path_to_compiler)) elif compiler_name in ['icc', 'ifort']: intelvars_fn = path_to_compiler + 'vars.sh' if os.path.isfile(intelvars_fn): self.log.debug("Trying to determine compiler install prefix from %s", intelvars_fn) intelvars_txt = read_file(intelvars_fn) prod_dir_regex = re.compile(r'^PROD_DIR=(.*)$', re.M) res = prod_dir_regex.search(intelvars_txt) if res: self.compiler_prefix = res.group(1) else: raise EasyBuildError("Failed to determine %s installation prefix from %s", compiler_name, intelvars_fn) else: # strip off 'bin/intel*/icc' self.compiler_prefix = os.path.dirname(os.path.dirname(os.path.dirname(path_to_compiler))) # For versions 2016+ of Intel compilers they changed the installation path so must shave off 2 more # directories from result of the above if LooseVersion(self.compiler_version) >= LooseVersion('2016'): self.compiler_prefix = os.path.dirname(os.path.dirname(self.compiler_prefix)) else: raise EasyBuildError("Unknown system compiler %s" % self.cfg['name']) if not os.path.exists(self.compiler_prefix): raise EasyBuildError("Path derived for system compiler (%s) does not exist: %s!", compiler_name, self.compiler_prefix) self.log.debug("Derived version/install prefix for system compiler %s: %s, %s", compiler_name, self.compiler_version, self.compiler_prefix) # If EasyConfig specified "real" version (not 'system' which means 'derive automatically'), check it if self.cfg['version'] == 'system': self.log.info("Found specified version '%s', going with derived compiler version '%s'", self.cfg['version'], self.compiler_version) elif self.cfg['version'] != self.compiler_version: raise EasyBuildError("Specified version (%s) does not match version reported by compiler (%s)" % (self.cfg['version'], self.compiler_version))