Skip to content

Commit

Permalink
use ansys-tool-path, instead of using the env variable (#116)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Roberto Pastor Muela <[email protected]>
  • Loading branch information
3 people authored Jun 12, 2023
1 parent 7419b14 commit af6ddca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies = [
"appdirs",
"requests",
"PySide6",
"ansys-tools-path",
]
classifiers = [
"Development Status :: 4 - Beta",
Expand All @@ -43,6 +44,7 @@ tests = [
"appdirs==1.4.4",
"requests==2.31.0",
"PySide6==6.5.1.1",
"ansys-tools-path==0.2.4",
"pytest==7.3.2",
"pytest-cov==4.1.0",
"pytest-qt==4.2.0",
Expand All @@ -59,6 +61,7 @@ freeze = [
"appdirs==1.4.4",
"requests==2.31.0",
"PySide6==6.5.1.1",
"ansys-tools-path==0.2.4",
]

[tool.flit.module]
Expand Down
2 changes: 0 additions & 2 deletions src/ansys/tools/installer/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

ANSYS_VENVS = ".ansys_python_venvs"

ANSYS_ENV_VAR_START = "awp_root"

ANSYS_SUPPORTED_PYTHON_VERSIONS = ["3_7", "3_10"]

INSTALL_TEXT = """Choose to use either the standard Python install from <a href='https://www.python.org/'>python.org</a> or <a href='https://github.com/conda-forge/miniforge'>miniforge</a>."""
Expand Down
23 changes: 6 additions & 17 deletions src/ansys/tools/installer/find_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
from pathlib import Path
import subprocess

from ansys.tools.installer.constants import (
ANSYS_ENV_VAR_START,
ANSYS_SUPPORTED_PYTHON_VERSIONS,
ANSYS_VENVS,
)
from ansys.tools.path import get_available_ansys_installations

from ansys.tools.installer.constants import ANSYS_SUPPORTED_PYTHON_VERSIONS, ANSYS_VENVS

# only used on windows
try:
Expand Down Expand Up @@ -104,21 +102,12 @@ def _find_installed_python_win(admin=False):
return paths


def _find_installed_ansys_win():
"""Check the environment variables for Ansys installations."""
env_keys = []
for key in os.environ.keys():
if key.lower().startswith(ANSYS_ENV_VAR_START):
env_keys.append(key)
return env_keys


def _find_installed_ansys_python_win():
"""Check the Ansys installation folder for installed Python."""
installed_ansys = _find_installed_ansys_win()
installed_ansys = get_available_ansys_installations()
paths = {}
for ansys_ver_env_key in installed_ansys:
ansys_path = os.environ[ansys_ver_env_key]
for ver in installed_ansys:
ansys_path = installed_ansys[ver]
for ansys_py_ver in ANSYS_SUPPORTED_PYTHON_VERSIONS:
path = os.path.join(
ansys_path,
Expand Down

0 comments on commit af6ddca

Please sign in to comment.