|
53 | 53 | At this point, the name should be: {something}\ansys\pyensight\core\exts
|
54 | 54 | Check for the fragments in the right order.
|
55 | 55 | """
|
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: |
61 | 63 | # name of 'ansys/pyensight/core' directory. We need three levels above.
|
62 | 64 | name = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(kit_dir))))
|
63 | 65 | 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}") |
65 | 67 |
|
66 | 68 | # at this point, we may need to repeat the imports that make have failed earlier
|
67 | 69 | 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 |
70 | 70 |
|
71 | 71 | # force a reload if we changed the path or had a partial failure that lead
|
72 | 72 | # to a pipapi install.
|
73 | 73 | _ = reload(ansys.pyensight.core)
|
74 | 74 | _ = reload(ansys.pyensight.core.utils)
|
| 75 | +import ansys.pyensight.core.utils.dsg_server as dsg_server # noqa: E402 |
| 76 | + |
75 | 77 | _ = reload(ansys.pyensight.core.utils.dsg_server)
|
| 78 | +import ansys.pyensight.core.utils.omniverse_dsg_server as ov_dsg_server # noqa: E402 |
| 79 | + |
76 | 80 | _ = reload(ansys.pyensight.core.utils.omniverse_dsg_server)
|
77 | 81 |
|
78 | 82 | logging.warning(f"Using ansys.pyensight.core from: {ansys.pyensight.core.__file__}")
|
|
0 commit comments