Skip to content

Commit f18e807

Browse files
committed
feat: for 261 dotnet 8 is included in core service
1 parent 7c7d5bb commit f18e807

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

src/ansys/geometry/core/connection/product_instance.py

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -464,29 +464,38 @@ def prepare_and_start_backend(
464464
# Verify dotnet is installed
465465
import shutil
466466

467-
if not shutil.which("dotnet"):
468-
raise RuntimeError(
469-
"Cannot find 'dotnet' command. "
470-
"Please install 'dotnet' to use the Ansys Geometry Core Service. "
471-
"At least dotnet 8.0 is required."
467+
if version < 261: # Only execute this block if version is less than 261
468+
if not shutil.which("dotnet"):
469+
raise RuntimeError(
470+
"Cannot find 'dotnet' command. "
471+
"Please install 'dotnet' to use the Ansys Geometry Core Service. "
472+
"At least dotnet 8.0 is required."
473+
)
474+
475+
# At least dotnet 8.0 is required
476+
# private method and controlled input by library - excluding bandit check.
477+
if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603
478+
raise RuntimeError(
479+
"Ansys Geometry Core Service requires at least dotnet 8.0. "
480+
"Please install a compatible version."
481+
)
482+
483+
# For Linux, we need to use the dotnet command to launch the Core Geometry Service
484+
args.append("dotnet")
485+
args.append(
486+
Path(
487+
root_service_folder,
488+
CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"),
489+
)
472490
)
473-
474-
# At least dotnet 8.0 is required
475-
# private method and controlled input by library - excluding bandit check.
476-
if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603
477-
raise RuntimeError(
478-
"Ansys Geometry Core Service requires at least dotnet 8.0. "
479-
"Please install a compatible version."
491+
if version >= 261:
492+
# For Linux, we need to use the exe file to launch the Core Geometry Service
493+
args.append(
494+
Path(
495+
root_service_folder,
496+
CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ""),
497+
)
480498
)
481-
482-
# For Linux, we need to use the dotnet command to launch the Core Geometry Service
483-
args.append("dotnet")
484-
args.append(
485-
Path(
486-
root_service_folder,
487-
CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"),
488-
)
489-
)
490499
else:
491500
raise RuntimeError(
492501
f"Cannot connect to backend {backend_type.name} using ``prepare_and_start_backend()``"

0 commit comments

Comments
 (0)