Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all os.name with boolean checks is_windows, is_linux #3956

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading