Skip to content

Commit a1ce34e

Browse files
committed
fix: reverted .ci/ files
1 parent f6aa2ab commit a1ce34e

File tree

4 files changed

+69
-44
lines changed

4 files changed

+69
-44
lines changed

.ci/build_wheel.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import argparse
55
import subprocess
6-
from pathlib import Path
76
import os
87
import sys
98
import shutil
@@ -40,13 +39,15 @@
4039
print("Created temporary directory: ", tmpdirname)
4140

4241
# Create the temporary build-opts.cfg
43-
build_opts_path = Path(tmpdirname) / "build-opts.cfg"
44-
45-
build_opts_path.write_text(f"[bdist_wheel]\nplat-name={requested_platform}", encoding="utf-8")
46-
os.environ["DIST_EXTRA_CONFIG"] = str(build_opts_path)
42+
build_opts_path = os.path.join(tmpdirname, "build-opts.cfg")
43+
with open(build_opts_path, "w") as build_opts_file:
44+
build_opts_file.write(f"[bdist_wheel]\nplat-name={requested_platform}")
45+
os.environ["DIST_EXTRA_CONFIG"] = build_opts_path
4746

4847
# Move the binaries
49-
gatebin_folder_path = Path.cwd() / "src" / "ansys" / "dpf" / "gatebin"
48+
gatebin_folder_path = os.path.join(
49+
os.path.curdir, os.path.join("src", "ansys", "dpf", "gatebin")
50+
)
5051
binaries_to_move = []
5152
moved = []
5253
if "win" in requested_platform or "any" == requested_platform:
@@ -59,15 +60,15 @@
5960
binaries_to_move.extend(["_version.py"])
6061

6162
for binary_name in binaries_to_move:
62-
src = gatebin_folder_path / binary_name
63-
dst = Path(tmpdirname) / binary_name
63+
src = os.path.join(gatebin_folder_path, binary_name)
64+
dst = os.path.join(tmpdirname, binary_name)
6465
print(f"Moving {src} to {dst}")
6566
shutil.move(src=src, dst=dst)
6667
moved.append([dst, src])
6768

6869
if "any" == requested_platform:
6970
# Also remove the gatebin folder
70-
gatebin_folder_path.rmdir()
71+
os.rmdir(gatebin_folder_path)
7172

7273
# Call the build
7374
if not args.wheelhouse:
@@ -82,7 +83,7 @@
8283

8384
if "any" == requested_platform:
8485
# Recreate the gatebin folder
85-
gatebin_folder_path.mkdir()
86+
os.mkdir(gatebin_folder_path)
8687

8788
# Move binaries back
8889
for move_back in moved:

.ci/run_examples.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@
1212
os.environ["MPLBACKEND"] = "Agg"
1313

1414
actual_path = pathlib.Path(__file__).parent.absolute()
15-
examples_path = actual_path.parent / "examples"
16-
print(examples_path)
15+
print(os.path.join(actual_path, os.path.pardir, "examples"))
1716

1817
# Get the DPF server version
1918
server = dpf.server.get_or_create_server(None)
2019
server_version = server.version
2120
server.shutdown()
2221
print(f"Server version: {server_version}")
2322

24-
for root, subdirectories, files in examples_path.walk():
23+
for root, subdirectories, files in os.walk(os.path.join(actual_path, os.path.pardir, "examples")):
2524
for subdirectory in subdirectories:
26-
subdir = root / subdirectory
27-
for file in glob.iglob(str(subdir / "*.py")):
25+
subdir = os.path.join(root, subdirectory)
26+
for file in glob.iglob(os.path.join(subdir, "*.py")):
2827
if sys.platform == "linux" and "08-python-operators" in file:
2928
continue
3029
elif "win" in sys.platform and "06-distributed_stress_averaging" in file:

.ci/run_non_regression_examples.py

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,45 @@
99
os.environ["MPLBACKEND"] = "Agg"
1010

1111
actual_path = pathlib.Path(__file__).parent.absolute()
12-
examples_path = actual_path.parent / "examples"
13-
print(examples_path)
12+
print(os.path.join(actual_path, os.path.pardir, "examples"))
1413

1514

1615
list_tests = [
17-
examples_path / "00-basic",
18-
examples_path / "01-transient_analyses",
19-
examples_path / "02-modal_analyses",
20-
examples_path / "03-harmonic_analyses",
21-
examples_path / "06-plotting" / "00-basic_plotting.py",
22-
examples_path / "06-plotting" / "05-plot_on_warped_mesh.py",
23-
examples_path / "07-distributed-post" / "00-distributed_total_disp.py",
16+
os.path.join(actual_path, os.path.pardir, "examples", "00-basic"),
17+
os.path.join(actual_path, os.path.pardir, "examples", "01-transient_analyses"),
18+
os.path.join(actual_path, os.path.pardir, "examples", "02-modal_analyses"),
19+
os.path.join(actual_path, os.path.pardir, "examples", "03-harmonic_analyses"),
20+
os.path.join(actual_path, os.path.pardir, "examples", "06-plotting", "00-basic_plotting.py"),
21+
os.path.join(
22+
actual_path,
23+
os.path.pardir,
24+
"examples",
25+
"06-plotting",
26+
"05-plot_on_warped_mesh.py",
27+
),
28+
os.path.join(
29+
actual_path,
30+
os.path.pardir,
31+
"examples",
32+
"07-distributed-post",
33+
"00-distributed_total_disp.py",
34+
),
2435
]
2536

2637
if core.SERVER_CONFIGURATION != core.AvailableServerConfigs.InProcessServer:
27-
list_tests.append(examples_path / "08-python-operators" / "00-wrapping_numpy_capabilities.py")
38+
list_tests.append(
39+
os.path.join(
40+
actual_path,
41+
os.path.pardir,
42+
"examples",
43+
"08-python-operators",
44+
"00-wrapping_numpy_capabilities.py",
45+
)
46+
)
2847

2948
for path in list_tests:
30-
if path.is_dir():
31-
for file in glob.iglob(str(path / "*.py")):
49+
if os.path.isdir(path):
50+
for file in glob.iglob(os.path.join(path, "*.py")):
3251
print("\n--------------------------------------------------")
3352
print(file)
3453
try:

.ci/update_dpf_dependencies.py

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

1616
import os
1717
import glob
18-
from pathlib import Path
18+
import pathlib
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 = Path(__file__).parent.parent
26+
core_path = pathlib.Path(__file__).parent.parent.resolve()
2727
if "ANSYSDPFCORE_ROOT" in os.environ:
2828
core_path = os.environ["ANSYSDPFCORE_ROOT"]
2929

3030
grpc_path = os.getenv(grpc_path_key, None)
3131
gate_path = os.getenv(gate_path_key, None)
3232

33-
if grpc_path:
33+
if grpc_path is not None:
3434
# Update ansys-grpc-dpf with latest in proto/dist
3535
print("Updating ansys.grpc.dpf")
36-
dist_path = Path(grpc_path) / "proto" / "dist" / "*"
36+
dist_path = os.path.join(grpc_path, "proto", "dist", "*")
3737
print(f"from {dist_path}")
38-
destination = Path(core_path) / "src"
38+
destination = os.path.join(core_path, "src")
3939
print(f"into {destination}")
40-
latest_wheel = max(glob.glob(str(dist_path)), key=os.path.getctime)
40+
latest_wheel = max(glob.glob(dist_path), key=os.path.getctime)
4141
with zipfile.ZipFile(latest_wheel, "r") as wheel:
4242
for file in wheel.namelist():
4343
# print(file)
@@ -50,34 +50,40 @@
5050
else:
5151
print(f"{grpc_path_key} environment variable is not defined. " "Cannot update ansys-grpc-dpf.")
5252

53-
if gate_path:
53+
if gate_path is not None:
5454
# Update ansys-dpf-gate
5555
print("Updating ansys.dpf.gate generated code")
56-
dist_path = Path(gate_path) / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "generated"
56+
dist_path = os.path.join(gate_path, "ansys-dpf-gate", "ansys", "dpf", "gate", "generated")
5757
print(f"from {dist_path}")
58-
destination = Path(core_path) / "src" / "ansys" / "dpf" / "gate" / "generated"
58+
destination = os.path.join(core_path, "src", "ansys", "dpf", "gate", "generated")
5959
print(f"into {destination}")
6060
shutil.copytree(
6161
src=dist_path,
6262
dst=destination,
6363
dirs_exist_ok=True,
64-
ignore=lambda directory, contents: ["__pycache__"] if str(directory)[-5:] == "gate" else [],
64+
ignore=lambda directory, contents: ["__pycache__"] if directory[-5:] == "gate" else [],
6565
)
66-
67-
dist_path = Path(gate_path) / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "__init__.py"
66+
dist_path = os.path.join(gate_path, "ansys-dpf-gate", "ansys", "dpf", "gate", "__init__.py")
6867
print(f"from {dist_path}")
69-
destination = Path(core_path) / "src" / "ansys" / "dpf" / "gate" / "__init__.py"
68+
destination = os.path.join(core_path, "src", "ansys", "dpf", "gate", "__init__.py")
7069
print(f"into {destination}")
71-
shutil.copy(src=dist_path, dst=destination)
70+
shutil.copy(
71+
src=dist_path,
72+
dst=destination,
73+
)
7274
print("Done updating ansys.dpf.gate generated code")
7375

7476
# Update ansys-dpf-gatebin
7577
print("Updating ansys.dpf.gatebin")
76-
dist_path = Path(gate_path) / "ansys-dpf-gatebin" / "ansys"
78+
dist_path = os.path.join(gate_path, "ansys-dpf-gatebin", "ansys")
7779
print(f"from {dist_path}")
78-
destination = Path(core_path) / "src" / "ansys"
80+
destination = os.path.join(core_path, "src", "ansys")
7981
print(f"into {destination}")
80-
shutil.copytree(src=dist_path, dst=destination, dirs_exist_ok=True)
82+
shutil.copytree(
83+
src=dist_path,
84+
dst=destination,
85+
dirs_exist_ok=True,
86+
)
8187
print(f"Done updating ansys.dpf.gatebin for {platform.system()}")
8288
else:
8389
print(

0 commit comments

Comments
 (0)