|
|
|
@ -31,7 +31,7 @@ import operator
|
|
|
|
|
import traceback
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
|
from types import StringTypes
|
|
|
|
|
from calculate.lib.configparser import ConfigParser
|
|
|
|
|
from calculate.lib.configparser import ConfigParser, ParsingError
|
|
|
|
|
|
|
|
|
|
def addStdConfig(fileLst,prefix='/'):
|
|
|
|
|
stdPath = path.join(prefix,
|
|
|
|
@ -857,11 +857,18 @@ class SimpleDataVars(object):
|
|
|
|
|
config = ConfigParser(strict=False)
|
|
|
|
|
if path.isdir(iniFile):
|
|
|
|
|
rs = RepositorySubstituting(self, system_root=system_root)
|
|
|
|
|
config.read(addStdConfig(
|
|
|
|
|
searchProfile(iniFile, 'calculate.env', repository_sub=rs),
|
|
|
|
|
try:
|
|
|
|
|
config.read(addStdConfig(
|
|
|
|
|
searchProfile(iniFile, 'calculate.env',
|
|
|
|
|
repository_sub=rs),
|
|
|
|
|
prefix=self.systemRoot), encoding="utf-8")
|
|
|
|
|
except ParsingError:
|
|
|
|
|
raise DataVarsError(_("Error in calculate.env in profile"))
|
|
|
|
|
else:
|
|
|
|
|
config.read(iniFile, encoding="utf-8")
|
|
|
|
|
try:
|
|
|
|
|
config.read(iniFile, encoding="utf-8")
|
|
|
|
|
except ParsingError:
|
|
|
|
|
raise DataVarsError(_("Error in %s") % iniFile)
|
|
|
|
|
importVars = {}
|
|
|
|
|
for varname, varobj in self.allVars.items():
|
|
|
|
|
if varobj.section not in importVars:
|
|
|
|
@ -1189,10 +1196,12 @@ class DataVars(SimpleDataVars):
|
|
|
|
|
for iniFile in calculateIniFiles:
|
|
|
|
|
if path.exists(iniFile):
|
|
|
|
|
config = ConfigParser(strict=False)
|
|
|
|
|
config.read(iniFile, encoding="utf-8")
|
|
|
|
|
try:
|
|
|
|
|
config.read(iniFile, encoding="utf-8")
|
|
|
|
|
value = config[section][varname]
|
|
|
|
|
retVal = value
|
|
|
|
|
except ParsingError:
|
|
|
|
|
raise DataVarsError(_("Error in %s") % iniFile)
|
|
|
|
|
except KeyError:
|
|
|
|
|
pass
|
|
|
|
|
return retVal.encode('UTF-8')
|
|
|
|
@ -1244,12 +1253,20 @@ class DataVars(SimpleDataVars):
|
|
|
|
|
config = ConfigParser(strict=False)
|
|
|
|
|
if iniName == 'profile':
|
|
|
|
|
repos = RepositorySubstituting(self)
|
|
|
|
|
config.read(addStdConfig(
|
|
|
|
|
try:
|
|
|
|
|
config.read(addStdConfig(
|
|
|
|
|
searchProfile(iniFile,'calculate.env',
|
|
|
|
|
repository_sub=repos)),
|
|
|
|
|
encoding="utf-8")
|
|
|
|
|
except ParsingError:
|
|
|
|
|
raise DataVarsError(
|
|
|
|
|
_("Error in profile calculate.env"))
|
|
|
|
|
else:
|
|
|
|
|
config.read(iniFile, encoding="utf-8")
|
|
|
|
|
try:
|
|
|
|
|
config.read(iniFile, encoding="utf-8")
|
|
|
|
|
except ParsingError:
|
|
|
|
|
raise DataVarsError(
|
|
|
|
|
_("Error in %s")%iniFile)
|
|
|
|
|
iniSections = config.sections()
|
|
|
|
|
if not iniSections:
|
|
|
|
|
continue
|
|
|
|
|