def set_env_class(cls, **kwargs): r"""Set environment variables that are instance independent. Args: **kwargs: Additional keyword arguments are passed to the parent class's method and update_ld_library_path. Returns: dict: Environment variables for the model process. """ out = super(FortranModelDriver, cls).set_env_class(**kwargs) out = CModelDriver.CModelDriver.set_env_class(existing=out, add_libpython_dir=True, toolname=kwargs.get( 'toolname', None)) out = CModelDriver.CCompilerBase.set_env(out) conda_prefix = tools.get_conda_prefix() if conda_prefix and platform._is_mac: out.setdefault('DYLD_FALLBACK_LIBRARY_PATH', os.path.join(conda_prefix, 'lib')) return out
def get_testing_options(cls, **kwargs): r"""Method to return a dictionary of testing options for this class. Args: **kwargs: Additional keyword arguments are passed to the parent class. Returns: dict: Dictionary of variables to use for testing. Key/value pairs: kwargs (dict): Keyword arguments for driver instance. deps (list): Dependencies to install. """ from yggdrasil import tools out = super(CPPModelDriver, cls).get_testing_options(**kwargs) out['deps'] = [ "cmake", { "package_manager": "pip", "package": "pyyaml", "arguments": "-v" }, { "package": "cmake", "arguments": "-v" } ] if platform._is_win: # pragma: windows if not tools.get_conda_prefix(): out['deps'].append({ "package_manager": "vcpkg", "package": "czmq" }) else: out['deps'].append('doxygen') out['write_try_except_kwargs'] = {'error_type': '...'} out['kwargs'].setdefault('compiler_flags', []) out['kwargs']['compiler_flags'].append('-std=c++11') return out
def test_get_conda_prefix(): r"""Test get_conda_prefix.""" tools.get_conda_prefix()