From 2ed03c8cdabc98119c30898ca215ced8781ce9ea Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 16 May 2024 10:54:40 -0600 Subject: [PATCH] Remove distutils and replace with shutil to support Python 3.12 in sw-remote-api --- saw-remote-api/python/saw_client/__init__.py | 2 +- saw-remote-api/python/saw_client/connection.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/saw-remote-api/python/saw_client/__init__.py b/saw-remote-api/python/saw_client/__init__.py index f79973d494..0e05b8fe6e 100644 --- a/saw-remote-api/python/saw_client/__init__.py +++ b/saw-remote-api/python/saw_client/__init__.py @@ -5,7 +5,7 @@ import sys import time import atexit -from distutils.spawn import find_executable +from shutil import which import cryptol diff --git a/saw-remote-api/python/saw_client/connection.py b/saw-remote-api/python/saw_client/connection.py index 8675dcfe65..587cd3ef2a 100644 --- a/saw-remote-api/python/saw_client/connection.py +++ b/saw-remote-api/python/saw_client/connection.py @@ -2,7 +2,7 @@ import os import signal import sys -from distutils.spawn import find_executable +from shutil import which from argo_client.connection import ServerConnection, DynamicSocketProcess, HttpProcess, ManagedProcess from argo_client.interaction import Interaction, Command from .commands import * @@ -52,11 +52,11 @@ def connect(command: Union[str, ServerConnection, None] = None, c = SAWConnection(command, log_dest=log_dest) elif url is not None: c = SAWConnection(ServerConnection(HttpProcess(url, verify=verify)), log_dest=log_dest) - elif (command := os.getenv('SAW_SERVER')) is not None and (command := find_executable(command)) is not None: + elif (command := os.getenv('SAW_SERVER')) is not None and (command := which(command)) is not None: c = SAWConnection(command+" socket", log_dest=log_dest) # SAWConnection(ServerConnection(StdIOProcess(command+" stdio"))) elif (url := os.getenv('SAW_SERVER_URL')) is not None: c = SAWConnection(ServerConnection(HttpProcess(url, verify=verify)), log_dest=log_dest) - elif (command := find_executable('saw-remote-api')) is not None: + elif (command := which('saw-remote-api')) is not None: c = SAWConnection(command+" socket", log_dest=log_dest) else: raise ValueError(