Skip to content

Commit 8fbf4c5

Browse files
committed
fix: corrected files resulting failure of CI/CD tests
1 parent f80afe2 commit 8fbf4c5

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

.ci/build_wheel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
os.environ["DIST_EXTRA_CONFIG"] = str(build_opts_path)
4747

4848
# Move the binaries
49-
gatebin_folder_path = Path() / "src" / "ansys" / "dpf" / "gatebin"
49+
gatebin_folder_path = Path.cwd() / "src" / "ansys" / "dpf" / "gatebin"
5050
binaries_to_move = []
5151
moved = []
5252
if "win" in requested_platform or "any" == requested_platform:

.ci/run_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
server.shutdown()
2222
print(f"Server version: {server_version}")
2323

24-
for root, subdirectories, files in os.walk(examples_path):
24+
for root, subdirectories, files in examples_path.walk():
2525
for subdirectory in subdirectories:
26-
subdir = pathlib.Path(root) / subdirectory
26+
subdir = root / subdirectory
2727
for file in glob.iglob(str(subdir / "*.py")):
2828
if sys.platform == "linux" and "08-python-operators" in file:
2929
continue

.ci/run_non_regression_examples.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
list_tests.append(examples_path / "08-python-operators" / "00-wrapping_numpy_capabilities.py")
2828

2929
for path in list_tests:
30-
path = pathlib.Path(path)
3130
if path.is_dir():
3231
for file in glob.iglob(str(path / "*.py")):
3332
print("\n--------------------------------------------------")

.ci/update_dpf_dependencies.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515

1616
import os
1717
import glob
18-
import pathlib
18+
from pathlib import Path
1919
import platform
2020
import shutil
2121
import zipfile
2222

2323

2424
grpc_path_key = "DPFDV_ROOT"
2525
gate_path_key = "ANSYSDPFPYGATE_ROOT"
26-
core_path = pathlib.Path(__file__).parent.parent
26+
core_path = Path(__file__).parent.parent
2727
if "ANSYSDPFCORE_ROOT" in os.environ:
2828
core_path = os.environ["ANSYSDPFCORE_ROOT"]
2929

@@ -33,11 +33,11 @@
3333
if grpc_path:
3434
# Update ansys-grpc-dpf with latest in proto/dist
3535
print("Updating ansys.grpc.dpf")
36-
dist_path = grpc_path / "proto" / "dist" / "*"
36+
dist_path = Path(grpc_path) / "proto" / "dist" / "*"
3737
print(f"from {dist_path}")
38-
destination = core_path / "src"
38+
destination = Path(core_path) / "src"
3939
print(f"into {destination}")
40-
latest_wheel = max(glob.glob(dist_path), key=os.path.getctime)
40+
latest_wheel = max(glob.glob(str(dist_path)), key=os.path.getctime)
4141
with zipfile.ZipFile(latest_wheel, "r") as wheel:
4242
for file in wheel.namelist():
4343
# print(file)
@@ -53,9 +53,9 @@
5353
if gate_path:
5454
# Update ansys-dpf-gate
5555
print("Updating ansys.dpf.gate generated code")
56-
dist_path = gate_path / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "generated"
56+
dist_path = Path(gate_path) / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "generated"
5757
print(f"from {dist_path}")
58-
destination = core_path / "src" / "ansys" / "dpf" / "gate" / "generated"
58+
destination = Path(core_path) / "src" / "ansys" / "dpf" / "gate" / "generated"
5959
print(f"into {destination}")
6060
shutil.copytree(
6161
src=dist_path,
@@ -64,18 +64,18 @@
6464
ignore=lambda directory, contents: ["__pycache__"] if str(directory)[-5:] == "gate" else [],
6565
)
6666

67-
dist_path = gate_path / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "__init__.py"
67+
dist_path = Path(gate_path) / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "__init__.py"
6868
print(f"from {dist_path}")
69-
destination = core_path / "src" / "ansys" / "dpf" / "gate" / "__init__.py"
69+
destination = Path(core_path) / "src" / "ansys" / "dpf" / "gate" / "__init__.py"
7070
print(f"into {destination}")
7171
shutil.copy(src=dist_path, dst=destination)
7272
print("Done updating ansys.dpf.gate generated code")
7373

7474
# Update ansys-dpf-gatebin
7575
print("Updating ansys.dpf.gatebin")
76-
dist_path = gate_path / "ansys-dpf-gatebin" / "ansys"
76+
dist_path = Path(gate_path) / "ansys-dpf-gatebin" / "ansys"
7777
print(f"from {dist_path}")
78-
destination = core_path / "src" / "ansys"
78+
destination = Path(core_path) / "src" / "ansys"
7979
print(f"into {destination}")
8080
shutil.copytree(src=dist_path, dst=destination, dirs_exist_ok=True)
8181
print(f"Done updating ansys.dpf.gatebin for {platform.system()}")

examples/08-python-operators/01-package_python_operators.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@
7272
# for the plug-in package that is used to record operators.
7373
#
7474

75-
from pathlib import Path
76-
7775
from ansys.dpf import core as dpf
7876
from ansys.dpf.core import examples
7977

@@ -83,9 +81,9 @@
8381
tmp = dpf.make_tmp_dir_server()
8482
dpf.upload_files_in_folder(dpf.path_utilities.join(tmp, "average_filter_plugin"), plugin_folder)
8583
dpf.load_library(
86-
Path(dpf.path_utilities.join(tmp, "average_filter_plugin"))
87-
/ "py_average_filter"
88-
/ "load_operators"
84+
dpf.path_utilities.join(tmp, "average_filter_plugin"),
85+
"py_average_filter",
86+
"load_operators",
8987
)
9088

9189
###############################################################################

examples/08-python-operators/02-python_operators_with_dependencies.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
from ansys.dpf.core import examples
6464

6565
plugin_path = Path(examples.download_gltf_plugin())
66-
folder_root = Path(__file__).root
66+
folder_root = Path(__file__).parent.parent.parent
6767

6868
# %%
6969
# To add third-party modules as dependencies to a plug-in package, you must
@@ -128,7 +128,7 @@
128128
"powershell",
129129
str(cmd_file),
130130
"-pluginpath",
131-
plugin_path,
131+
str(plugin_path),
132132
"-zippath",
133133
str(plugin_path / "assets" / "gltf_sites_winx64.zip"),
134134
]
@@ -182,8 +182,8 @@
182182
dpf.start_local_server(config=dpf.AvailableServerConfigs.GrpcServer)
183183

184184
tmp = Path(dpf.make_tmp_dir_server())
185-
dpf.upload_files_in_folder(dpf.path_utilities.join(tmp, "plugins", "gltf_plugin"), plugin_path)
186-
dpf.upload_file(plugin_path + ".xml", dpf.path_utilities.join(tmp, "plugins", "gltf_plugin.xml"))
185+
dpf.upload_files_in_folder(dpf.path_utilities.join(str(tmp), "plugins", "gltf_plugin"), plugin_path)
186+
dpf.upload_file(str(plugin_path) + ".xml", dpf.path_utilities.join(str(tmp), "plugins", "gltf_plugin.xml"))
187187

188188
dpf.load_library(
189189
dpf.path_utilities.join(tmp, "plugins", "gltf_plugin"),
@@ -235,7 +235,7 @@
235235
displacement = model.results.displacement()
236236
displacement.inputs.mesh_scoping(skin_mesh)
237237
displacement.inputs.mesh(skin_mesh)
238-
new_operator.inputs.path(tmp / "out")
238+
new_operator.inputs.path(str(tmp / "out"))
239239
new_operator.inputs.mesh(skin_mesh)
240240
new_operator.inputs.field(displacement.outputs.fields_container()[0])
241241
new_operator.run()

src/ansys/dpf/core/core.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,15 @@ def upload_files_in_folder(
761761
new file paths server side
762762
"""
763763
server_paths = []
764-
for root, subdirectories, files in Path.walk(client_folder_path):
764+
client_folder_path = Path(client_folder_path)
765+
for root, subdirectories, files in client_folder_path.walk():
765766
for subdirectory in subdirectories:
766767
subdir = root / subdirectory
767768
for filename in subdir.iterdir():
768769
f = subdir / filename
769770
server_paths = self._upload_and_get_server_path(
770771
specific_extension,
771-
f,
772+
str(f),
772773
filename,
773774
server_paths,
774775
str(to_server_folder_path),
@@ -778,7 +779,7 @@ def upload_files_in_folder(
778779
f = root / file
779780
server_paths = self._upload_and_get_server_path(
780781
specific_extension,
781-
f,
782+
str(f),
782783
file,
783784
server_paths,
784785
str(to_server_folder_path),
@@ -836,7 +837,8 @@ def upload_file(self, file_path, to_server_file_path):
836837
server_file_path : str
837838
path generated server side
838839
"""
839-
if Path.stat(file_path).st_size == 0:
840+
file_path = Path(file_path)
841+
if file_path.stat().st_size == 0:
840842
raise ValueError(file_path + " is empty")
841843
if not self._server().has_client():
842844
txt = """
@@ -868,11 +870,12 @@ def upload_file_in_tmp_folder(self, file_path, new_file_name=None):
868870
server_file_path : str
869871
path generated server side
870872
"""
873+
file_path = Path(file_path)
871874
if new_file_name:
872875
file_name = new_file_name
873876
else:
874877
file_name = Path(file_path).name
875-
if Path.stat(file_path).st_size == 0:
878+
if file_path.stat().st_size == 0:
876879
raise ValueError(file_path + " is empty")
877880
if not self._server().has_client():
878881
txt = """

0 commit comments

Comments
 (0)