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
This commit is contained in:
parent
ba0a036469
commit
b7be99c147
@ -13,8 +13,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from distutils import spawn
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
@ -53,7 +53,7 @@ class ProcessFixture(fixtures.Fixture):
|
|||||||
|
|
||||||
timestamp = datetime.datetime.now().strftime("%Y-%m-%d--%H-%M-%S-%f")
|
timestamp = datetime.datetime.now().strftime("%Y-%m-%d--%H-%M-%S-%f")
|
||||||
log_file = "%s--%s.log" % (self.process_name, timestamp)
|
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-dir', log_dir,
|
||||||
'--log-file', log_file]
|
'--log-file', log_file]
|
||||||
for filename in self.config_filenames:
|
for filename in self.config_filenames:
|
||||||
@ -160,7 +160,7 @@ class OVSAgentFixture(fixtures.Fixture):
|
|||||||
self.process_fixture = self.useFixture(ProcessFixture(
|
self.process_fixture = self.useFixture(ProcessFixture(
|
||||||
test_name=self.test_name,
|
test_name=self.test_name,
|
||||||
process_name=self.NEUTRON_OVS_AGENT,
|
process_name=self.NEUTRON_OVS_AGENT,
|
||||||
exec_name=spawn.find_executable(
|
exec_name=shutil.which(
|
||||||
'ovs_agent.py',
|
'ovs_agent.py',
|
||||||
path=os.path.join(base.ROOTDIR, 'common', 'agents')),
|
path=os.path.join(base.ROOTDIR, 'common', 'agents')),
|
||||||
config_filenames=config_filenames,
|
config_filenames=config_filenames,
|
||||||
@ -223,7 +223,7 @@ class L3AgentFixture(fixtures.Fixture):
|
|||||||
ProcessFixture(
|
ProcessFixture(
|
||||||
test_name=self.test_name,
|
test_name=self.test_name,
|
||||||
process_name=self.NEUTRON_L3_AGENT,
|
process_name=self.NEUTRON_L3_AGENT,
|
||||||
exec_name=spawn.find_executable(
|
exec_name=shutil.which(
|
||||||
'l3_agent.py',
|
'l3_agent.py',
|
||||||
path=os.path.join(base.ROOTDIR, 'common', 'agents')),
|
path=os.path.join(base.ROOTDIR, 'common', 'agents')),
|
||||||
config_filenames=config_filenames,
|
config_filenames=config_filenames,
|
||||||
|
Loading…
Reference in New Issue
Block a user