1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-14 06:38:36 +00:00

Remove dependency on distutils

Align with devlib and remove dependencies on distutils.

[1] https://github.com/ARM-software/devlib/pull/631/
This commit is contained in:
Marc Bonnici 2025-03-01 16:08:14 -06:00
parent b734e90de1
commit 75cfb56b38
2 changed files with 23 additions and 2 deletions

View File

@ -23,7 +23,6 @@ import re
import uuid
import getpass
from collections import OrderedDict
from distutils.dir_util import copy_tree # pylint: disable=no-name-in-module, import-error
from devlib.utils.types import identifier
try:
@ -43,6 +42,24 @@ from wa.utils.misc import (ensure_directory_exists as _d, capitalize,
from wa.utils.postgres import get_schema, POSTGRES_SCHEMA_DIR
from wa.utils.serializer import yaml
if sys.version_info >= (3, 8):
def copy_tree(src, dst):
from shutil import copy, copytree # pylint: disable=import-outside-toplevel
copytree(
src,
dst,
# dirs_exist_ok=True only exists in Python >= 3.8
dirs_exist_ok=True,
# Align with devlib and only copy the content without metadata
copy_function=copy
)
else:
def copy_tree(src, dst):
# pylint: disable=import-outside-toplevel, redefined-outer-name
from distutils.dir_util import copy_tree
# Align with devlib and only copy the content without metadata
copy_tree(src, dst, preserve_mode=False, preserve_times=False)
TEMPLATES_DIR = os.path.join(os.path.dirname(__file__), 'templates')

View File

@ -44,7 +44,11 @@ from time import sleep
from io import StringIO
# pylint: disable=wrong-import-position,unused-import
from itertools import chain, cycle
from distutils.spawn import find_executable # pylint: disable=no-name-in-module, import-error
try:
from shutil import which as find_executable
except ImportError:
from distutils.spawn import find_executable # pylint: disable=no-name-in-module, import-error
from dateutil import tz