Skip to content

Commit 404f50c

Browse files
committed
fix: remove deprecated distutils imports by local mode
1 parent 74c624a commit 404f50c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/sagemaker/local/image.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import tarfile
3131
import tempfile
3232

33-
from distutils.spawn import find_executable
3433
from threading import Thread
3534
from typing import Dict, List
3635
from six.moves.urllib.parse import urlparse
@@ -170,7 +169,7 @@ def _get_compose_cmd_prefix():
170169
compose_cmd_prefix.extend(["docker", "compose"])
171170
return compose_cmd_prefix
172171

173-
if find_executable("docker-compose") is not None:
172+
if shutil.which("docker-compose") is not None:
174173
logger.info("'Docker Compose' found using Docker Compose CLI.")
175174
compose_cmd_prefix.extend(["docker-compose"])
176175
return compose_cmd_prefix

src/sagemaker/local/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import re
2222
import errno
2323

24-
from distutils.dir_util import copy_tree
2524
from six.moves.urllib.parse import urlparse
2625

2726
from sagemaker import s3
@@ -102,7 +101,7 @@ def move_to_destination(source, destination, job_name, sagemaker_session, prefix
102101

103102

104103
def recursive_copy(source, destination):
105-
"""A wrapper around distutils.dir_util.copy_tree.
104+
"""A wrapper around shutil.copy_tree.
106105
107106
This won't throw any exception when the source directory does not exist.
108107
@@ -111,7 +110,7 @@ def recursive_copy(source, destination):
111110
destination (str): destination path
112111
"""
113112
if os.path.isdir(source):
114-
copy_tree(source, destination)
113+
shutil.copytree(source, destination, dirs_exist_ok=True)
115114

116115

117116
def kill_child_processes(pid):

0 commit comments

Comments
 (0)