Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_clr_environment_vars():
"""
Set system environment variables required by the .NET CLR.
Python 3.x only, as dotnetcore2 is not available for Python 2.x.
"""
if six.PY2:
pass
else:
from dotnetcore2 import runtime as clr_runtime
dependencies_path = None
try:
# try to resolve dependencies, specifically libunwind for Linux
dependencies_path = clr_runtime.ensure_dependencies()
except:
pass
# Without this, Linux versions would require the ICU package
os.environ['DOTNET_SYSTEM_GLOBALIZATION_INVARIANT'] = 'true'
# Will be None for Windows
if dependencies_path is not None:
os.environ['LD_LIBRARY_PATH'] = dependencies_path