From 30f05b38716c652dfeade0900553651c795f7c81 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:53:53 +0100 Subject: [PATCH 1/2] refactor: replace `get_ansys_path` with `get_mapdl_path` --- src/ansys/mapdl/core/__init__.py | 2 +- src/ansys/mapdl/core/launcher.py | 6 +++--- src/ansys/mapdl/core/licensing.py | 4 ++-- src/ansys/mapdl/core/mapdl_core.py | 4 ++-- src/ansys/mapdl/core/pool.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ansys/mapdl/core/__init__.py b/src/ansys/mapdl/core/__init__.py index 99df5b589f..042550240a 100644 --- a/src/ansys/mapdl/core/__init__.py +++ b/src/ansys/mapdl/core/__init__.py @@ -128,8 +128,8 @@ from ansys.tools.path.path import ( change_default_ansys_path, find_mapdl, - get_ansys_path, get_available_ansys_installations, + get_mapdl_path, save_ansys_path, ) diff --git a/src/ansys/mapdl/core/launcher.py b/src/ansys/mapdl/core/launcher.py index 170307d231..83f9119ae5 100644 --- a/src/ansys/mapdl/core/launcher.py +++ b/src/ansys/mapdl/core/launcher.py @@ -65,7 +65,7 @@ import ansys.platform.instancemanagement as pypim if _HAS_ATP: - from ansys.tools.path import find_mapdl, get_ansys_path + from ansys.tools.path import find_mapdl, get_mapdl_path from ansys.tools.path import version_from_path as _version_from_path @wraps(_version_from_path) @@ -856,7 +856,7 @@ def get_default_ansys_version(): def check_valid_ansys(): """Checks if a valid version of ANSYS is installed and preconfigured""" - ansys_bin = get_ansys_path(allow_input=False) + ansys_bin = get_mapdl_path(allow_input=False) if ansys_bin is not None: version = version_from_path("mapdl", ansys_bin) return not (version < 170 and os.name != "posix") @@ -2351,7 +2351,7 @@ def get_exec_file(args: Dict[str, Any]) -> None: return LOG.debug("Using default executable.") - args["exec_file"] = get_ansys_path(version=args.get("version")) + args["exec_file"] = get_mapdl_path(version=args.get("version")) # Edge case if args["exec_file"] is None: diff --git a/src/ansys/mapdl/core/licensing.py b/src/ansys/mapdl/core/licensing.py index 3ae21047b4..6fd4d8beea 100644 --- a/src/ansys/mapdl/core/licensing.py +++ b/src/ansys/mapdl/core/licensing.py @@ -35,7 +35,7 @@ from ansys.mapdl.core.misc import threaded_daemon if _HAS_ATP: - from ansys.tools.path import get_ansys_path, version_from_path + from ansys.tools.path import get_mapdl_path, version_from_path LOCALHOST = "127.0.0.1" LIC_PATH_ENVAR = "ANSYSLIC_DIR" @@ -498,7 +498,7 @@ def get_ansys_license_debug_file_name(): # pragma: no cover hostname = socket.gethostname() appname = APP_NAME # This is the type of license my client requests (Windows 10, 2021R2) - version = version_from_path("mapdl", get_ansys_path(allow_input=False)) + version = version_from_path("mapdl", get_mapdl_path(allow_input=False)) ending = "out" if version < 221: diff --git a/src/ansys/mapdl/core/mapdl_core.py b/src/ansys/mapdl/core/mapdl_core.py index 88eb52fedb..ad21da82f5 100644 --- a/src/ansys/mapdl/core/mapdl_core.py +++ b/src/ansys/mapdl/core/mapdl_core.py @@ -1626,7 +1626,7 @@ def open_gui(self, include_result=None, inplace=None): # pragma: no cover >>> mapdl.eplot() """ # lazy load here to avoid circular import - from ansys.mapdl.core.launcher import get_ansys_path + from ansys.mapdl.core.launcher import get_mapdl_path if not self._local: raise MapdlRuntimeError( @@ -1703,7 +1703,7 @@ def open_gui(self, include_result=None, inplace=None): # pragma: no cover # issue system command to run ansys in GUI mode cwd = os.getcwd() os.chdir(run_dir) - exec_file = self._start_parm.get("exec_file", get_ansys_path(allow_input=False)) + exec_file = self._start_parm.get("exec_file", get_mapdl_path(allow_input=False)) nproc = self._start_parm.get("nproc", 2) add_sw = self._start_parm.get("additional_switches", "") diff --git a/src/ansys/mapdl/core/pool.py b/src/ansys/mapdl/core/pool.py index c1b7f1204d..40e22ae2b1 100755 --- a/src/ansys/mapdl/core/pool.py +++ b/src/ansys/mapdl/core/pool.py @@ -41,7 +41,7 @@ from ansys.mapdl.core.misc import create_temp_dir, threaded, threaded_daemon if _HAS_ATP: - from ansys.tools.path import get_ansys_path, version_from_path + from ansys.tools.path import get_mapdl_path, version_from_path if _HAS_TQDM: from tqdm import tqdm @@ -281,7 +281,7 @@ def __init__( if not exec_file: # get default executable if _HAS_ATP: - exec_file = get_ansys_path() + exec_file = get_mapdl_path() else: raise ValueError( "Please use 'exec_file' argument to specify the location of the ansys installation.\n" From e82d10c08d21c949735d2dc04f4e0d5b05981f28 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:56:02 +0000 Subject: [PATCH 2/2] chore: adding changelog file 3573.added.md [dependabot-skip] --- doc/changelog.d/3573.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/3573.added.md diff --git a/doc/changelog.d/3573.added.md b/doc/changelog.d/3573.added.md new file mode 100644 index 0000000000..95bbfdd6b4 --- /dev/null +++ b/doc/changelog.d/3573.added.md @@ -0,0 +1 @@ +refactor: replace `get_ansys_path` with `get_mapdl_path` \ No newline at end of file