Skip to content

Commit de0a677

Browse files
authored
Refactor misc.py (#1276)
* Fix Vale * Refactor and check for aisol path in install * Check for existence of dpf/bin folder in AWP_ROOT location * Test for dpf folder only starting with 231 * Revert Update docs/source/getting_started/index.rst * Revert renaming * Simplify modifications on load_api.py * Revert changes to gate
1 parent 8048e2b commit de0a677

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/ansys/dpf/core/misc.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -107,35 +107,7 @@ def _pythonize_awp_version(version):
107107

108108

109109
def _find_latest_ansys_versions():
110-
if hasattr(load_api, "_find_latest_ansys_versions"):
111-
return load_api._find_latest_ansys_versions()
112-
awp_versions = [key[-3:] for key in os.environ.keys() if "AWP_ROOT" in key]
113-
installed_packages_list = {}
114-
115-
for awp_version in awp_versions:
116-
if not awp_version.isnumeric():
117-
continue
118-
ansys_path = os.environ.get("AWP_ROOT" + awp_version)
119-
if ansys_path:
120-
installed_packages_list[
121-
packaging.version.parse(_pythonize_awp_version(awp_version))
122-
] = ansys_path
123-
124-
installed_packages = pkg_resources.working_set
125-
for i in installed_packages:
126-
if "ansys-dpf-server" in i.key:
127-
file_name = pkg_resources.to_filename(i.project_name.replace("ansys-dpf-", ""))
128-
try:
129-
module = importlib.import_module("ansys.dpf." + file_name)
130-
installed_packages_list[
131-
packaging.version.parse(module.__version__)
132-
] = module.__path__[0]
133-
except ModuleNotFoundError:
134-
pass
135-
except AttributeError:
136-
pass
137-
if len(installed_packages_list) > 0:
138-
return installed_packages_list[sorted(installed_packages_list)[-1]]
110+
return load_api._find_latest_ansys_versions()
139111

140112

141113
def find_ansys():

0 commit comments

Comments
 (0)