def _load_config_py(filepath): from rez.vendor.six.six import exec_ reserved = dict( # Standard Python module variables # Made available from within the module, # and later excluded from the `Config` class __name__=os.path.splitext(os.path.basename(filepath))[0], __file__=filepath, rez_version=__version__, ModifyList=ModifyList) globs = reserved.copy() result = {} with open(filepath) as f: try: code = compile(f.read(), filepath, 'exec') exec_(code, globs) except Exception as e: raise ConfigurationError( "Error loading configuration from %s: %s" % (filepath, str(e))) for k, v in globs.items(): if k != '__builtins__' \ and not ismodule(v) \ and k not in reserved: result[k] = v return result
def _load_config_py(filepath): from rez.vendor.six.six import exec_ globs = dict(rez_version=__version__) result = {} with open(filepath) as f: try: code = compile(f.read(), filepath, "exec") exec_(code, _globs_=globs) except Exception, e: raise ConfigurationError("Error loading configuration from %s: %s" % (filepath, str(e)))
def _load_config_py(filepath): from rez.vendor.six.six import exec_ globs = dict(rez_version=__version__) result = {} with open(filepath) as f: try: code = compile(f.read(), filepath, 'exec') exec_(code, _globs_=globs) except Exception, e: raise ConfigurationError( "Error loading configuration from %s: %s" % (filepath, str(e)))