Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Correct doc-string and remove ERT_LIBRARY_PATH from res/__init__.py
Browse files Browse the repository at this point in the history
Because cwrap first reads LD_LIBRARY_PATH,
equinor/cwrap@f000d05
the build path and the ERT_LIBRARY_PATH would only be used if no library
was found on LD_LIBRARY_PATH, which could cause confusion to which library
was actually being used. The docstring was thus incorrect.
  • Loading branch information
oyvindeide committed Oct 21, 2019
1 parent 88ad44a commit 291dd5b
Showing 1 changed file with 5 additions and 35 deletions.
40 changes: 5 additions & 35 deletions python/res/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,6 @@
i.e. standard locations configured with ld.so.conf and the environment
variable LD_LIBRARY_PATH.
To avoid conflict with other application using the res libraries the
Python code should be able to locate the shared libraries without
(necessarily) using the LD_LIBRARY_PATH variable. The default
behaviour is to try to load from the library ../../lib64, but by using
the enviornment variable ERT_LIBRARY_PATH you can alter how ert looks
for shared libraries.
1. By default the code will try to load the shared libraries from
'../../lib64' relative to the location of this file.
2. Depending on the value of ERT_LIBRARY_PATH two different
behaviours can be imposed:
Existing path: the package will look in the path pointed to
by ERT_LIBRARY_PATH for shared libraries.
Arbitrary value: the package will use standard load order for
the operating system.
If the fixed path, given by the default ../../lib64 or ERT_LIBRARY_PATH
alternative fails, the loader will try the default load behaviour
before giving up completely.
"""
import os.path
import sys
Expand All @@ -64,7 +42,6 @@
except ImportError:
pass


required_version_hex = 0x02070000

res_lib_path = None
Expand All @@ -87,18 +64,6 @@
pass


# 2. Using the environment variable ERT_LIBRARY_PATH it is possible to
# override the default algorithms. If the ERT_LIBRARY_PATH is set
# to a non existing directory a warning will go to stderr and the
# setting will be ignored.
env_lib_path = os.getenv("ERT_LIBRARY_PATH")
if env_lib_path:
if os.path.isdir( env_lib_path ):
res_lib_path = os.getenv("ERT_LIBRARY_PATH")
else:
sys.stderr.write("Warning: Environment variable ERT_LIBRARY_PATH points to nonexisting directory:%s - ignored" % env_lib_path)


# Check that the final ert_lib_path setting corresponds to an existing
# directory.
if res_lib_path:
Expand All @@ -112,6 +77,11 @@
if sys.hexversion < required_version_hex:
raise Exception("ERT Python requires Python 2.7")

if os.getenv("ERT_LIBRARY_PATH"):
raise EnvironmentError("ERT_LIBRARY_PATH is deprecated and should be "
"removed from your environment")


# This load() function is *the* function actually loading shared
# libraries.

Expand Down

0 comments on commit 291dd5b

Please sign in to comment.