def convertValues(self): # Before any interpolation and conversion, convert essential # local and global dir to absolut paths! # important, because its more safe! self.interpolation.setSkipping(False) # turn interpolation on self.config["Job"]["localDir"] = cF.expandEnvVar( self.config["Job"]["localDir"], self.envRegexPattern, errorIfNotFullyExpanded=False ) # allow Job:localDir to contain '$VAR' variables, are expanded by shell if "$" in self.config["Job"]["localDir"]: CE.printWarning( "Your Job:localDir: %s contains '$' character, which are only expanded in Bash!" % self.config["Job"]["localDir"] ) self.config["Job"]["globalDir"] = os.path.abspath( cF.expandEnvVar(self.config["Job"]["globalDir"], self.envRegexPattern, errorIfNotFullyExpanded=True) ) # Job:globalDir is made absolute to execution dir when configuring # convert and interpolate all values in base class super(GeneratorMPI, self).convertValues() # do some other conversion for this generator values self.__convertValues()
def expandEnvVars(self,dic): """Expands all environment variables in the dictionary dic""" for key,value in dic.items(): dic[key] = cF.expandEnvVar(value,self.envRegexPattern); return dic