Skip to content
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
1 change: 1 addition & 0 deletions doc/changelog.d/2226.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
For 261 dotnet 8 is included in core service
55 changes: 34 additions & 21 deletions src/ansys/geometry/core/connection/product_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,29 +465,42 @@ def prepare_and_start_backend(
# Verify dotnet is installed
import shutil

if not shutil.which("dotnet"):
raise RuntimeError(
"Cannot find 'dotnet' command. "
"Please install 'dotnet' to use the Ansys Geometry Core Service. "
"At least dotnet 8.0 is required."
if not any(
CORE_GEOMETRY_SERVICE_EXE.replace(".exe", "") in file.name
for file in Path(root_service_folder).iterdir()
):
if not shutil.which("dotnet"):
raise RuntimeError(
"Cannot find 'dotnet' command. "
"Please install 'dotnet' to use the Ansys Geometry Core Service. "
"At least dotnet 8.0 is required."
)
# At least dotnet 8.0 is required
# private method and controlled input by library - excluding bandit check.
if (
subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] # nosec B607, B603
< "8"
):
raise RuntimeError(
"Ansys Geometry Core Service requires at least dotnet 8.0. "
"Please install a compatible version."
)
# For Linux, we need to use the dotnet command to launch the Core Geometry Service
args.append("dotnet")
args.append(
Path(
root_service_folder,
CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"),
)
)

# At least dotnet 8.0 is required
# private method and controlled input by library - excluding bandit check.
if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603
raise RuntimeError(
"Ansys Geometry Core Service requires at least dotnet 8.0. "
"Please install a compatible version."
)

# For Linux, we need to use the dotnet command to launch the Core Geometry Service
args.append("dotnet")
args.append(
Path(
root_service_folder,
CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"),
else:
# For Linux, we need to use the exe file to launch the Core Geometry Service
args.append(
Path(
root_service_folder,
CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ""),
)
)
)
else:
raise RuntimeError(
f"Cannot connect to backend {backend_type.name} using ``prepare_and_start_backend()``"
Expand Down
Loading