sandialabs / seacas

The Sandia Engineering Analysis Code Access System (SEACAS) is a suite of preprocessing, postprocessing, translation, and utility applications supporting finite element analysis software using the Exodus database file format.
Other
131 stars 79 forks source link

Python bindings include absolute path to build directory. #457

Open rndubs opened 3 months ago

rndubs commented 3 months ago

After generating python bindings, the exodus3.py module contains the following lines (lines 164-174 in version 1.21.1):

ACCESS = os.getenv('ACCESS', '/path/to/build/dir/seacas')  # <-- this line is the one in question
if os.uname()[0] == 'Darwin':
    EXODUS_SO = f"{ACCESS}/lib/libexodus.dylib"
else:
    EXODUS_SO = f"{ACCESS}/lib/libexodus.so"
pip_path = os.path.dirname(__file__)
pip_so_path = os.path.join(pip_path, "libexodus.so")
try:
    EXODUS_LIB = ctypes.cdll.LoadLibrary(pip_so_path)
except Exception:
    EXODUS_LIB = ctypes.cdll.LoadLibrary(EXODUS_SO)

The default path provided to os.getenv should likely be a relative path, or a path constructed from the current module's location, since installation from the wheel will likely rarely be in the build directory.

It is unclear if the ACCESS code path is needed in addition to the pip_path code path. Either way, the path as currently defined is not going to work for distribution of the wheel.

Additionally, the installed location in a venv is going to be </path to venv>/lib/python3.X/site-packages, so the EXODUS_SO paths are not going to point to the .so even when ACCESS points to the installation location instead of the build location.

gsjaardema commented 3 months ago

@mvlopri