From b7be99c14761e7f08c319a1d875692a975b937db Mon Sep 17 00:00:00 2001 From: elajkat Date: Wed, 18 May 2022 16:46:40 +0200 Subject: [PATCH] Remove "distutils" library Library "distutils" will be marked as deprecated in Python 3.10: https://peps.python.org/pep-0386/ This patch does the following replacements, that provide the same functionality and API: - distutils.spawn.find_executable -> shutil.which Change-Id: Ib9cf36a70b6e5aba93f87e6be5c2636599166de2 Closes-Bug: #1973780 --- neutron_fwaas/tests/fullstack/resources/process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neutron_fwaas/tests/fullstack/resources/process.py b/neutron_fwaas/tests/fullstack/resources/process.py index 0f98c888e..9f8727bc9 100644 --- a/neutron_fwaas/tests/fullstack/resources/process.py +++ b/neutron_fwaas/tests/fullstack/resources/process.py @@ -13,8 +13,8 @@ # under the License. import datetime -from distutils import spawn import os +import shutil import signal import fixtures @@ -53,7 +53,7 @@ class ProcessFixture(fixtures.Fixture): timestamp = datetime.datetime.now().strftime("%Y-%m-%d--%H-%M-%S-%f") log_file = "%s--%s.log" % (self.process_name, timestamp) - cmd = [spawn.find_executable(self.exec_name), + cmd = [shutil.which(self.exec_name), '--log-dir', log_dir, '--log-file', log_file] for filename in self.config_filenames: @@ -160,7 +160,7 @@ class OVSAgentFixture(fixtures.Fixture): self.process_fixture = self.useFixture(ProcessFixture( test_name=self.test_name, process_name=self.NEUTRON_OVS_AGENT, - exec_name=spawn.find_executable( + exec_name=shutil.which( 'ovs_agent.py', path=os.path.join(base.ROOTDIR, 'common', 'agents')), config_filenames=config_filenames, @@ -223,7 +223,7 @@ class L3AgentFixture(fixtures.Fixture): ProcessFixture( test_name=self.test_name, process_name=self.NEUTRON_L3_AGENT, - exec_name=spawn.find_executable( + exec_name=shutil.which( 'l3_agent.py', path=os.path.join(base.ROOTDIR, 'common', 'agents')), config_filenames=config_filenames,