Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 9aff519

Browse files
koubaapre-commit-ci[bot]germa89
authored
make generic and support mechanical (#27)
* make generic and support mechanical * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix paths * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Apply suggestions from code review Co-authored-by: German <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * remove check_valid_mechanical * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix * Fix returnin early in case there is no mapdl installed. * makedirs * Using 222 for testing * Update src/ansys/tools/path/path.py Co-authored-by: German <[email protected]> * Update src/ansys/tools/path/path.py Co-authored-by: German <[email protected]> * Update src/ansys/tools/path/path.py Co-authored-by: German <[email protected]> * Update src/ansys/tools/path/path.py Co-authored-by: German <[email protected]> * Update src/ansys/tools/path/path.py Co-authored-by: German <[email protected]> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: German <[email protected]> Co-authored-by: German <[email protected]>
1 parent 74e83b4 commit 9aff519

File tree

4 files changed

+676
-274
lines changed

4 files changed

+676
-274
lines changed

src/ansys/tools/path/__init__.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
tools.
2+
tools to find/cache installed Ansys products.
33
4-
path
4+
WARNING: This is not concurrent-safe (multiple python processes might race on this data.)
55
"""
66

77
try:
@@ -14,9 +14,18 @@
1414

1515
from ansys.tools.path.path import (
1616
SUPPORTED_ANSYS_VERSIONS,
17-
change_default_ansys_path,
18-
find_ansys,
19-
get_ansys_path,
17+
change_default_mapdl_path,
18+
change_default_mechanical_path,
19+
find_mapdl,
20+
find_mechanical,
2021
get_available_ansys_installations,
21-
save_ansys_path,
22+
get_mapdl_path,
23+
get_mechanical_path,
24+
save_mapdl_path,
25+
save_mechanical_path,
26+
version_from_path,
2227
)
28+
from ansys.tools.path.path import change_default_ansys_path # deprecated
29+
from ansys.tools.path.path import find_ansys # deprecated
30+
from ansys.tools.path.path import get_ansys_path # deprecated
31+
from ansys.tools.path.path import save_ansys_path # deprecated

src/ansys/tools/path/misc.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1+
"""Miscellaneous functions used by ansys-tools-path."""
2+
3+
import os
4+
5+
16
def is_float(input_string):
27
"""Returns true when a string can be converted to a float"""
38
try:
49
float(input_string)
510
return True
611
except ValueError:
712
return False
13+
14+
15+
def is_windows():
16+
"""Check if the host machine is on Windows.
17+
18+
Returns
19+
-------
20+
``True`` if the host machine is on Windows, ``False`` otherwise.
21+
"""
22+
return os.name == "nt"
23+
24+
25+
def is_linux():
26+
"""Check if the host machine is Linux.
27+
28+
Returns
29+
-------
30+
``True`` if the host machine is Linux, ``False`` otherwise.
31+
"""
32+
return os.name == "posix"

0 commit comments

Comments
 (0)