Skip to content

Commit 586c9bf

Browse files
randallfrankmariostieriansys
authored andcommitted
Missed a duplication of the exension.py file (#403)
1 parent 8e2ca84 commit 586c9bf

File tree

1 file changed

+12
-8
lines changed
  • exts/ansys.geometry.service/ansys/geometry/service

1 file changed

+12
-8
lines changed

exts/ansys.geometry.service/ansys/geometry/service/extension.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,30 @@
5353
At this point, the name should be: {something}\ansys\pyensight\core\exts
5454
Check for the fragments in the right order.
5555
"""
56-
offsets = []
57-
for name in ["ansys", "pyensight", "core", "exts"]:
58-
offsets.append(kit_dir.find(name))
59-
# if the order of the names in correct and there is no -1 in the offsets, we found it
60-
if (sorted(offsets) == offsets) and (sorted(offsets)[0] != -1):
56+
tmp_kit_dir = kit_dir
57+
valid_dir = True
58+
for name in ["exts", "core", "pyensight", "ansys"]:
59+
if not tmp_kit_dir.endswith(name):
60+
valid_dir = False
61+
tmp_kit_dir = os.path.dirname(tmp_kit_dir)
62+
if valid_dir:
6163
# name of 'ansys/pyensight/core' directory. We need three levels above.
6264
name = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(kit_dir))))
6365
sys.path.insert(0, name)
64-
logging.info(f"Using ansys.pyensight.core from: {name}")
66+
logging.warning(f"Using ansys.pyensight.core from: {name}")
6567

6668
# at this point, we may need to repeat the imports that make have failed earlier
6769
import ansys.pyensight.core # noqa: F811, E402
68-
import ansys.pyensight.core.utils.dsg_server as dsg_server # noqa: E402
69-
import ansys.pyensight.core.utils.omniverse_dsg_server as ov_dsg_server # noqa: E402
7070

7171
# force a reload if we changed the path or had a partial failure that lead
7272
# to a pipapi install.
7373
_ = reload(ansys.pyensight.core)
7474
_ = reload(ansys.pyensight.core.utils)
75+
import ansys.pyensight.core.utils.dsg_server as dsg_server # noqa: E402
76+
7577
_ = reload(ansys.pyensight.core.utils.dsg_server)
78+
import ansys.pyensight.core.utils.omniverse_dsg_server as ov_dsg_server # noqa: E402
79+
7680
_ = reload(ansys.pyensight.core.utils.omniverse_dsg_server)
7781

7882
logging.warning(f"Using ansys.pyensight.core from: {ansys.pyensight.core.__file__}")

0 commit comments

Comments
 (0)