Skip to content

Commit

Permalink
How gate should be modified
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Nov 14, 2023
1 parent 73958cf commit 40a5ae8
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/ansys/dpf/gate/load_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,9 @@ def _pythonize_awp_version(version):


def _find_latest_ansys_versions():
awp_versions = [key[-3:] for key in os.environ.keys() if "AWP_ROOT" in key]
installed_packages_list = {}

for awp_version in awp_versions:
if not awp_version.isnumeric():
continue
ansys_path = os.environ.get("AWP_ROOT" + awp_version)
if ansys_path:
installed_packages_list[
packaging.version.parse(_pythonize_awp_version(awp_version))
] = ansys_path

# Find the latest version of ansys_dpf_server installed in the current Python environment
installed_packages = pkg_resources.working_set
for i in installed_packages:
if "ansys-dpf-server" in i.key:
Expand All @@ -80,6 +71,19 @@ def _find_latest_ansys_versions():
if len(installed_packages_list) > 0:
return installed_packages_list[sorted(installed_packages_list)[-1]]

# If none was found, find the path to the latest ANSYS install
awp_versions = [key[-3:] for key in os.environ.keys() if "AWP_ROOT" in key]
for awp_version in awp_versions:
if not awp_version.isnumeric():
continue
ansys_path = os.environ.get("AWP_ROOT" + awp_version)
if ansys_path:
installed_packages_list[
packaging.version.parse(_pythonize_awp_version(awp_version))
] = ansys_path
if len(installed_packages_list) > 0:
return installed_packages_list[sorted(installed_packages_list)[-1]]


def _unified_installer_path_if_exists():
return _find_latest_ansys_versions()
Expand Down

0 comments on commit 40a5ae8

Please sign in to comment.