schrodinger.utils.env module¶
-
schrodinger.utils.env.
append_path
(env_dict: Dict[str, str], env_var: str, path: str)[source]¶ Appends a path to env_var (defined as constants in schrodinger.utils.env) in the env_dict. This uses the traditional path seperator. We normalize the path argument.
- Parameters
env_dict – Dictionary of environment variables.
env_var – existing environment variable (example: schrodinger.utils.env.PATH)
path – path to extend with
-
schrodinger.utils.env.
prepend_path
(env_dict: Dict[str, str], env_var: str, path: str)[source]¶ Appends a path to env_var (defined as constants in schrodinger.utils.env) We normalize the path argument.
- Parameters
env_dict – Dictionary of environment variables.
env_var – existing environment variable (example: schrodinger.utils.env.PATH)
path – path to extend with
-
schrodinger.utils.env.
swap_ld_library_path
()[source]¶ Restore LD_LIBRARY_PATH to the value that it was when we first ran a toplevel script. ORIGINAL_LD_LIBRARY_PATH is set by toplevel.sh
-
class
schrodinger.utils.env.
EnvironmentContext
(key: str, value: str)[source]¶ Bases:
object
Context manager to temporarily set an environment variable and then return it to its original value upon exit.
-
schrodinger.utils.env.
get_ld_library_path_for_system_ssh
() → Optional[str][source]¶ In order to run ssh as a subprocess, sometimes we need to use system openssl libraries. This will return a modified LD_LIBRARY_PATH that does not have Schrodinger OpenSSL libraries in it.
- Returns
LD_LIBRARY_PATH str or None if LD_LIBRARY_PATH was not originally set
-
schrodinger.utils.env.
remove_ssl_ld_library_path
()[source]¶ Temporarily remove SSL library path from the LD_LIBRARY_PATH. This will force ssh, as called by MPI, to be linked against the system libcrypto rather than the one in the Schrodinger software (JOBCON-5027). But sometimes the user has ssh but not libcrypto and then their ssh has to use our libcrypto (DESMOND-7780). So test whether ssh fails or not by actually running it. What a world!
-
schrodinger.utils.env.
prepend_sys_path
(path: Union[str, pathlib.Path])[source]¶ Prepend a specific path to sys.path. Prefer placing the module for import in an existing sys.path.
- Parameters
path – directory name of path