Skip to content

Commit 4ca42c2

Browse files
committed
Remove usage of python_generator operator in .ci/code_generation.py
Signed-off-by: paul.profizi <[email protected]>
1 parent a71dce5 commit 4ca42c2

File tree

1 file changed

+2
-75
lines changed

1 file changed

+2
-75
lines changed

.ci/code_generation.py

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,9 @@
55
import os
66
import glob
77
from pathlib import Path
8-
import time
98
import shutil
109

1110

12-
core.set_default_server_context(core.AvailableServerContexts.premium)
13-
14-
if os.name == "posix":
15-
LIB_TO_GENERATE = [
16-
"libAns.Dpf.Native.so",
17-
"libAns.Dpf.FEMutils.so",
18-
"libmapdlOperatorsCore.so",
19-
"libmeshOperatorsCore.so",
20-
"libAns.Dpf.Math.so",
21-
"libAns.Dpf.Hdf5.so",
22-
"libAns.Dpf.LSDYNAHGP.so",
23-
"libAns.Dpf.LivePost.so",
24-
"libans.dpf.pointcloudsearch.so",
25-
"libAns.Dpf.Vtk.so",
26-
"libAns.Dpf.MechanicalResults.so",
27-
]
28-
LIB_OPTIONAL_TO_GENERATE = [
29-
"libAns.Dpf.SystemCouplingMapping.so",
30-
]
31-
else:
32-
LIB_TO_GENERATE = [
33-
"Ans.Dpf.Native.dll",
34-
"Ans.Dpf.FEMutils.dll",
35-
"meshOperatorsCore.dll",
36-
"mapdlOperatorsCore.dll",
37-
"Ans.Dpf.Math.dll",
38-
"Ans.Dpf.PythonPluginWrapper.dll",
39-
"Ans.Dpf.Hdf5.dll",
40-
"Ans.Dpf.FlowDiagram.dll",
41-
"Ans.Dpf.LSDYNAHGP.dll",
42-
"Ans.Dpf.LivePost.dll",
43-
"Ans.Dpf.PointCloudSearch.dll",
44-
"Ans.Dpf.Vtk.dll",
45-
"Ans.Dpf.MechanicalResults.dll",
46-
]
47-
LIB_OPTIONAL_TO_GENERATE = [
48-
"Ans.Dpf.SystemCouplingMapping.dll",
49-
]
50-
5111
local_dir = os.path.dirname(os.path.abspath(__file__))
5212
TARGET_PATH = os.path.join(local_dir, os.pardir, "src", "ansys", "dpf", "core", "operators")
5313
files = glob.glob(os.path.join(TARGET_PATH, "*"))
@@ -65,41 +25,8 @@
6525
os.remove(f)
6626
except:
6727
pass
68-
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
69-
code_gen = core.Operator("python_generator")
70-
code_gen.connect(1, TARGET_PATH)
71-
for lib in LIB_TO_GENERATE:
72-
try:
73-
code_gen.connect(0, lib)
74-
if lib != LIB_TO_GENERATE[0]:
75-
code_gen.connect(2, False)
76-
else:
77-
code_gen.connect(2, True)
78-
print(f"Generating {lib} operators for server {core.SERVER.version}...")
79-
code_gen.run()
80-
time.sleep(0.1)
81-
except Exception as e:
82-
print(f"Could not generate operators for library {lib}:\n{str(e)}")
83-
raise e
8428

85-
for lib in LIB_OPTIONAL_TO_GENERATE:
86-
try:
87-
code_gen.connect(0, lib)
88-
if lib != LIB_OPTIONAL_TO_GENERATE[0]:
89-
code_gen.connect(2, False)
90-
else:
91-
code_gen.connect(2, True)
92-
print(f"Generating optional {lib} operators for server {core.SERVER.version}...")
93-
code_gen.run()
94-
time.sleep(0.1)
95-
except Exception as e:
96-
print(f"Could not generate operators for optional library {lib}:\n{str(e)}")
97-
98-
# Reorder imports alphabetically in __init__.py files to reduce changes raised
99-
for init_file_path in glob.glob(os.path.join(TARGET_PATH, "**/__init__.py"), recursive=True):
100-
with open(init_file_path, "r") as init_file:
101-
lines = init_file.readlines()
102-
with open(init_file_path, "w") as init_file:
103-
init_file.writelines(sorted(lines))
29+
core.set_default_server_context(core.AvailableServerContexts.premium)
30+
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
10431

10532
build.build_operators()

0 commit comments

Comments
 (0)