Skip to content

Commit

Permalink
Replace all os.name with boolean checks is_windows, is_linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kbhagat-ansys committed Dec 7, 2023
1 parent 325cc63 commit cf255f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def setup(app):
sys.path.append(os.path.join(root_path))
from pyaedt import __version__

from pyaedt import is_windows

project = "PyAEDT"
copyright = f"(c) {datetime.datetime.now().year} ANSYS, Inc. All rights reserved"
Expand Down Expand Up @@ -254,7 +255,7 @@ def setup(app):
os.makedirs(pyvista.FIGURE_PATH)

# gallery build requires AEDT install
if os.name != "posix" and "PYAEDT_CI_NO_EXAMPLES" not in os.environ:
if is_windows and "PYAEDT_CI_NO_EXAMPLES" not in os.environ:

# suppress annoying matplotlib bug
warnings.filterwarnings(
Expand Down
7 changes: 5 additions & 2 deletions pyaedt/generic/grpc_plugin_dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
from ctypes import py_object
import os

is_linux = os.name == "posix"
is_windows = not is_linux

pathDir = os.environ["DesktopPluginPyAEDT"] # DesktopPlugin
pathDir = os.path.dirname(pathDir) # PythonFiles
pathDir = os.path.dirname(pathDir) # DesktopPlugin or Win64
# dirName = os.path.basename(pathDir)


# Plugin filename depends on OS
if os.name != r"nt":
if is_linux:
pluginFileName = r"libPyDesktopPlugin.so"
else:
pluginFileName = r"PyDesktopPlugin.dll"
Expand All @@ -28,7 +31,7 @@
# AedtAPIDll_file = os.path.join(pathDir, r"PyAedtStub/x64/Debug/PyAedtStub.dll") #develop dir

# load dll
if os.name == r"nt":
if is_windows:
# on windows, modify path
aedtDir = os.path.dirname(AedtAPIDll_file)
originalPath = os.environ["PATH"]
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/generic/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def export_dc_report(
command.append("-RunScriptAndExit")
command.append('"' + scriptname + '"')
print(command)
if os.name == "posix":
if is_linux:
p = subprocess.Popen(command)

else:
Expand Down

0 comments on commit cf255f9

Please sign in to comment.