Skip to content

Commit

Permalink
Add exomerge3.py to the installable Python wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
mvlopri committed Jun 26, 2023
1 parent d70c3e6 commit 50ce510
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
14 changes: 12 additions & 2 deletions packages/seacas/scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ IF (${PROJECT_NAME}_ENABLE_SEACASExodus)
${CMAKE_CURRENT_BINARY_DIR}/tests/exomerge_unit_test.py
@ONLY
)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/exomerge3.py
${CMAKE_CURRENT_BINARY_DIR}/exomerge3.py
@ONLY
)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/exomerge2.py
${CMAKE_CURRENT_BINARY_DIR}/exomerge2.py
@ONLY
)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_exodus3.py
${CMAKE_CURRENT_BINARY_DIR}/tests/test_exodus3.py
Expand All @@ -154,8 +164,8 @@ IF (${PROJECT_NAME}_ENABLE_SEACASExodus)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tests/exomerge_unit_test.py DESTINATION lib/tests/)
INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-assembly.exo DESTINATION lib/tests/)
INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tests/exomerge_unit_test.e DESTINATION lib/tests/)
INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/exomerge2.py DESTINATION lib)
INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/exomerge3.py DESTINATION lib)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/exomerge2.py DESTINATION lib)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/exomerge3.py DESTINATION lib)

if (${CMAKE_PROJECT_NAME} STREQUAL "Seacas")
InstallSymLink(${EXODUSPY} ${CMAKE_INSTALL_PREFIX}/lib/exodus.py)
Expand Down
Empty file.
5 changes: 3 additions & 2 deletions packages/seacas/scripts/exodus3.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def getExodusVersion():
found.
"""

return _parse_exodus_version('@EXODUS_VERSION@')
return _parse_exodus_version('@EXODUS_VERSION@')


def _parse_exodus_version(version_string):
if version_string:
Expand Down Expand Up @@ -164,7 +165,7 @@ class ex_options(Enum):
pip_so_path = os.path.join(pip_path, "libexodus.so")
try:
EXODUS_LIB = ctypes.cdll.LoadLibrary(pip_so_path)
except:
except Exception:
EXODUS_LIB = ctypes.cdll.LoadLibrary(EXODUS_SO)

MAX_STR_LENGTH = 32 # match exodus default
Expand Down
7 changes: 2 additions & 5 deletions packages/seacas/scripts/tests/test_exodus3.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def setUp(self):
input_dir = os.path.dirname(__file__)
self.tempdir = tempfile.TemporaryDirectory()
self.temp_exo_path = os.path.join(self.tempdir.name, "temp-test-assembly.exo")
with exo.exodus(os.path.join(input_dir, "test-assembly.exo"), mode="r"
) as exofile:
with exo.exodus(os.path.join(input_dir, "test-assembly.exo"), mode="r") as exofile:
self.exofile = exofile
with self.exofile.copy(self.temp_exo_path, True) as temp_exofile:
self.temp_exofile = temp_exofile
Expand Down Expand Up @@ -120,9 +119,7 @@ def test_get_block_id_map(self):
def test_get_assembly(self):
with exo.exodus(self.temp_exo_path) as temp_exofile:
assembly_ids = temp_exofile.get_ids("EX_ASSEMBLY")
assemblies = [
temp_exofile.get_assembly(assembly) for assembly in assembly_ids
]
assemblies = [temp_exofile.get_assembly(assembly) for assembly in assembly_ids]
root = exo.assembly(name="Root", type="EX_ASSEMBLY", id=100)
root.entity_list = [200, 300, 400]
self.assertEqual(str(root), str(assemblies[0]))
Expand Down
11 changes: 6 additions & 5 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os
import subprocess
Expand All @@ -22,13 +22,14 @@
description='A python wrapper of the exodus library',
version='1.21.1',
url='https://github.com/sandialabs/seacas',
py_modules=['exodus3'],
py_modules=['exodus3', 'exomerge3'],
package_dir={"":"build/packages/seacas/scripts"},
cmdclass = {'build_ext': cmake_build_ext},
ext_modules = [Extension("exodus", [""])]
)

wheels = os.listdir("dist")
platform = "linux_x86_64"
subprocess.run(["python", "-m", "pip", "install", "auditwheel", "patchelf"])
for wheel in wheels:
subprocess.run(["python", "-m", "auditwheel", "repair", "--plat", platform, f"dist/{wheel}"])
subprocess.run(["python", "-m", "pip", "install", "--user", "auditwheel", "patchelf>=0.14"])
for wheel in [x for x in wheels if x.endswith(".whl")]:
subprocess.run(["python", "-m", "auditwheel", "repair", "--plat", platform, f"dist/{wheel}"])
Binary file not shown.

0 comments on commit 50ce510

Please sign in to comment.