Skip to content

Commit

Permalink
export: fix lib file move
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Dec 1, 2023
1 parent e9a3cf2 commit 4ef688f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion otfmi/function_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,8 @@ def export_model(self, model_path, gui=False, verbose=False, binary=True, mode="
list_file = [className + extension]
if binary:
# licwrapper.a/.so, cwrapper.lib/dll
list_file += glob.glob(os.path.join(self._workdir, "*cwrapper*"))
libfiles = glob.glob(os.path.join(self._workdir, "*cwrapper*"))
list_file += [os.path.basename(x) for x in libfiles]
else:
list_file += ["wrapper" + c_ext, "CMakeLists.txt"]
for file in list_file:
Expand Down
6 changes: 5 additions & 1 deletion test/test_export.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python

import glob
import openturns as ot
import otfmi
import os
Expand Down Expand Up @@ -121,6 +122,9 @@ def test_export_model(mode, binary):
assert os.path.isfile(path_model), f"model not created in file {path_model}"

if binary:
libfiles = glob.glob(os.path.join(temp_path, "*cwrapper*"))
assert len(libfiles) > 0, "lib file not created"

# write simulation mos
path_mos = os.path.join(temp_path, "simulate.mos")
with open(path_mos, "w") as mos:
Expand All @@ -131,7 +135,7 @@ def test_export_model(mode, binary):
else:
c_ext = ".cxx" if mode == "cxx" else ".c"
assert os.path.isfile(os.path.join(temp_path, "wrapper" + c_ext)), "wrapper source not created"
assert os.path.isfile(os.path.join(temp_path, "CMakeLists.txt")), "cmakelists not created"
assert os.path.isfile(os.path.join(temp_path, "CMakeLists.txt")), "CMakeLists not created"
shutil.rmtree(temp_path)


Expand Down

0 comments on commit 4ef688f

Please sign in to comment.