Remove use of distutils. (#7770)

distutils is deprecated and replaced by other stdlib constructs.
This commit is contained in:
Jiaming Yuan
2022-03-31 19:03:10 +08:00
committed by GitHub
parent e8eff3581b
commit 02dd7b6913
3 changed files with 21 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
[metadata]
description-file = README.rst
description_file = README.rst
[mypy]
ignore_missing_imports = True

View File

@@ -3,7 +3,6 @@ import os
import shutil
import subprocess
import logging
import distutils
from typing import Optional, List
import sys
from platform import system
@@ -51,11 +50,11 @@ def lib_name() -> str:
def copy_tree(src_dir: str, target_dir: str) -> None:
'''Copy source tree into build directory.'''
def clean_copy_tree(src: str, dst: str) -> None:
distutils.dir_util.copy_tree(src, dst)
shutil.copytree(src, dst)
NEED_CLEAN_TREE.add(os.path.abspath(dst))
def clean_copy_file(src: str, dst: str) -> None:
distutils.file_util.copy_file(src, dst)
shutil.copy(src, dst)
NEED_CLEAN_FILE.add(os.path.abspath(dst))
src = os.path.join(src_dir, 'src')